These are instructions for creating an Ubuntu Jaunty DomU on Debian Lenny Dom0 using Xen 3.2.1 that comes with Lenny. I’m installing into an LVM rather than using a file image. See this HowtoForge article for background of my particular setup. This tutorial assumes you’re working from a similar setup with an iscsi target and LVM-based VMs.
The reason I’m posting this is because I had such a hard time finding some combination of tools that worked correctly to do this. I tried a few options but had little success:
- debootstrap – Didn’t seem to work with Jaunty at all. It would just crash
- vm-install – Doesn’t support LVM-based VMs by default, but there is a procedure for converting the qcow image to an LVM
What I found is that I could find no way of creating the LVM-based VM in Lenny. I actually had to create a sid instance first and then install my open-iscsi and xen-utils into the sid VM, then use SID to populate the VM.
Perform the following actions in your SID vm or workstation
Note: You’ll need your /etc/xen-tools/xen-tools.conf setup like the instructions in the HowtoForge article (things like gateway, netmask, broadcast, passwd, fs type, install-method, etc).
Whenever I would try to build the vm with the default partitions, it would always fail. For some reason the resulting vm would have an fstab that shows something like sda1 and sda2 instead of xvda1 and xvda2. I had to create my own partition scheme before anything would work right. Here’s mine:
$ sudo cat /etc/xen-tools/partitions.d/with-data
[root]
size=4G
type=ext3
mountpoint=/
options=sync,errors=remount-ro
[swap]
size=512M
type=swap
[data]
size=4G
type=ext3
mountpoint=/data
options=nodev
You will need to create a symlink for jaunty so that the option is recognized at the command-line.
$ cd /usr/lib/xen-tools
$ sudo ln -s edgy.d jaunty.d
Now, finally, you can create the image. This step may take some time
$ xen-create-image –hostname=myserver –dhcp –lvm=vg_xen –dist=jaunty –mirror=http://archive.ubuntu.com/ubuntu –size=4Gb –memory=512Mb –swap=512MB –arch=i386 –partitions=with-data
Since you’re building the LVM on a different machine than it will eventually run on, you’ll need to copy the resulting xen config to the correct server:
$ scp /etc/xen/myserver.cfg root@realhost:/etc/xen/
That should be all you need to get this working.