Moving a KVM guest to another machine

  1. Properly shutdown the guest:
    guest# poweroff
  2. Create an LVM volume of the same size on the new machine:
    newmachine# lvcreate -L 120G -n myguest myvolgroup
  3. Copy the disk from the old machine over to the new one:
    oldmachine# dd if=/dev/vg_foo/lv_bar | ssh newmachine dd of=/dev/volgroup/myguest
  4. Wait for the transfer to complete (on a 100Mbit/s connection it took about 3.5 hours to transfer the 120GB).
  5. Copy /etc/libvirt/qemu/myguest.xml from the old machine over to the new machine and adapt the LVM path for the disk.
  6. Reload the libvirt configuration:
    newmachine# /etc/init.d/libvirt-bin reload
  7. Start up the guest on the new machine:
    newmachine# virsh start myguest

blog comments powered by Disqus