Latest versions of VirtualBox supports several formats for virtual disks, but they forgot to provide a comparison between them.

  • VDI
  • VMDK
  • VHD
  • HDD

Now, I am interested about a recommendation or comparison that considers the following:

  • be able to use dynamic sizing
  • be able to have snapshots
  • be able to move my virtual machine to another OS or even another free virtualization solution with minimal effort (probably something that would run fine on Ubuntu).
  • performance
  • 9
    Run Virtual box and click the help icon > Contents, there is a fair explanation in there under "Virtual Storage" – Moab Nov 23 '11 at 1:03
  • 1
    Regarding migration to "another free virtualization solution... that would run fine on Ubuntu", I'm pretty sure VirtualBox is available for Linux. – Iszi Nov 23 '11 at 4:29
  • Performance wise, I think the best is to create fixed disks if you have the space. Otherwise it is very stressful on the OS when using the virtual machine instead of once at creation time. – Alexis Wilke Oct 29 '14 at 0:49
  • 2
    Another thing to consider is resizing the image when you may need to - VBoxManage cannot resize VMDK's, so you'd have to clone to VDI first, then resize, then back to VMDK + fudge up the UUID. For this reason alone, VDI seems the better choice for me. – Mike Demenok May 11 '15 at 20:18

11 Answers 11

VirtualBox has full support for VDI, VMDK, and VHD and support for Parallels Version 2 (HDD) (not newer versions).

Answering Your Considerations

  • be able to use dynamic sizing

VDI, VMDK, and VHD all support dynamically allocated sizing. VMDK has an additional capability of splitting the storage file into files less than 2 GB each, which is useful if your file system has a small file size limit.

  • be able to have snapshots

All four formats support snapshots on VirtualBox.

  • be able to move my virtual machine to another OS or even another free virtualization solution with minimal effort (probably something that would run fine on Ubuntu).

VDI is the native format of VirtualBox. I didn't search for any other software that supports this format.

VMDK is developed by and for VMWare, but Sun xVM, QEMU, VirtualBox, SUSE Studio, and .NET DiscUtils also support it. (This format might be the most apt for you because you want virtualization software that would run fine on Ubuntu.)

VHD is the native format of Microsoft Virtual PC. This is a format that is popular with Microsoft products.

I don't know anything about HDD. Judging from looking at this site, Parallels is a Mac OS X product and probably isn't suitable for you, especially considering that VirtualBox only supports an old version of the HDD format.

  • performance

The format should not affect performance, or at least, performance impacts are negligible.

The factors that influence performance are:

  • your physical device limitations (much more noticeable on a hard disk drive than a solid-state drive... Why?)
  • expanding a dynamically allocated virtual disk drive (write operations are slower as the virtual disk expands, but once it's large enough, expanding should happen less)
  • virtualization technology (hardware vs. software; hardware virtualization helps VirtualBox and improves the speed of virtual operating systems)
  • the fact that you are running a virtual operating system. Performance is always slower than running an operating system on the host because of the virtualization process.
  • 14
    +1 I'll add that VMDK seems to offer the panacea I've been searching for in terms of incremental backups: I no longer have to back up an enormous, monolithinc VDI for a single bit change in the guest. – msanford Aug 14 '13 at 1:10
  • I think there is some missing consideration about raw host hard disk, that is the virtual guest using a "physical" hard disk (or RAID device) as seen from the host. This would allow for better performances than using a simulated drive over a filesystem. – Enzo Jun 3 '16 at 15:17
  • 1
    @Enzo: I use VMDK on a raw block device now. The big catch is that VirtualBox needs to run as root. Also, snapshots aren't supported on raw disks, but I have a third-party snapshotting system (ZFS). VMDK on a raw disk is also a lot less portable. As for performance, I don't have any solid benchmarks, but I don't have complaints either. – Deltik Jun 3 '16 at 15:59
  • 6
    VHD can be mounted as a drive in Windows Disk Management, which does not seem as straightforward with VDI: superuser.com/q/342334/13889 – endolith Sep 27 '16 at 16:57
  • 4
    @msanford could you elaborate on how VMDK avoids backing up the enormous file - does rsync better able to figure out the differences? the VMDK file also seems change on every tweak. – Ben Creasy Jun 18 '17 at 18:46

I always use VDI, as it is the native format of VirtualBox; however, using a VMDK (VMWare format) will increase compatibility with other virtual machine software.

VirtualBox will run fine on Ubuntu, so if the goal is Windows/Ubuntu interoperability, VDI would be a perfectly valid choice.

Both formats will fulfill your requirements.

As for the other two, VHD is a Microsoft-developed format, and HDD is an Apple-developed format; these are both proprietarily-licensed, so limit cross-platform support; I wouldn't recommend them.

Mpack, explains a key performance difference between VHD and VDI here:

Having recently studied the VHD format, I would expect there to be at least a small difference in VDIs favor, most noticeable when you are comparing like with like, i.e. an optimized VDI vs optimized VHD. The reason is that the dynamic VHD format has these "bitmap" sectors scattered throughout the disk. Every time you modify a sector inside a block these bitmap blocks may need to be updated and written too, involving extra seeks, reads and writes. These bitmap sectors also have to be skipped over when reading consecutive clusters from a drive image - more seeks. The VDI format doesn't have these overheads, especially if the VDI has been optimized (blocks on the virtual disk sorted into LBA order).

All of my comments apply to the dynamic VHD format vs dynamic VDI. Performance tests on fixed sized virtual disks is pointless since both formats are then the same (just a plain image of a disk), they just have different headers on them.

https://forums.virtualbox.org/viewtopic.php?f=1&t=22688

I don't know if using vmdk would enable you to transparently run a virtual machine created in VirtualBox in VMware or not. It might. However a more universal option might be to use the VirtualBox File/Export function to create an "Open Virtualization Appliance" .ova file that can then be imported into VMware. With that approach, you can port to any virtualization system that supports .ova without caring what disk image format you use in VirtualBox.

If you need to export from the same VM at regular intervals, e.g. every day, that could be a pain. But if you only move to a different technology occasionally, it should be fine.

If you have a .vdi file already, You can test whether this works without having to create a new virtual machine. Export it to a .ova, then try importing with vmware.

Disk image files reside on the host system and are seen by the guest systems as hard disks of a certain geometry. When a guest operating system reads from or writes to a hard disk, VirtualBox redirects the request to the image file.

Like a physical disk, a virtual disk has a size (capacity), which must be specified when the image file is created. As opposed to a physical disk however, VirtualBox allows you to expand an image file after creation, even if it has data already; VirtualBox supports four variants of disk image files:

VDI: Normally, VirtualBox uses its own container format for guest hard disks -- Virtual Disk Image (VDI) files. In particular, this format will be used when you create a new virtual machine with a new disk.

VMDK:VirtualBox also fully supports the popular and open VMDK container format that is used by many other virtualization products, in particular, by VMware.[25]

VHD:VirtualBox also fully supports the VHD format used by Microsoft.

Image files of Parallels version 2 (HDD format) are also supported.[26] For lack of documentation of the format, newer formats (3 and 4) are not supported. You can however convert such image files to version 2 format using tools provided by Parallels.

  • This answer come's from Chapter 5 of the VirtualBox manual. link – JerryOL Apr 3 at 22:08

A good reason for me for using vmdk is that Virtualbox (at least until v4.1) using VDI format has the tendency, over time, to fill the complete allocated disk space, even though the internal virtual disk usage is still much less. With Virtualbox using vmdk disks, this seems less of a problem.

But I'm talking years uptime. This might not be a problem many people encounter.

  • 2
    It's more related to the fragmentation of the guest file system than to the format itself. – Enzo Jun 3 '16 at 15:19

It depends on how you plan to use virtual disk as well. Not every VM wants a single partition on a single disk.

VDI seems to have more options (when used with VirtualBox), but as soon as you take VirtualBox out of the picture, support for VDI becomes somewhat shaky (as of late 2014).

For instance my solutions need to have maximum cross-platform support. Mounting a VDI (such as a loopback device) on linux or Windows 7 is harder and buggier than you might expect. Almost like the VDI has too many features, making it difficult to make fully conforming utilities that can operate on it.

VMDK is just less painless IMHO when you want it to work with any VM on any workstation, when you want to clone it 3 times to other systems on the network at the same time, and when you want to pry it open without launching a VM instance.

Even though I use VirtualBox 90% of the time, those few times when my disks become unaccessable in certain workflows have led me to favor VMDK for pluggable/shared filesystems.

Looks like using VDI makes possible to trim disk file to its actual size VirtualBox and SSD's TRIM command support

  • While accurate it's a bit lackluster for a question that asks about the general differences between those formats, don't you think? – Seth Nov 21 '16 at 11:02
  • 3
    @Seth General overview was provided by previous answers and I don't have enough rep to just comment, but it still important to mention this fact – OwnageIsMagic Nov 21 '16 at 13:32
  • 1
    Just as a suggestion though add it to give it more context. E.g. "While this answer provides a good overview, you should also consider the advantage of ...". So even if read alone your answer has a relation to a more general one. – Seth Nov 22 '16 at 7:06
  • @Seth there is edit button under my question for you :D – OwnageIsMagic Nov 23 '16 at 1:16
  • Its a suggestion for you on how to improve the post. It's your decision whenever you want to do it as it is just my opinion. More or less rewriting a in an edit is rather bad style - again just my opinion. ;) – Seth Nov 23 '16 at 6:17

VDI is much easier to compact if the VM grows too large.

A long time ago i did one test, convert dynamic vdi into dynamic vhd just to test speed and file sizes.

Remember it was an inmutable Windows guest clean os install with some apps, remember for my test i convert one format to another, so both are suposed to have the exactr same image, like doing a cloning.

For a disk size of 64GiB, the VDI file size was arround 18GiB, while the file size of VHD arround 22GiB.

I can remember i saw theese two things:

  1. Boot time was significally different, if i do not remember bad vhd was 1.6 times faster than VDI
  2. VHD size was much bigger than VDI, arround 4GiB gigabytes bigger over a 18GiB, so 1.2 times bigger.

That was long time ago and test was done on an HDD, but i ensure both files where defragmented and next to each other on the fast part of the disk.

Hope someone can do real SSD tests, but my feeling is that VHD is faster (and bigger) than VDI.

Just a tip: VHD/VHDX can be compacted diretly on any Windows 7 and Up by using DiskPart command line tool, for VDI there is needed an external tool CloneVDI.

Sorry i did not test VMDK, i did not know how to compact it without changing its UUID (the disk UUID), remember VBOX command tools allways change it on every clone, no matter what format you use.

I just migrated a raw VMDK, which was mapped to a partition of a Transcend SSD370 128 GB to a Samsung Pro 850 512GB.

Apparently VMDK is a lot faster than VDI. I don't understand why, maybe I made a mistake somewhere.

I copied the VMDK via the Virtual Media Manager onto the 850. One time as a VDI, one time as a VMDK.

Then I ran hdparm -tT --direct /dev/sda on the images. For each of the "runs" I switched replaced the "Machine -> Settings -> Storage -> Controller SATA -> ImageFile.xxx". The raw partition on SSD370 was defined by a VMDK file, so it's not really an image.

These are the results:

################################################################################################

Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-96-generic x86_64)

  System information as of Thu Sep 21 17:02:51 CEST 2017

  System load:  1.96               Processes:              201
  Usage of /:   83.2% of 43.88GB   Users logged in:        0
  Memory usage: 4%                 IP address for eth0:    
  Swap usage:   0%                 IP address for docker0: 172.17.0.1

################################################################################################

======================================================================================
      V M D K --- R A W !!! --- on Transcend SSD370 128 GB
======================================================================================

 Timing O_DIRECT cached reads:   1024 MB in  2.00 seconds = 511.61 MB/sec <---
 Timing O_DIRECT disk reads: 1134 MB in  3.00 seconds = 377.88 MB/sec <---

 Timing O_DIRECT cached reads:   1042 MB in  2.00 seconds = 520.82 MB/sec <---
 Timing O_DIRECT disk reads: 1162 MB in  3.00 seconds = 387.27 MB/sec <---

---

 Timing O_DIRECT cached reads:   816 MB in  2.00 seconds = 407.55 MB/sec
 Timing O_DIRECT disk reads: 1020 MB in  3.01 seconds = 339.43 MB/sec <---

======================================================================================
      V M D K --- on Samsung Pro 850 515GB
======================================================================================

 Timing O_DIRECT cached reads:   836 MB in  2.00 seconds = 417.21 MB/sec <---
 Timing O_DIRECT disk reads: 782 MB in  3.01 seconds = 260.21 MB/sec

 Timing O_DIRECT cached reads:   834 MB in  2.00 seconds = 416.08 MB/sec
 Timing O_DIRECT disk reads: 786 MB in  3.00 seconds = 261.71 MB/sec

---

 Timing O_DIRECT cached reads:   826 MB in  2.00 seconds = 412.75 MB/sec <---
 Timing O_DIRECT disk reads: 774 MB in  3.00 seconds = 257.79 MB/sec

 Timing O_DIRECT cached reads:   828 MB in  2.00 seconds = 413.88 MB/sec <---
 Timing O_DIRECT disk reads: 774 MB in  3.00 seconds = 257.83 MB/sec

---

 Timing O_DIRECT cached reads:   842 MB in  2.00 seconds = 420.76 MB/sec <---
 Timing O_DIRECT disk reads: 770 MB in  3.00 seconds = 256.56 MB/sec

======================================================================================
      V D I --- on Samsung Pro 850 515GB
======================================================================================

 Timing O_DIRECT cached reads:   470 MB in  2.01 seconds = 234.21 MB/sec <---
 Timing O_DIRECT disk reads: 766 MB in  3.00 seconds = 254.94 MB/sec

 Timing O_DIRECT cached reads:   494 MB in  2.00 seconds = 246.45 MB/sec <---
 Timing O_DIRECT disk reads: 754 MB in  3.00 seconds = 250.92 MB/sec

 Timing O_DIRECT cached reads:   490 MB in  2.00 seconds = 244.46 MB/sec <---
 Timing O_DIRECT disk reads: 764 MB in  3.01 seconds = 254.03 MB/sec

################################################################################################
# Data above comes from here
################################################################################################

======================================================================================
      V M D K --- on Samsung Pro 850 515GB
======================================================================================

  System information as of Thu Sep 21 17:02:51 CEST 2017

user@xeon:~$ sudo hdparm -tT --direct /dev/sda
/dev/sda:
 Timing O_DIRECT cached reads:   836 MB in  2.00 seconds = 417.21 MB/sec <======
 Timing O_DIRECT disk reads: 782 MB in  3.01 seconds = 260.21 MB/sec <======

user@xeon:~$ sudo hdparm -tT /dev/sda
/dev/sda:
 Timing cached reads:   21080 MB in  2.00 seconds = 10554.40 MB/sec
 Timing buffered disk reads: 784 MB in  3.00 seconds = 260.92 MB/sec

user@xeon:~$ sudo hdparm -tT --direct /dev/sda
/dev/sda:
 Timing O_DIRECT cached reads:   834 MB in  2.00 seconds = 416.08 MB/sec <======
 Timing O_DIRECT disk reads: 786 MB in  3.00 seconds = 261.71 MB/sec <======

======================================================================================
      V M D K --- R A W !!! --- on Transcend SSD370 128 GB
======================================================================================

  System information as of Thu Sep 21 17:00:47 CEST 2017

user@xeon:~$ sudo hdparm -tT --direct /dev/sda
/dev/sda:
 Timing O_DIRECT cached reads:   1024 MB in  2.00 seconds = 511.61 MB/sec <======
 Timing O_DIRECT disk reads: 1134 MB in  3.00 seconds = 377.88 MB/sec <======

user@xeon:~$ sudo hdparm -tT /dev/sda
/dev/sda:
 Timing cached reads:   21182 MB in  2.00 seconds = 10603.52 MB/sec
 Timing buffered disk reads: 1060 MB in  3.00 seconds = 352.91 MB/sec

user@xeon:~$ sudo hdparm -tT --direct /dev/sda
/dev/sda:
 Timing O_DIRECT cached reads:   1042 MB in  2.00 seconds = 520.82 MB/sec <======
 Timing O_DIRECT disk reads: 1162 MB in  3.00 seconds = 387.27 MB/sec <======

======================================================================================
      V M D K --- on Samsung Pro 850 515GB
======================================================================================

  System information as of Thu Sep 21 16:58:12 CEST 2017

user@xeon:~$ sudo hdparm -tT --direct /dev/sda
/dev/sda:
 Timing O_DIRECT cached reads:   826 MB in  2.00 seconds = 412.75 MB/sec <======
 Timing O_DIRECT disk reads: 774 MB in  3.00 seconds = 257.79 MB/sec <======

user@xeon:~$ sudo hdparm -tT /dev/sda
/dev/sda:
 Timing cached reads:   22082 MB in  2.00 seconds = 11055.78 MB/sec
 Timing buffered disk reads: 788 MB in  3.01 seconds = 262.11 MB/sec

user@xeon:~$ sudo hdparm -tT --direct /dev/sda
/dev/sda:
 Timing O_DIRECT cached reads:   828 MB in  2.00 seconds = 413.88 MB/sec <======
 Timing O_DIRECT disk reads: 774 MB in  3.00 seconds = 257.83 MB/sec <======

======================================================================================
      V D I --- on Samsung Pro 850 515GB
======================================================================================

  System information as of Thu Sep 21 16:55:24 CEST 2017

user@xeon:~$ sudo hdparm -tT /dev/sda
/dev/sda:
 Timing cached reads:   21468 MB in  2.00 seconds = 10747.37 MB/sec
 Timing buffered disk reads: 662 MB in  3.01 seconds = 220.12 MB/sec

user@xeon:~$ sudo hdparm -tT --direct /dev/sda
/dev/sda:
 Timing O_DIRECT cached reads:   470 MB in  2.01 seconds = 234.21 MB/sec <======
 Timing O_DIRECT disk reads: 766 MB in  3.00 seconds = 254.94 MB/sec <======

user@xeon:~$ sudo hdparm -tT --direct /dev/sda
/dev/sda:
 Timing O_DIRECT cached reads:   494 MB in  2.00 seconds = 246.45 MB/sec <======
 Timing O_DIRECT disk reads: 754 MB in  3.00 seconds = 250.92 MB/sec <======

user@xeon:~$ sudo hdparm -tT /dev/sda
/dev/sda:
 Timing cached reads:   20872 MB in  2.00 seconds = 10448.98 MB/sec
 Timing buffered disk reads: 694 MB in  3.01 seconds = 230.78 MB/sec

user@xeon:~$ sudo hdparm -tT --direct /dev/sda
/dev/sda:
 Timing O_DIRECT cached reads:   490 MB in  2.00 seconds = 244.46 MB/sec <======
 Timing O_DIRECT disk reads: 764 MB in  3.01 seconds = 254.03 MB/sec <======

======================================================================================
      V M D K --- on Samsung Pro 850 515GB
======================================================================================

  System information as of Thu Sep 21 16:52:32 CEST 2017

user@xeon:~$ sudo hdparm -tT /dev/sda
/dev/sda:
 Timing cached reads:   20872 MB in  2.00 seconds = 10448.90 MB/sec
 Timing buffered disk reads: 764 MB in  3.01 seconds = 254.11 MB/sec

user@xeon:~$ sudo hdparm -tT --direct /dev/sda
/dev/sda:
 Timing O_DIRECT cached reads:   842 MB in  2.00 seconds = 420.76 MB/sec <======
 Timing O_DIRECT disk reads: 770 MB in  3.00 seconds = 256.56 MB/sec <======

======================================================================================
      V M D K --- R A W !!! --- on Transcend SSD370 128 GB
======================================================================================

  System information as of Thu Sep 21 16:29:55 CEST 2017

user@xeon:~$ sudo hdparm -tT /dev/sda
/dev/sda:
 Timing cached reads:   22034 MB in  2.00 seconds = 11029.82 MB/sec
 Timing buffered disk reads: 990 MB in  3.00 seconds = 329.68 MB/sec

user@xeon:~$ sudo hdparm -tT --direct /dev/sda
/dev/sda:
 Timing O_DIRECT cached reads:   816 MB in  2.00 seconds = 407.55 MB/sec <======
 Timing O_DIRECT disk reads: 1020 MB in  3.01 seconds = 339.43 MB/sec <======

I don't really know how to interpret this, maybe somebody wants to leave a comment on it. I chose the VMDK then.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.