Home VM Migration How to Convert Qcow2 to Vmdk for VMware ESXi?

How to Convert Qcow2 to Vmdk for VMware ESXi?

2023-02-04 | Nick Zhao

Table of contents
  • Why convert qcow2 to vmdk?
  • How to convert qcow2 to vmdk with qemu-img?
  • How to convert VM to VMware with Vinchin Backup & Recovery?
  • Conclusion

There are many virtualization solutions in the world and companies can select one of them or some of them to deploy virtual environment.

When managing the heterogeneous virtual environment or changing the virtualization solution, IT administrators need to know the method of VM migration between different platforms.

Why convert qcow2 to vmdk?

KVM is a popular hypervisor for server virtualization. It realizes CPU and storage virtualization by calling the core features of Linux to make Linux core become the virtualization layer. Sometimes KVM will work with QEMU emulator.

QEMU is a free and open-source emulator. It is a complete software which can independently emulate an entire computer including CPU, memory, I/O equipment, etc., ensuring the generality of virtual machines and making cross-platform migration possible by translating the binary codes of the specific processor with a special recompiler.

In QEMU-KVM environment, the popular image format is qcow2, which outperforms the first generation of qcow format and raw format. You can find the files of virtual disks by checking the information of virtual machine by virsh command:

virsh domblklist guest_name

P.S. Virsh command can be also used to create KVM VM snapshot. In case you need it, the command is virsh snapshot-create-as domain snapshot-name. You can check this post Backup KVM Virtual Machine for more virsh commands.

Because KVM is a free open-source virtualization solution, it is often chosen by companies in the beginning when there are limited budgets. After years, the applications on the servers need better compatibility. Most companies will select the excellent solution VMware vSphere, which is expensive but is the leading server virtualization in the world.

VMware supports only .vmdk format of image. If you want to use KVM image on VMware, you need V2V converter.

You can convert the format of KVM virtual disk (.qcow2) to .vmdk format or use the official tool VMware vCenter Converter Standalone to directly migrate from KVM to VMware host.

How to convert qcow2 to vmdk with qemu-img?

You can download qemu-img, a command line tool for image format conversion, to convert the KVM virtual disk format. Before converting the image, you need to add the directory to path environment variables.

Note: It will make the KVM virtual disk work on ESXi but some users reported that it can't be used to perform vMotion later.

You can directly install the package on Windows machine, but on Linux machine, there are different commands to install it:

For Ubuntu/Debian, type the command below:

apt install qemu-img

For CentOS/Red Hat/Oracle, type the command below:

yum install qemu-img

For SUSE/OpenSUSE, type the command below:

zypper install qemu-img

After that, you need to verify the installation.

On Windows machine, type the command below:

qemu-img --help

On Linux machine, type the command below:

qemu-img -v

If the version information of qemu-img is presented, the installation is successful.

The next step is converting the image, type the command below:

qemu-img convert -p -f qcow2 -O vmdk my_centos7.qcow2 my_centos7.vmdk

-p: presenting the conversion progress

-f: format of the source image

-O: format of the target image

This vmdk might not be able to be used on ESXi, but you can use it on VMware Workstation. To let it work on ESXi, you need to use vmkfstools to convert it again.

vmkfstools -i source.vmdk -d thin converted_source.vmdk

The last step is copying the .vmdk file to datastore and using it to create a new virtual machine in vCenter. When you are asked to configure the hardware, select existing hard disk to import the .vmdk file. You can also use VMware vCenter Converter Standalone to directly migrate KVM to VMware.

How to convert VM to VMware with Vinchin Backup & Recovery?

Vinchin Backup & Recovery is a professional VM backup and disaster recovery solution which will also help you easily perform KVM to VMware migration. It supports VMware vSphere and some KVM-based solution like Red Hat Virtualization, oVirt, Oracle Linux KVM, OpenStack, etc. (Native KVM is not supported for now)

Vinchin Backup & Recovery

Vinchin Virtual Machine Convert Engine is designed for V2V migration. It will smartly convert the virtual machine including the virtual disk to make it work on another platform.

You don't have to type complicated commands for different operating systems. In Vinchin Backup & Recovery, you just need to complete the process with migration wizard on a user-friendly console.

Vinchin Backup & Recovery allows you to add multiple virtualization platforms into backup server at the same time so you can also use it as an all-in-on backup solution for multi-hypervisor environment.

Want to use it in your virtual environment? You can deploy it immediately with a 60-day full-featured free trial. Just click the button to download it.

Conclusion

There are many kinds of virtualization solutions in the world. Because of different technologies, virtual machines have virtual disks of different formats. For IT administrators, it is necessary to know the formats and the ways to convert formats. In this post, the methods of converting qcow2 to vmdk have been introduced. IT administrators can use them to migrate from KVM to VMware.

Vinchin Backup & Recovery will let you manage multiple kinds of virtualization platforms and easily migrate from different kinds of KVM platforms to VMware vSphere. Don't miss the free trial.

Share on:

Categories: VM Migration