Convert Virtualbox VDI to Qemu

VirtualBox.png

In order to do this, you’ll need the vditool tool contained in the virtualbox-ose package available from the Debian repositories. Here’s how I got it working:

  1. vditool COPYDD vbox-image.vdi raw-image.img
  2. qemu-img convert -f raw raw-image.img -O qcow2 qemu-image.qcow

The first step copies the contents of the image (*.vdi is the VirtualBox filesystem image extension) to a raw disk image. Be advised: this file will be the full size of the virtual hard drive. That means that, unlike *.vdi and *.qcow formats, if the virtual disk has a maximum capacity of 8Gb, the raw image will be 8Gb in size regardless of how full the disk is.

Once you have the raw image, run the second step which uses the QEMU disk image manipulation tool, qemu-img, to convert the raw image into the QCOW2 format. The new QEMU image will be much smaller than the raw image was and it can be made smaller by passing qemu-img the -c option to enable transparent compression. However, seeing as how this just uses zlib on each cluster, this might introduce more overhead to I/O than is desired and will most likely degrade your overall VM performance.

Related Posts

Comments are closed.