daily system administration

Linux, Debian and the rest
any questions or comments: Tom@d7031.de

Moving a XEN-Instance from etch to lenny

With the upgrade from Debian etch to lenny i’ve set up an new machine to serv my XEN-Instances. First install the Dom0 on the new hardware and create a logical volume (here my-lvm-vg on/dev/sdb) for further expansion:

pvcreate /dev/sdb
    vgcreate my-lvm-vg /dev/sdb

Then bring up your network by editing the /etc/xen/xend-config.sxp similar to the old system (e. g. network-bridge). If you have broken network interfaces in Dom0, follow this link.

Now create new logical volumes with the same size as the old ones:

lvcreate -n host1.fqdn-disk -L 10G my-lvm-vg
    lvcreate -n host1.fqdn-swap -L 256M my-lvm-vg

Copy the DomU’s using scp to the new lenny machine:

On the old etch-machine

xm shutdown <domain-id>
    dd if=/dev/my-lvm-vg/host1.fqdn-disk bs=1k | ssh -C root@<new-machine> dd of=/dev/my-lvm-vg/host1.fqdn-disk bs=1k
    scp /etc/xen/host1.fqdn.cfg root@<new-machine>:/etc/xen/

After that check the filesystem of the new DomU’s with _e2fsck -f /dev/my-lvm-vg/host1.fqdn-disk_and edit your host1.fqdn.cfg to use the new kernel version. At the moment e. g. :

kernel  = '/boot/vmlinuz-2.6.26-2-xen-686'
    ramdisk = '/boot/initrd.img-2.6.26-2-xen-686'

All your DomU’s needs the suitable kernel module. Simultaneous edit the _/etc/init.d/hwclock.sh_inside the DomU to prevent hanging on boot. Insert a exit 0 in the second line after #!/bin/sh.

mount -o loop /dev/my-lvm-vg/host1.fqdn-disk /mnt/
    cp -vdpR /lib/modules/2.6.26-2-xen-686 /mnt/lib/modules/
    vi /mnt/etc/init.d/hwclock.sh
       #!/bin/sh
       exit 0
    umount /mnt/

Another pitfall is the crond-daemon start. It hangs also at boot. The solution is to add a line extra = ‘console=hvc0 xencons=tty’ in your host1.fqdn.cfg (see xen-support).

The last two errors are the swap- and ssh-login-error. So boot the DomU an do this (my swap is here /dev/sda2):

mkswap /dev/sda2
    swapon -a

If you try to login in your DomU using SSH, you get an ssh error: PTY allocation request failed …. Install udev on the DomU will fix it.

Done!

Tom