Jan 22
2021
KVM – Migrate VM to another host
- copy the VM’s disks from
/var/lib/libvirt/images
on src host to the same dir on destination host - on the source host run
virsh dumpxml VMNAME > domxml.xml
and copy this xml to the destination host - on the destination host run
virsh define domxml.xml
- 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
- On source machine
virsh net-dumpxml NETNAME > netxml.xml
- copy netxml.xml to target machine
- On target machine
virsh net-define netxml.xml && virsh net-start NETNAME & virsh net-autostart NETNAME
- On source machine