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/

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 /mnt/target/
umount /mnt/target
service iscsi stop

Finally, start the domain on the new server.

xm create /etc/xen/
virsh dumpxml
virsh define

Here's a sample config:

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