Migrate a VirtualBox OVA to ESXi

17. Oct 2017

Migrate a VirtualBox OVA to ESXi

I had to migrate an OVA exported by VirtualBox to an ESXi 6.

TL;DR:

Untar the OVA, copy the vmdk file to ESXi, migrate the vmdk with vmkfstools and create a new VM using the new vmdk file for the HDD.

You got time to read it all

An OVA file is a tarball of the VMs vmdk and the OVF file containing all the settings in XML format.

My first naive attempt by importing the OVA using the vSphere fat client failed due to problems with the XML. As it turned out that OVA was exported as OVF version 2.0 which ESX cannot use. My next attempt was to import the OVA into VirtualBox and export it as OVF version 1.0.

Here I ran into smaller problems that seemed to be possible to solve. According to some blog entries I found I would only have to change some settings in the XML so ESXi would be able to import the VM. Little did I know that this would turn out to be a dead end as well, or I may have given up too quickly.

In the end I uploaded the vmdk via SCP to the ESXi server.

By then I wanted just to replace one VM so the plan was to just switch the vmdk files for the VM by removing and adding a new HDD with the freshly uploaded file.

Well, attaching it as IDE HDD caused kernel panics on bootup and attaching it as SATA caused an error of not being able to attach the SATA disk. This VMware KB Entry helped me further.

First load the module multiextend:

# vmkload_mod multiextent

Then run vmkfstool to convert the vmdk file. If you already tried to attach and run it, it will probably have -s00x.vmdk at the end of the filename:

# vmkfstools -i path-to-OLD.vmdk path-to-NEW.vmdk -d thin

Depending on what you want to also might want to use zeroedthick instead of thin.

Once we are done let’s unload the multiextent module:

# vmkload_mod -u multiextent

Now attaching the new disk file and booting it up worked.

Got any hints or questions? blog@aaronlauterer.com