Here's something I discovered while doing some exports and imports with Virtualbox appliances. I thought it would be useful for others to know.

Let's say that we have a virtual machine with a disk image in Virtualbox's native disk image format, VDI

Now, if we export that disk image as an appliance in the OVA/OVF format, this new disk image in the OVA/OVF package will be a VMWare disk image file (VMDK). Why? I guess, beause at the time of the creation of that standard, VMWare was probably the dominant player in the VM field.

So, if we would now import the previously exported appliance, we would like the resulting new vitual machine to again have a VDI disk image. Unfortunately for us, the imported virtual machine has now a vmdk disk image file, instead. OK, but why is that important, you ask. Why do we want the disk image to be in the VDI format?
For one, I prefer to the disk image format to be native to the virtualization software in order to avoid any hickups. But the main reason for me, is that Virtualbox cannot do some things like resizing or shrinking on VMDK disk images, to date. Today, if you want to resize or shrink a VMDK image, you need to first clone it into a VDI image, then do whatever you want to do with it, and if you really want to stick with VMDK, clone the processed file back into the VMDK format. Not to forget the other steps like releasing and attaching the disk images to a VM. Better to stick with the native format in the first place, right?

The solution is quick and easy though:

While importing the appliance, just rename the extension of the resulting image file from .vmdk to .vdi (see screenshot below). The importer will then write the imported disk image in the VDI format.

virtualbox import expert mode vdi

I have confirmed this to work with the current version of Virtualbox, 5.1.26. The functionality though, seems to have been implemented with version 4.0.0 back in 2010 (changelog), though.

Reading the first few hundred bytes of the disk image with `less` or some equivalent tool, like so `less your_disk_image.vdi` should show something like this:

<<< Oracle VM VirtualBox Disk Image >>>


...while doing the same with an vmdk image would show something like this:

^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@# Disk DescriptorFile

# Extent description
RW 83886080 SPARSE "kubuntu test-disk001.vmdk"

# The disk Data Base 

ddb.virtualHWVersion = "4"



Published: Sunday, 10 September 2017 13:39