How to convert virtual box disk to KVM qcow



We will explain two way to do this migration to KVM. the first one is using windows virtual box command and the second one we will use Linux.

Convert disk using virtual box VBoxManage

  • Step 1: Shutdown the virtual machine.
  • Step 2: Convert the disk to raw disk images:
VBoxManage clonehd --format RAW vm.vdi vm.img

Note: this image could be used in real disk.

  • Step 3: Convert to qcow2 format

qcow2 is the format required for use with KVM, to conver to this format use the command:

qemu-img convert -f raw vm.img -O qcow2 vm.qcow2

Note: here we can convert real disk image to qcow2 and virtualize it.

Convert disk directly using qemu-img

we can specify qemu-img command that the input disk is vdi format and convert it to qcow with this command:

qemu-img convert -f vdi -O qcow2 disk.vdi converted_disk.qcow2