export VM using VDI instead of VMDK

This is for discussing general topics about how to use VirtualBox.
Locked
Emile
Posts: 12
Joined: 8. Nov 2013, 23:33

export VM using VDI instead of VMDK

Post by Emile »

I would like to export my VMs. The disk images inside the .ova file should be .vdi, not .vmdk (which unfortunately is the default).

Is this somehow possible?

(This is because I can easily mount .vdi files using libguestfs on the host [Debian testing/jessie].)
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: export VM using VDI instead of VMDK

Post by mpack »

As far as I know: no, not possible.

The OVA/OVF appliance format is a standard promoted by VMWare, hence it uses the VMWare disk container format.

However - there's no requirement for you to use "export" if you are moving VMs between VirtualBox instances. You can simply copy the VM folder. See Howto: Moving a VM.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: export VM using VDI instead of VMDK

Post by michaln »

Exactly right. The OVA/OVF specifies a compressed VMDK format (it's not the same as normal VMDK files). So no, not possible.
Emile
Posts: 12
Joined: 8. Nov 2013, 23:33

Re: export VM using VDI instead of VMDK

Post by Emile »

I prefer the export feature, because then it's simpler to distribute the VMs to others. Needs less explanation.

I've read the OVF (Open Virtualization Format Specification) specification 1.1 (DSP0243_1.1.1.pdf). It doesn't enforce VMDK. Other disk image formats are allowed. It says "The previous example uses VMDK disk files, but multiple disk formats are supported." and "OVF does not require any specific disk format to be used, but to comply with this specification the disk format shall be given by a URI which identifies an unencumbered specification on how to interpret the disk format. The specification need not be machine readable, but it shall be static and unique so that the URI may be used as a key by software reading an OVF package to uniquely determine the format of the disk. The specification shall provide sufficient information so that a skilled person can properly interpret the disk format for both reading and writing of disk data. It is recommended that these URIs are resolvable."

Looks like a missing feature in Virtual Box.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: export VM using VDI instead of VMDK

Post by mpack »

That may well be the theory, but in practice if you deviate from the expected format then it won't work. Nobody outside of the VirtualBox arena is expecting to see exported appliances using VDI format, and inside the VirtualBox domain it isn't required. Still, if you are only moving between VirtualBox hosts, and you prefer VDI, and you are prepared to give Oracle a barrowload of cash, then I'm sure they'd accomodate you!
andsens
Posts: 3
Joined: 26. May 2011, 21:07
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: deb x86

Re: export VM using VDI instead of VMDK

Post by andsens »

OK, so Emile you are correct in assuming that no single virtual disk format is enforced in the OVF spec (I read it too).
I am generating my own OVFs (vagrant plugin for my debian bootstrapper https://github.com/andsens/build-debian ... ree/python) and need virtualbox to accept VDIs (or rather: I was too lazy to implement VMDK,and then I got stubborn when I couldn't get it to work).
So I dug into the VirtualBox source code.
These are the URLs for the different virtual disk formats: https://www.virtualbox.org/browser/vbox ... pl.cpp#L88 As you can see, no VDI URI. Which is something the developers note in the comments here: https://www.virtualbox.org/browser/vbox ... t.cpp#L636
And you might also notice, when scrolling down a few lines, they only support importing VMDK and RAW disk images. However, they do add the URIs to their supportedStandardsURI map in https://www.virtualbox.org/browser/vbox ... l.cpp#L609, no clue why they don't support importing them.

TL;DR I can say with 100% certainty you cannot import VDI disks into virtualbox via OVF, there is simply no URI specified for that particular disk format.
adrelanos
Posts: 22
Joined: 9. Sep 2018, 09:48

Re: export VM using VDI instead of VMDK

Post by adrelanos »

Has anything changed about this?

VirtualBox GUI nowadays supports to import as vdi which is much better than vmdk.

https://www.virtualbox.org/manual/ch01.html#ovf says
Appliances in OVF format can appear in the following variants:

They can come in several files, as one or several disk images, typically in the widely-used VMDK format. See Section 5.2, “Disk Image Files (VDI, VMDK, VHD, HDD)”. They also include a textual description file in an XML dialect with an .ovf extension. These files must then reside in the same directory for Oracle VM VirtualBox to be able to import them.

Alternatively, the above files can be packed together into a single archive file, typically with an .ova extension. Such archive files use a variant of the TAR archive format and can therefore be unpacked outside of Oracle VM VirtualBox with any utility that can unpack standard TAR files.
Does this mean we could manually create an ova file that contains vdi rather than vmkd images?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: export VM using VDI instead of VMDK

Post by mpack »

As mentioned above, the OVA appliance format assumes compressed VMDK. This is not directly usable anywhere, you have to import it, so deviating from this format would be of no benefit - and in any case VDI has no corresponding compressed variant.

VirtualBox v6 and later does however offer an "import as VDI" checkbox when importing an appliance. That means they get unpacked from compressed VMDK to uncompressed VDI on import.
adrelanos
Posts: 22
Joined: 9. Sep 2018, 09:48

Re: export VM using VDI instead of VMDK

Post by adrelanos »

feature request

export VM disk image format: vdi instead of vmdk (ova or different VM container format)

https://www.virtualbox.org/ticket/20335
Locked