Converting OVA for use with KVM / QCOW2

The OVA file is nothing more than a TAR archive, containing the .OVF and .VMDK files. Easy!

Using Evergreen ILS for example:

~ $ file Evergreen_trunk_Squeeze.ova

Evergreen_trunk_Squeeze.ova: POSIX tar archive (GNU). I’ts possible to use the tar command to list the contents

~ $ tar -tf Evergreen_trunk_Squeeze.ova 
Evergreen_trunk_Squeeze.ovf
Evergreen_trunk_Squeeze-disk1.vmdk

Simply extract those things…

~ $ tar -xvf Evergreen_trunk_Squeeze.ova
Evergreen_trunk_Squeeze.ovf
Evergreen_trunk_Squeeze-disk1.vmdk

Now take a look at the created files The OVF XML file describes the image, it makes for some interesting reading about the expectations of the running environment.

~ $ file Evergreen_trunk_Squeeze*
Evergreen_trunk_Squeeze-disk1.vmdk: VMware4 disk image
Evergreen_trunk_Squeeze.ova: POSIX tar archive (GNU)
Evergreen_trunk_Squeeze.ovf: XML document text

Recent versions of qemu are able to run directly from the VMDK file, buy why do that? Use QCOW2, it’s better. Execute: qemu-img -h and the last line of output shows the supported formats.

~ $ qemu-img -h |tail -n1

Supported formats: raw cow qcow vdi vmdk cloop dmg bochs vpc vvfat qcow2 parallels nbd blkdebug sheepdog host_cdrom host_floppy host_device file. Now actually convert it, this may take some time.

~ $ qemu-img convert -O qcow2 Evergreen_trunk_Squeeze-disk1.vmdk Evergreen_trunk_Squeeze.qcow2

Contents of OVF Files
The OVA is intended to run an Appliance and this OVF file describes the appliance. Examine the contents of this file to determine information about the expected CPU, Memory and other appliance details. These will be important to getting the image to run under KVM. Noteably, Windows has a terrible time moving, ensure you have the MergeIDE fix in place.

Convert IMG (raw) to QCOW2

qemu-img convert -f raw -O qcow2 /path/to/your/hdd/vm01.img /path/to/your/hdd/vm01.qcow2

So, let us say we want to convert a raw HDD which is located in /var/lib/libvirt/images (standard path for new KVM machines) to a QCOW2 HDD:

qemu-img convert -f raw -O qcow2 /var/lib/libvirt/images/machine01.img /var/lib/libvirt/images/machine01.qcow2
Share

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.