Loading...
 

Installing a new Xen DomU

Installing a new Debian/Ubuntu domain


First create a new logical volumes I.e:

$ lvcreate -L 1G -n mk-scripts-1-root DomU
$ lvcreate -L 25G -n mk-scripts-1-pv1 DomU
$ lvcreate -L 5G -n mk-scripts-1-pv2 DomU

During the DomU install, create / on the -root LV and create a volume group using -pv1 and create all other partitions (swap, /var, /home, /usr) as logical volumes.

-pv2 is added to the DomU volume group after the install . This is done because the install insists on the volume having a partition. The VG uses this partition instead of the volume so won't recognise a change in the volume size. Because -pv2 is added to the DomU-VG as a whole volume, it can be expanded on the Dom0 and the change will be picked up on the DomU. See here

Copy the template config I.e:

$ cp /etc/xen/vm/conf.d/debianTemplate.cfg /etc/xen/vm/conf.d/mk-scripts-1.cfg (debianTemplate.cfg)

edit the new file and change the lines below:

# Initial/max memory allocation (in megabytes) for the new domain.
memory = XXX
maxmem=XXX

# A name for your domain. All domains must have different names.
name = "XXXXX"

# Number of Virtual CPUS to use, default is 1
vcpus = 1

# Define network interfaces.
vif = 'bridge=br0,mac=00:16:3e:00:00:XX' #check other config files and increment accordingly

# Define the disk devices you want the domain to have access to
disk = 'phy:/dev/DomU/mk-scripts-1-root, 'phy:/dev/DomU/mk-scripts-1-pv1,xvdb,w', 'phy:/dev/DomU/mk-scripts-1-pv2,xvdc,w'



Get the most recent kernel and ramdisk:

$ cd /etc/xen/vm/ubuntu-net-install/
$ wget http://fi.archive.ubuntu.com/ubuntu/dists/lucid/main/installer-i386/current/images/netboot/xen/vmlinuz
$ wget http://fi.archive.ubuntu.com/ubuntu/dists/lucid/main/installer-i386/current/images/netboot/xen/initrd.gz

Start a network install (remember to change the config file to whatever you called it):

$ xm create -f /etc/xen/vm/conf.d/mk-scripts-1.cfg -c install=true install-kernel="/etc/xen/vm/ubuntu-net-install/vmlinuz" install-extra="acpi=noirq" install-ramdisk="/etc/xen/vm/ubuntu-net-install/initrd.gz" install-mirror="http://fi.archive.ubuntu.com/ubuntu"

During the install

careful attention needs to be paid to the partitioning
LVM is best used to enable online disk management, but cannot be used for the root partition (/ also needs to be ext3, not ext4). So:
xvda = /
xvdb = LVM

I've used xvdb to create a Volume Group called DomU-VG1. With Logical Volumes for swap, /home, /usr and /var. This enables these volumes to be resized if necessary.

After the install, the configuration needs to be permanently added to xend:

$ xm new /etc/xen/vm/conf.d/mk-scripts-1.cfg

Then start it

$ xm start mk-scripts-1

You can then connect:

xm console mk-scripts-1
and hit enter a couple of times.

Installing a Fedora Core DomU