Casbay Knowledge Base

Search our articles or browse by category below

Quick Guide On Converting VirtualBox VM to KVM in Windows 10 For KVM Virtualisation

Last updated: September 8, 2022
Estimated reading time: 1 min

In this guide, we will be going through how to convert your VirtualBox VM which uses the “.vdi” extension to KVM which uses “.qcow2”. This is a guide for people who wish to switch over to KVM virtualisation without creating a whole new virtual machine all over again.

Step 1: Open CMD and locate your VirtualBox directory.

Firstly, open your command prompt and locate your VirtualBox directory using the cd command.

cd your_directory\Oracle\VirtualBox

In my case, it’s in my D drive.

cd D:\Oracle\VirtualBox

Step 2: Clone and convert your VDI file into a raw image file.

To clone and convert the file, run the following command in your command prompt.

VboxManage clonehd “absolutepath/filename_of_existing_vdi_file.vdi” “absolutepath/filename.img” -format raw

Here is an example of my command.

VBoxManage clonehd “D:\Oracle\VirtualBox VMs\Ubuntu\Ubuntu.vdi” “D:\Oracle\VirtualBox VMs\Ubuntu\Ubuntu.img” -format raw

You will be seeing a similar output as followed in your command prompt.

Clone medium created in format ‘raw’. UUID: afdb24d-1a3c-4276-9251-bf2616f9b75e

You will be able to see an image file in the directory you had cloned into. The raw image file will be much larger in comparison with your “.vdi” file.

Step 3: Converting image file into the ".qcow2" file which is the file type for KVM.

This final step requires you to use the qemu-ing command, kindly refer to this link if you do not have the command installed, else skip this step if you already have it installed and proceed with the guide.

Run the following command for the “.img” to “.qcow2” conversion.

qemu-img convert -f raw -O qcow2 “absolutepath/filename_of_existing_img_file.img” “absolutepath/filename.qcow2”

After this, you will finally be able to find your “.qcow2” file in the directory you had chosen. You are now ready for KVM Virtualisation now.

Was this article helpful?
Dislike 6