Table of Contents

Xen Virtual Machines

Xen Server dom0

You should create a partition a bit larger than the amount of ram allocated to domU guests. If you shutdown the dom0, the domU guests are saved state to '/var/lib/xen/save'

lvcreate --size 16.1g --name xen vg01
mkdir /var/lib/xen

And add to /etc/fstab

/dev/mapper/vg01-xen /var/lib/xen            reiserfs noatime         0       2

and mount

mount /var/lib/xen

Xen Client domU using netboot

This creates the LV with equal-sized stripes over a 2 drive Volume Group (Creates a raid0 LV for write performance).

# lvcreate --size 10g -i 2 --name ubuntu14 vg01
  Using default stripesize 64.00 KiB
  Logical volume 'ubuntu14' created
mkdir /var/lib/xen/trusty-netboot
cd /var/lib/xen/trusty-netboot
wget -c http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/xen/initrd.gz
wget -c http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/xen/vmlinuz

/etc/xen/ubuntu14.cfg:

name = 'ubuntu14'

memory = 4000
vcpus = 4

disk = [ 'phy:vg01/ubuntu14,sda,w' ]
vif = [ 'bridge=xenbr0' ]

kernel = '/var/lib/xen/trusty-netboot/vmlinuz'
ramdisk = '/var/lib/xen/trusty-netboot/initrd.gz'
extra = 'debian-installer/exit/always_halt=true -- console=hvc0 url=server-with-preseed.com'

Start the installer:

xm create -c ubuntu14.cfg

After the install, revise the cfg file to comment out the local kernel/ramdisk and add pygrub.

...
#kernel = '/var/lib/xen/trusty-netboot/vmlinuz'
#ramdisk = '/var/lib/xen/trusty-netboot/initrd.gz'
#extra = 'debian-installer/exit/always_halt=true -- console=hvc0 url=server-with-preseed.com'
bootloader = 'pygrub'