February 2, 2020

Technical Memo: Convert an ova image to qcow2 format

From Wikipedia of Open Virtualization Format, I learnt that an the ova file is just a tar file of ovf directory. So I went open a Windows 10 Developer Evaluation ova file to see what exist inside it.

$ tar -tf WinDev2001Eval.ova

WinDev2001Eval.ovf
WinDev2001Eval-disk001.vmdk
WinDev2001Eval.mf


So inside the ova file includes
  • A virtual machine specification definition .ovf file
  • A hash checksum .mf file
  • A disk image in .vmdk image
As qemu-img supports vmdk as disk image file, we actually could convert vmdk file to any other format that we like.

1. Convert .vmdk to .img

$ qemu-img convert -O raw WinDev2001Eval-disk001.vmdk WinDev2001Eval.img


2. Convert .vmdk to .qcow2 
 
$ qemu-img convert -O qcow2 WinDev2001Eval-disk001.vmdk WinDev2001Eval.qcow2


All supported formats can be confirmed by qemu-img -h

The converted qcow2 image could be used to create a new virtual machine using virt-manager.

I used to think that .ova file is the file format of Virtual Box (There are also many articles on the internet instruct you to install Virtual Box on Linux to open .ova file!). Actually, by simple conversion, we can run .ova packaging image on default simple performant Linux KVM. The OVF was originated from 2007 and it has been more than a decade from its creation, yet I am still amazed at how little I know about it.