Jontow Homelab KVM

From WTFwiki
Revision as of 20:47, 16 October 2015 by Jontow (talk | contribs)
Jump to navigation Jump to search

Ubuntu 15.04 Notes


This section should get a general build of a VM host running KVM with libvirt (virsh)
and 2TB of RAID1 (softraid) running on Ubuntu 15.04 server. The hardware platform
that this section targets/was tested on is a Sun Fire X2200 M2. There is a hardware
specific notes section below.

The disks will be setup with RAID and LVM, giving a maximum compromise of reliability
and flexibility. Swap partitions are setup outside of softraid to maximize performance.

Disk Config

  • (2) x 2.0 TB disks in chassis, built at install time using the following general procedure:
    • From aux shell: fdisk /dev/sda and "g" to GPT the disk, repeat for /dev/sdb
    • Create a new (bios_grub) partition on each disk: ~256MB is fine
    • Create any swap partitions necessary
    • Create a new identically sized partition on each disk, "Use as: physical volume for RAID"
    • Configure Software RAID: RAID1, 2 devices, 0 spares, select the two identical partitions as members.
    • Configure LVM:
      • Create VG with PV /dev/md0 (named "vm1-vg")
      • Create LV (20G) from VG "vm1-vg" (named "vm1-root")
      • Create LV (20G) from VG "vm1-vg" (named "vm1-iso-0")
      • Create LV (1T) from VG "vm1-vg" (named "vm1-store-0")
      • Setup "vm1-root" as / with ext4 FS
      • Setup "vm1-iso-0" as /vm1-iso with ext4 FS
      • Setup "vm1-store-0" as /vm1-store-0 with ext4 FS
    • When asked, install grub to "/dev/sda" (it'll try to use "/dev/mapper", override this.)
    • After firstboot of system, run "dpkg-reconfigure grub-pc"


 $ sudo apt-get install zsh multitail screen sysstat openssh-server nfs-kernel-server
 $ sudo apt-get install qemu-kvm libvirt-bin openvswitch-switch openvswitch-common
 $ sudo apt-get install libpolkit-agent-1-0 libpolkit-backend-1-0 policykit-1
 $ sudo apt-get install virtinst

System Config

  • /etc/hosts :       localhost       vm1    vm1.xc  vm1    vm2.xc  vm2

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
  • Setup storage repo:
 $ sudo ln -s /vm1-store-0 /vm-store-0


  • /etc/exports (on vm1):
 /vm1-store-0            vm2.xc(rw,sync,no_subtree_check,no_root_squash)
  • Enable/start NFS:
 $ sudo systemctl enable nfs-kernel-server
 $ sudo systemctl start nfs-kernel-server