Tutorial: Migrate a Linux VM from vSphere to KVM

In this guide, we will migrate a Linux VM from vSphere to KVM. For VMs with multiple disks, see the support article on Migrating a secondary Linux VM disk from vSphere to OpenStack for migrating the secondary disks, and follow the steps below for the boot disk.


  • A vSphere VM with Linux installed
  • The VM must only have one boot disk.

Note: This article assumes that if the boot disk uses LVM, the LVM volumes do not span other disks.

Step 1 – Convert VMDK to QCOW2

After powering off the VM, note the path of the boot disk by editing the settings of the VM and selecting the Virtual Disk. The boot disk will usually be the first disk listed, unless there is a bios.hddOrder value in the .vmx file for the VM.


Copy the flat VMDK from the ESX host to the Image Library, or a machine with the qemu-img command available.

Screen Shot 2016-02-01 at 3.05.22 PM

After copying, convert the VMDK to a QCOW2 image.

[bash]qemu-img convert -O qcow2 <Input VMDK file> <Ouput QCOW2 file>[/bash]

For example:

[bash]qemu-img convert -O qcow2 centos6-vm-migration-flat.vmdk centos6-vm-migration.qcow2[/bash]

Step 2 – Upload the Image to the Image Library Host

You can simply copy the converted qcow2 image to the Image library host’s image directory.

migrate_windows15 migrate_windows16


Follow our support guide on Managing Images with the OpenStack Glance Client if you are not familiar with the OpenStack Glance Client.
Then, use the glance command to upload the image.

For example:

[bash]glance image-create –disk-format qcow2 \
–container-format bare \
–file centos6-vm-migration.qcow2 \
–visibility public \
–name centos6-vm-migration \
–property pf9_description=”Linux VM migrated from vSphere” \
–property pf9_virtual_size=26422542336[/bash]

Step 3 – Create an Instance

Create an instance as you normally would and your newly migrated Linux VM should now be running in a KVM environment.

Screen Shot 2016-02-01 at 3.40.12 PM

The browser you are using is outdated. For the best experience please download or update your browser to one of the following:

State of Kubernetes FinOps Survey – Win 13 prizes including a MacBook Air.Start Now