Adventures As Me


Xen to the process

Written 15 May 2008

For two years now my testing platform has consisted of half a dozen physical machines (running a mixture of CentOS Linux and FreeBSD) and two powerful servers running VMware server. During that time I've had a couple instances to introduce Xen into the mix, but never on a permanent basis, usually due to time constraints. With two people my department now, I've had the opportunity to setup a more permanent Xen server. The Host itself is modest: AMD 3800+, 3 GiB RAM and A few hundred GB of Drive space.

The VMware server experience has soured me on the OS-in-a-loop-back-file method. Yes it can support LVM partitions, but only with some trickery, which I don't want to do. Xen, however, needs no trickery.

With the help of LVM and images from jailme.org, I've been working out a nice routine which I will eventually automate. The process itself is rather simple:

  • Create a new LVM partition for the OS ( e.g. lvcreate --size 20G -l OsName GroupName )
  • Create a new LVM partition for swap ( e.g. lvcreate --size 1G -l OsSwap GroupName )
  • Format the OS partition ( e.g. mkfs.ext3 -L OsPart /dev/GroupName/OsName )
  • Format the Swap partition ( e.g. mkswap /dev/GroupName/OsSwap )
  • Mount the Jailme.org image ( e.g. mount -o loop image.img /mnt )
  • Mount the OS Partition ( e.g. mount /dev/GroupName/OsName /xen )
  • Use rsync to copy the image contents to the OS Partition ( e.g. rsync -aP /mnt/* /xen )
  • Make changes to some configuration files on the OS Partition
  • Unmount the image and OS Partition
  • Customize the Xen configuration file
  • Start the image

    My requirements only necessitate having a few setups like the above. My goal in automating the process is not just to remove the tedium, but to improve the speed. With a rough estimate, I think the above could be automated to occur in less than 10 minutes (accounting for load on the system).

    Once that is automated, my next goal is to tackle taking 'snapshots' of the Xen guest. I'm still undecided as to the exact method, although I am currently leaning toward creating a tarball of the partition.

Related Posts