Sysadmin/Migrate virtual machine

< Sysadmin
Revision as of 13:21, 9 December 2009 by Bernie (talk | contribs) (Created page with '== How to migrate a KVM machine from an LVM partition == (untested procedure) First, shutdown the VM, then do: mount /dev/treehouse/beamrider-root /mnt ssh housetree mount /…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to migrate a KVM machine from an LVM partition

(untested procedure)

First, shutdown the VM, then do:

mount /dev/treehouse/beamrider-root /mnt
ssh housetree mount /dev/housetree/beamrider-root /mnt
rsync -PHAXphax --delete --numeric-ids /mnt/ housetree:/mnt/
rsync -a /etc/libvirt/qemu/beamrider.xml housetree:/etc/libvirt/qemu/
umount /mnt
ssh housetree umount /mnt

Then log to $OTHERHOST and create the domain in virsh.

Downtime can be reduced to just a few minutes by doing a first rsync iteration from within the VM while it's still running.

Make sure you pass all the fancy switches to rsync or you'll loose information on the copy.