Jan 22 2021

KVM – Migrate VM to another host

  1. copy the VM’s disks from /var/lib/libvirt/images on src host to the same dir on destination host
  2. on the source host run virsh dumpxml VMNAME > domxml.xml and copy this xml to the destination host
  3. on the destination host run virsh define domxml.xml
  4. start the VM.
  • If the disk location differs, you need to edit the xml’s devices/disk node to point to the image on the destination host
  • If the VM is attached to custom defined networks, you’ll need to either edit them out of the xml on the destination host or redefine them as well
    1. On source machine virsh net-dumpxml NETNAME > netxml.xml
    2. copy netxml.xml to target machine
    3. On target machine virsh net-define netxml.xml && virsh net-start NETNAME & virsh net-autostart NETNAME

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.