Moving KVM Virtual Machines (VM) to a new host

  1. Knowledge Base
  2. Systems Administration
  3. Moving KVM Virtual Machines (VM) to a new host

Turn off the desired VM:

virsh shutdown {domain-id, domain-name or domain-uuid}

Copy the virtual machine’s disk to the new host server:

rsync -rvahP /source/path/virtual_disk_name.qcow2 username@new_hostname:/destination/path/virtual_disk_name.qcow2

When prompted, enter credentials.

Copy the virtual machine’s QEMU configuration information from /etc/libvirt/qemu on the current server to the new server:

rsync -rvahP /etc/libvirt/qemu/virtual_server_name.xml username@new_hostname:/home/username/virtual_server_name.xml

Load the XML configuration file on the new server by running the command:

virsh define /home/username/virtual_server_name.xml

It is likely that the new server has a different Network source for the bridge network configuration. Be sure to open virt-manager, navigate to the desired VM and change the networking > network source to the correct interface.

Start the VM.

Leave a Reply

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