Via Cà Matta 2 - Peschiera Borromeo (MI)
+39 02 00704272
info@synaptica.info

KVM -HowTo move or copy a VM from Host to onther Host

Digital solution partner

KVM -HowTo move or copy a VM from Host to onther Host

To transfer a KVM virtual machine (VM) from one host to another, you can follow the steps below:

  1. Make sure you have the same version of KVM on both hosts. You can verify this by running the kvm –version command.
  2. Stop the VM you want to transfer. You can do this using the command virsh shutdown vm_name.
  3. Export the VM definition XML to the old host using the command virsh dumpxml vm_name > file_name.xml.
  4. Check where the VM files are stored. You can do this using the command virsh domblklist vm_name.
  5. Copy the VM files from the old host to the new host, including the xml definition file. You can use the scp command to do this.
  6. Check the contents of the VM xml definition file to correct the physical path of where the disk files are physically and correct the network
  7. adapter names if necessary.
  8. Import the VM to the new host using the command virsh define /path/to/vm_xml_file.
  9. Start the VM on the new host using the virsh start vm_name command.

Make sure you have properly configured networking and storage on the new host so that the VM can work properly. Also, if you’ve been using pass-through virtualization for your devices, make sure you’re configuring those on the new host correctly as well.

A lot of useful information on how to manage KVM virtualization systems can also be found on the blog: https://frontpagelinux.com/tutorials/getting-started-with-kvm-hypervisor-virtual-machines-the-right-way/