Monday, November 23, 2015

Proxmox v4.x mini home server with less than 10 watts of power consumption

I have just built a home server using Intel Celeron J1900 CPU (Baytrail chipset) and Asrock Q1900 mini ITX motherboard, loaded Proxmox 4.x virtualization environment.  I picked this hardware configuration for low power consumption and low maintenance.  This intel Celeron J1900 CPU is soldered on the Asrock Q1900 motherboard, it has Quad Core, runs at 2.0Ghz and consumes less than 10 watts (about 8.9 according to Intel's specifications).  Awesome.

I bought the motherboard on Ebay for only $80 including shipping. And it came with 8GB memory module (what a deal!).

For storage I am using a single Intel 320 80GB SSD drive and 2 x 4TB Western Digital hard drives in software RAID1 (mirroring) mode.  I am betting on the Intel SSD's long lifetime to provide me trouble free operation.

NO moving parts!  well actually I have a fan in the power supply and obviously the 2 4TB hard drives are moving inside. Haha... well nothing I can do there, but at least the CPU and SSD drive have no moving parts.

SILENT!  I can not hear anything from this new server. It runs almost completely silent which I love and makes my wife happy. :-)

Okay enough with the introduction, let me give the specifications and describe how I managed to install Proxmox and what virtual servers I have loaded on this new mini home server.

SPECIFICATIONS:

Motherboard Asrock Q1900

  1. Intel® Quad-Core Processor J1900 + Mini-ITX Motherboard
  2. All Solid Capacitor design
  3. Supports DDR3/DDR3L 1333 memory, 2 x SO-DIMM slots
  4. 1 PCIe 2.0 x1, 1 mini-PCIe
  5. Graphics Output Options : D-Sub, DVI-D, HDMI
  6. Built-in Intel® 7th generation (Gen 7) graphics, DirectX 11.0, Pixel Shader 5.0
  7. 7.1 CH HD Audio with Content Protection (Realtek ALC892 Audio Codec)
  8. 2 SATA3, 2 SATA2, 4 USB 3.0 (2 Front, 2 Rear), 4 USB 2.0 (2 Front, 2 Rear)
  9. 1 x Print Port Header, 1 x COM Port Header
  10. Supports A-Tuning, XFast LAN, XFast RAM, USB Key

Extra NIC (gigabit lan card) for PFSense WAN PORT:



As I mentioned, I bought the parts above from Ebay and it came with 8GB SO-DIMM already included. Nice!


OPERATING SYSTEM:

I tried to install Proxmox 4 by dowloading its ISO directly from Proxmox, from this page.  But it did not work well with this motherboard because it failed to enter VESA graphic mode that Proxmox installer required.  After some googling I decided to follow one of the advice of other users with similar issue to install Proxmox via Debian.

So I downloaded Debian Jessie (minimal ISO version), loaded it into USB thumb drive, and installed it on my SSD boot drive.  Please make sure you choose LVM partition management.

This is the guide I followed after I have installed Debian to install Proxmox flawlessly:

https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Jessie

Once Proxmox has been installed I started to install the following software:

1.  Software Raid

This image below will show my RAID1 partition mounted and being used as Proxmox storage:


2.  Download templates from Turnkey Linux



3. File Server  (samba)
    Even though I am not a fan of Samba, it is one of the most popular and most used network file sharing system. So I have decided to use Turnkey Linux's appliance called "File Server".  It works quite well and it installed as LXC (linux container) which saves a lot of resources. Nice!

4. Plex Media Server
     I have also installed a Free Plex Media Server and let it scan through all my home videos and family photos.  Plex Server is free for you to install on your server.  I was able to install it inside a Debian LXC with just one install command.  Very easy, just sign-up for free as a Plex user and find the instructions to download the Plex Server and install into Debian LXC.  Works perfectly.


5. Torrent Server
    I don't use torrent much, but sometime it is handy to have a torrent server that does not need a computer to be on during the long file transfer. So the Turnkey Appliance for ruTorrect from Turnkey Linux was perfect. And again, it is an LXC!


6. My family like to use Roku, so I used to have roConnect (a web appliance to serve and play movies via browser) running on my Macbook which was annoying to need to have a LAMP running on my Macbook.  This mini server finally free me up to not have to worry about this anymore.  I simply install a Turnkey Linux LAMP appliance, load up roConnect, configure it, and Voila. roConnect 24/7!


7. Failed to install LXDE, I wanted to have a simple and lightweight Linux desktop (headless), something that I can remote into using VNC or Teamviewer, but it failed to work.  I have not had time to troubleshoot why, maybe later.  I have an XCFE working with OpenVZ before and I think LXDE on LXC should work also.  I will create a post with why it did not work and how I worked around it later.


8. PFSense firewall, I would like to install PFSense next, using KVM (QEMU).  This will replace my Tomato USB Asus Router (which has served me well for 5 years).   Having a real firewall like PFSense at home would be overkill, but what the heck I have a server for it anyways.  Haha
I will post another article about how this goes also later.


SUMMARY:

Overall I am very happy with my mini server plan, I have 5 LXC containers running so far:
    
      a.  File Server
      b.  Torrent Server
      c.  roConnect
      d.  LXDE (running but can not startx yet)
      e.  Plex Server

Plus 3.5TB of mirrored storage for my family all less than $450.00.   The 4TB hard drives cost the most at about $140 each.  What I love most about this server is that it will cost me only about $10 being powered on 24 / 7 for a full year.  Yes, $10 / year!  WOW!

I am waiting to install another 8GB memory, but the CPU and Memory utilization has been modest and very reasonable, see image below:


Thanks for reading I will post more articles about PFSense and LXDE how to later.

--Andrew



Install Software RAID to existing Proxmox PVE installation

This is my notes of commands I have executed in Proxmox hardware node to add Software RAID capability to any Proxmox PVE existing installation:


apt-get update 
apt-get upgrade
apt-get dist-upgrade

apt-get install mdadm

modprobe raid1
                        (do not need to add to /etc/modules)


cat /proc/mdstat


Prepare partitions to Linux Raid Auto-Detect:

fdisk -l
fdisk /dev/sdb
    type fd  (change partition type to linux auto raid)


Copy partition from one drive to another

sfdisk -d /dev/sdb | sfdisk --force /dev/sdc



Remove previous RAID data if any:
mdadm --zero-superblock /dev/sdb1
mdadm --zero-superblock /dev/sdc1


Create the array with missing disk
mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdb1


Create the array with both disk
mdadm --create /dev/md0 --level=1 --raid-disks=2 /dev/sdb1 /dev/sdc1


To Add Secondary Drive Later do
mdadm --manage /dev/md0 --add /dev/sdc1

-----------------------------------  (if using LVM use this section below) -------------------------------


umount /mnt/md0
cat /proc/mdstat

pvcreate /dev/md0
vgcreate vglocalmd0 /dev/md0

lvcreate -n localmd0 -l 90%FREE vglocalmd0
-or-
lvcreate -n localmd0 -l 100%FREE vglocalmd0   (allocate 100% - but backup using snapshot will fail)

mkfs.ext4 /dev/vglocalmd0/localmd0

blkid      (to get and copy the uuid)

nano /etc/fstab

UUID=<uuid> /mnt/md0 ext4 defaults,noatime,nodiratime,noacl,data=writeback,barrier=0,nobh,errors=remount-ro 0 2

rm -rf /mnt/md0/*
chmod 777 /mnt/md0

mount -a

df -h /mnt/md0      (just to check and make sure the mount is there and okay)


-----------------------------------  (if using NON-LVM (just ext4) use this section below) -------------------------------

Create the filesystem
mkfs.ext4 /dev/md0

Double check to make sure all okay:
cat /proc/mdstat

Create mount target
mkdir /mnt/md0
chmod -R 777 /mnt/md0


---------------------- end of (LVM / Ext4 configuration -----------------

Edit fstab
blkid

nano /etc/fstab
UUID=<UUID> /mnt/md0 ext4 defaults,noatime,nodiratime,noacl,data=writeback,barrier=0,nobh,errors=remount-ro 0 2

mount -a

reboot

Saturday, November 21, 2015

Proxmox boot failure - missing proxmox entry from grub menu - caused by answering YES during upgrade

Proxmox boot failure - missing proxmox entry from grub - can not boot

I got into a problem during a proxmox upgrade.  I was trying to do a proxmox upgrade from 3.1 to 3.5.
I have performed this proxmox upgrade many times, however this time I answered the wrong question during grub upgrade. The question was “Upgrade GRUB 2 (continue without upgrading Grub 2)“, I should have answered NO, but I made a mistake and answered YES.

Answering yes, means grub configuration will not be updated, which is a huge mistake, and I did not realize this mistake until I reboot the server and realized that proxmox is missing from the grub menu, and it booted to memtest immediately.

I start googling and found that many people have experience this problem… most people have this same issue from a bug that proxmox had, and some people experienced error during upgrade, nevertheless the same solution may work for many of the proxmox grub installation / upgrade issues you may have.

Here are the steps I did to make my server boots properly again:

  1. BOOT TO EXISTING PROXMOX INSTALLATION USING PROXMOX CD / USB live drive

    on the proxmox boot screen, type in ‘pveboot’ and press enter.

    pveboot will allow you to boot into your existing proxmox installation (yes, the one you can not automatically boot into)
  2. FIX GRUB CONFIGURATION AND RE-INSTALL GRUB TO BOOT DEVICE

    nano /boot/grub/grub.cfg

    look for the first entry, similar to this:


    menuentry 'Proxmox Virtual Environment GNU/Linux, with Linux 2.6.32-43-pve' --class proxmox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-2.6.32-43-pve-advanced-' {
    load_video
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos1'
    if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1' 699b8223-64d7-4963-82b2-1b0c14db974a
    else
    search --no-floppy --fs-uuid --set=root 699b8223-64d7-4963-82b2-1b0c14db974a
    fi
    echo 'Loading Linux 2.6.32-43-pve ...'
    linux /vmlinuz-2.6.32-43-pve root= ro quiet
    echo 'Loading initial ramdisk ...'
    initrd /initrd.img-2.6.32-43-pve
    }


    replace whatever necessary to something that works (I compared and copied from another proxmox server I have - does not have to be same version)
    The menu entry below is the right one I copied from another hardware node:

  3. menuentry 'Proxmox Virtual Environment GNU/Linux' --class proxmox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-' {
    load_video
    insmod gzio
    insmod part_gpt
    insmod ext2
    set root='(hd0,gpt2)'
    search --no-floppy --fs-uuid --set=root 699b8223-64d7-4963-82b2-1b0c14db974a
    echo 'Loading Linux 2.6.32-43-pve ...'
    linux /vmlinuz-2.6.32-43-pve root=/dev/mapper/pve-root ro quiet gfxpayload=text nomodeset
    echo 'Loading initial ramdisk ...'
    initrd /initrd.img-2.6.32-43-pve
    }
    I have bolded the text that I have noticed to be different and I have corrected
    Please note:
    - your Linux kernel version may be different, mine is 2.6.32-43-pve
    - your root UUID should be different, mine is 699b8223-64d7-4963-82b2-1b0c14db974aif you don't know your UUID you can type 'blkid' command to get a list of your device's UUID.
    - my root device path is /dev/mapper/pve-root because I use LVM partition, yours may be different.

    Then install the corrected configuration to your boot device:


    grub-install /dev/sda

    then we are done, we are ready to reboot


    reboot



The steps above took me hours to figure out. I hope this helps and saves somebody some time.