How do I migrate a KVM guest from host to another?

Jeff Shattock asked:

I have a KVM guest that I need to migrate from one host to another. The migration does not need to be done hot. Its storage is currently backed by LVM block devices, with a bridged network adapter. Both servers have the same kernel, version of libvirt, qemu, etc. Whats the easiest way to do this?

My guess at this is:

dd the block devices from server A to server B
export the xml VM definition on A, copy it to B
edit the xml to refer to the new physical device names
create the machine referencing that xml file

My answer:


KVM (since qemu 1.3) now includes storage migration functionality, so it’s no longer necessary to do any of the hackery shown in the older answers. Just migrate the VM as you normally would, for instance virsh migrate "Guest Name" qemu+ssh://dest-hypervisor/system or click the nice buttons in your GUI of choice.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.