Gregg's MOTD

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

KVM: Importing an OVA appliance

September 09, 2023 — Gregg Szumowski

You may or may not be aware if it, but an OVA file is just a tar archive containing an .ovf and a .vmdk files, respectively the VM configuration and disk.

$ ls *.ova
HTAOE.ova
$ tar tf HTAOE.ova
HTAOE.ovf
HTAOE-disk001.vmdk
HTAOE.mf

So, you can simply extract the files:

$ tar xvf HTAOE.ova

And convert to a format appropriate for QEMU/KVM:

List the available formats

$ qemu-img -h | tail -n4
Supported formats: blkdebug blklogwrites blkverify bochs cloop compress copy-before-write copy-on-read dmg file ftp ftps host_cdrom host_device http https luks nbd null-aio null-co nvme parallels preallocate qcow qcow2 qed quorum raw replication ssh throttle vdi vhdx vmdk vpc vvfat

See <https://qemu.org/contribute/report-a-bug> for how to report bugs.
More information on the QEMU project at <https://qemu.org>.

Do the actual conversion (I chose qcow2 here)

$ qemu-img convert -O qcow2 HTAOE.vmdk HTAOE.qcow2

Have a look at the .ovf too, for information on expected machine configuration, resources (eg. memory and cpu), etc.

After the conversion, simply create a new VM and make it use the newly created disk as the primary disk.

Tags: cli, kvm, ova, virtualization, qemu, motd

Export VirtualBox VDI using CLI

June 14, 2023 — Gregg Szumowski

Sometimes you may want to move a virtual machine in VirtualBox from one server to another. Once way of doing that is to export it from the command line.

  1. Locate the virtual machine that you want to export (I’ll use the name UbuntuServer for the one to be exported and name the new one UbuntuServerNew), and then
  2. Run the export command as follows:

$ vboxmanage export UbuntuServer -o UbuntuServerNew.ova

Tags: cli, virtualization, virtualbox, motd

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