How to Convert Qcow2 to OVA for VMware?

Both VMware and KVM are popular virtualization solutions. When you are using both platforms in IT environment, it is necessary to know the method of data migration between different platforms. In this post, you will know the way to convert qcow2 to OVA to migrate from KVM to VMware.

download-icon
Free Download
for VM, OS, DB, File, NAS, etc.
nick-zhao

Updated by Nick Zhao on 2024/11/07

Table of contents
  • Why convert qcow2 to ova?

  • How to convert qcow2 to ova?

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

  • Qcow2 to OVA FAQs

  • Sum Up

Managing heterogeneous virtual environment requires IT administrators to know more knowledge about different platforms.

In KVM and VMware environment, sometimes virtual machines need to be moved to the other platform. Moving VM means moving data, so how about migrating the virtual hard disk?

Why convert qcow2 to ova?

Qcow2 is the virtual hard disk format of KVM virtual machine. Virtual hard disk is just a file in the virtual machine folder so it has a file format. Qcow2 is not the only format for virtual hard disk in KVM environment. It is the mainstream format but virtual hard disk can be also saved as .qcow (the first generation) or .raw file. You can check the virtual hard disk format and the directory with the following command:

virsh domblklist guest_name

OVA file is often compared with OVF file. Both of them are VM templates which contains not only the virtual disk, but also other data like snapshots and metadata. In VMware environment, the format of virtual hard disk is vmdk.

Compared with virtual hard disk, OVA template contains the entire folder of virtual machine. It will help quickly create a new virtual machine, skipping configuring virtual machine and installing operating system and applications. You can use OVF Tool to export OVA template from VMware.

Qcow2 virtual hard disk can't be imported to VMware without conversion while OVA template does so you might want to convert qcow2 virtual hard disk to OVA template. Well, there is no proper converter which can directly complete the job. The alternative solution is converting qcow2 virtual hard disk to vmdk virtual hard disk, using vmdk file to create a new virtual machine on ESXi, and then exporting OVA template with OVF Tool.

If you just want to import the data of qcow2 virtual hard disk to VMware, you don’t have to export OVA template. If you need a template for later use like virtual machine clone, it is necessary to have a OVA template.

How to convert qcow2 to ova?

Because there is no converter for one-step conversion, it is needed to complete the conversion in 3 steps. Also, if you want to skip converting virtual hard disk, there is a way to directly migrate VM from KVM to VMware.

Preparation:

● The qcow virtual hard disk

●  Qmu-img

● Vmkfstools

● VMware vCenter

● OVF Tool

Step 1. Convert qcow to vmdk

The package of qemu-img can be directly installed on Windows computer, but on Linux computer, you need to install it with different commands:

For Ubuntu/Debian: 

apt install qemu-img

For CentOS/Red Hat/Oracle: 

yum install qemu-img

For SUSE/OpenSUSE:

zypper install qemu-img

After that, verify the installation.

On Windows machine:

qemu-img --help

On Linux machine:

qemu-img -v

Type the command below to convert the qcow2 file:

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

Use vmkfstools to make it adaptable for ESXi:

vmkfstools -i guest_machine.vmdk -d thin esxi_guest_machine.vmdk

Step 2. Import vmdk to ESXi

Vmdk is often stored on shared store so copy the converted vmdk file to the datastore of VMware and then use it to create an ESXi VM.

Log into vCenter > right-click a ESXi host > select New Virtual Machine

The New Virtual Machine Wizard will appear. Configure the new virtual machine step by step. When you are asked to configure the hardware, select existing hard disk. Use the converted vmdk file to create virtual machine.

Here, you have successfully imported data from qcow to VMware environment. If you still need OVA template, do step 3.

Step 3. Export OVA template

You need to open OVF Tool with command and then type the command below to export OVA.

ovftool -o 
--powerOffSource 
  --acceptAllEulas 
  --machineOutput 
  --X:logLevel=verbose 
  --X:logFile=log.log  
  --noSSLVerify  
"vi://username:password@vcenter/datecenter /vm/vmName" /root/vmName.ova

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

Converting virtual hard disks is tedious. You can have better solution for VM migration.

Vinchin Backup & Recovery is a professional backup & disaster recovery solution, which supports multiple virtualization platforms like VMware vSphere, Proxmox, Oracle Linux KVM, OpenStack, oVirt, Red Hat Virtualization. (Native KVM is not supported for now)

You can add different platforms into Vinchin backup system to make agentless backup. Vinchin Virtual Machine Convert Engine will help you easily move VM from one platform to another. Every recovery point can be a VM template. You just need to select a target platform to restore it.

For example, when you migrate VM from Proxmox to VMware, you just need to restore a Proxmox VM backup on an ESXi host:

1. Select the backup of Proxmox VM

Select Proxmox VM

2. Select an ESXi host as destination

Select target ESXi host

3. Select strategies

Select strategies

4. Submit the job

Submit the job

Later, you can start the converted VM in vCenter.

Vinchin Backup & Recovery has served thousands of companies. You can also deploy this system in your virtual environment.

Qcow2 to OVA FAQs

1. Can you directly convert Qcow2 virtual disk to OVA template?

Usually, you can’t directly create an OVA template from a Qcow2 virtual disk. If you are using oVirt, you can directly export OVA from the entire virtual machine.

2. Can you bulk convert Qcow2 image to OVA?

Because you can directly create an OVA template from Qcow2 virtual disk, it will be hard to bulk convert Qcow2 image to OVA unless you can write a script to run the whole steps mentioned in this post.

3. What is the difference between OVA and OVF?

OVA (Open Virtual Appliance) and OVF (Open Virtualization Format) contain nearly the same data, virtual disks and configuration information. However, OVA is a zipped file while OVF is a folder. They are accepted by virtualization platforms in different scenarios.

Sum Up

KVM and VMware virtual machines have virtual hard disks of different formats. When it is needed to migrate data from one platform to another, IT administrators need to change the file format. In this post, the method to convert qcow2 to OVA is introduced.

To skip sophisticated conversion procedures, you can choose Vinchin Backup & Recovery to manage and migrate VM for multiple virtualization platforms. Don’t miss the free trial.

Share on:

Categories: VM Migration