Home VM Migration How to Convert Vhd/Vhdx to Qcow2 to Migrate Hyper-V to KVM?

How to Convert Vhd/Vhdx to Qcow2 to Migrate Hyper-V to KVM?

2023-02-25 | Nick Zhao

Table of contents
  • Vhd/vhdx and qcow2
  • Convert vhd/vhdx to qcow2
  • Easily migrate VM with Vinchin Backup & Recovery
  • Sum Up
Are you looking for an easy VM migration solution? Try Vinchin Backup & Recovery!↘ Download Free Trial

Virtualization technology can improve the work efficiency of IT environment and more and more companies start to research multiple hypervisors to find the most proper virtualization solutions for different applications.

When a new hypervisor is selected as the alternative or complement to the existing hypervisor, it is necessary for IT administrators to learn VM migration procedures between different hypervisors because this is the fast way to make old applications work on the new hypervisor.

Vhd/vhdx and qcow2

Virtual machine can work like the real machine but actually it exists as a folder on the host and this folder contains everything about the VM including configuration, applications, snapshots, and other data. When IT administrators move a VM from one hypervisor to another, the virtual disk is the most important thing. VMware will allow users to export full OVA template for data backup and later migration, you can also export OVA equivalent for Hyper-V VM.

Virtual disk is like the hard drive of physical machine. It is a file in the folder of VM and is saved in a different format in the different virtual environment. IT administrator often use virtual disk manager to manage virtual disk.

In Hyper-V environment, virtual disk is often saved as vhd or vhdx file. Vhd is the former format for Hyper-V virtual disk and vhds becomes its successor of it. Vhdx is has better performance than vhd. For example, the maximum capacity of vhd virtual disk is 2040GB but the maximum capacity of vhdx virtual disk is 64TB.

If you know the directory of Hyper-V VM folder, you can directly find and copy the vhdx virtual disk from the datastore. If you don't know the directory, you can still export the Hyper-V VM folder and then extract the vhdx virtual disk from it.

KVM is a hypervisor used in multiple open-source virtualization and qcow2 is the most common virtual disk format for KVM virtual machine.

Both hypervisors have their advantages so you can add or change virtualization solution according to your needs. The next section will show you how to convert the virtual disk to move VM from Hyper-V to KVM.

Convert vhd/vhdx to qcow2

Because different virtual environments require different virtual disk formats, you need to convert the virtual disk format before importing the virtual disk to new environment. For example, if you would like to convert Hyper-V virtual disk to KVM virtual disk, you need the V2V converter, qemu-img.

You need to install this tool on Windows or Linux machine and add its directory to environment variables. After that, use the command below to convert the Hyper-V virtual disk:

qemu-img convert -p -f vhdx -O qcow2 /hyper_v_virtual_disk_directory.vhdx /hyper_v_virtual_disk_directory.qcow2

If you would like to convert vhd virtual disk, replace vhdx with vpc.

-p: presenting the conversion progress

-f: format of the source image

-O: format of the target image

After that, you can import the qcow2 virtual disk to create new VM in KVM environment.

Easily migrate VM with Vinchin Backup & Recovery

Traditional migration methods, such as VM conversion, can be tedious and fraught with compatibility issues. Thus, a professional migration solution for virtual environments is advisable.

Vinchin Backup & Recovery is not only a backup solution for virtual machine, but also an advanced VM migration solution, supporting VMware vSphere, Hyper-V, Proxmox, XenServer, XCP-ng, oVirt, OLVM, RHV, OpenStack, etc. (Native KVM is not supported for now) By adding both virtualized platforms into the backup system, you can perform easy agentless VM migration with a user-friendly web console.

There is the built-in conversion engine in the backup system, you just need to select the VM you need to move it to another virtualized platform.

For instance, if you would like to migrate VM from Hyper-V to OpenStack:

1. Just select the backup of the target Hyper-V VM

Select Hyper-V VM

2. Select an OpenStack host as target host

Select OpenStack Host

3. Simply set up restore strategies or directly skip this step

Select Backup Strategies

4. Just submit the job and then the Hyper-V VM will be quickly restored on the OpenStack host

Submit the Job

Vinchin Backup & Recovery has been selected by thousands of companies and you can also start a 60-day full-featured free trial here. Also, contact us, leave your requirements, and then you will receive your tailored solution. We have established partnerships with reputable companies all over the world so if you would like to do a local business, you can select a local partner here.

Download Free TrialFor Multi Hypervisors ↖        
* Free Secure Download

Sum Up

Different virtualization solutions have their advantages so you can select one or more of them to deploy virtual environment. Vhdx file and qcow2 file are the virtual disks of VMs in Hyper-V and KVM environment. To use vhdx virtual disk in KVM environment, you need to use qemu-img to convert vhdx to qcow2 before importing virtual disk.

If you need an easy solution to migrate Hyper-V VM to KVM-based virtualized platform, you can select Vinchin Backup & Recovery. Don't miss the free trial.

Share on:

Categories: VM Migration