Move LVM based domU to a zvol

From Wiki
Jump to: navigation, search

First you will need to create a zvol to contain the domain's file system.

zfs create -V 20gb -o shareiscsi=on xen/trek.phildo.org

Next, import the iscsi target on a linux box and put a file system on it, USE THE RAW DISK.

mkfs -t ext3 /dev/sdd for example.

Now rsync the data over.

rsync -avzHl -e ssh root@xentest5.example.com:/mnt/source/ /mnt/target/
umount /mnt/target
service iscsi stop

Finally, start the domain on the new server.

xm create /etc/xen/trek.phildo.org
virsh dumpxml trek.phildo.org
virsh define trek.phildo.org

Here's a sample config:

kernel = "/xen/vmlinuz"
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'preserve'
memory = 512
name = "trek.phildo.org"
vif = [ '' ]
dhcp = "off"
disk = ['phy:/dev/zvol/dsk/xen/trek.phildo.org,sda1,w', 'file:/xen/swap/trek.phildo.org.swap,sda2,w']
root = "/dev/sda1 ro"