Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

How to convert VirtualBox VDI to KVM qcow2

May 10, 2023 — Gregg Szumowski

It is easy to convert a VirtualBox VDI image to a KVM qcow2 file. You have to use the RAW file format as an intermediate.

Make sure the VirtualBox machine is shutdown.

  1. Convert the VDI to a raw disk image.
    Note: VDIs are compressed and raw images are not, so you will need to leave enough disk space for entire uncompressed disk.

    $ VBoxManage clonehd --format RAW vm.vdi vm.img

  2. Then on your KVM host:
    $ qemu-img convert -f raw vm.img -O qcow2 vm.qcow2

Tags: virtualization, virtualbox, kvm, qcow2, motd