In virtual box 3.0.2 is there any performance difference between using the native VDI virtual disk format and the VMDK virtual disk format?
Mac – ny performance difference between the VMDK and VDI virtual disk formats with Virtual Box
virtual machinevirtual-diskvirtualbox
Related Solutions
VirtualBox has
- full support for
- VDI
- VMDK
- VHD
- partial support for
- HDD (Parallels version 2 only)
- and undocumented support for
- QCOW
- QED
Source: Oracle® VM VirtualBox® User Manual » Chapter 5. Virtual Storage » 5.2. Disk Image Files (VDI, VMDK, VHD, HDD)
Answering Your Considerations
- be able to use dynamic sizing
VDI, VMDK, and VHD all support dynamically allocated storage. 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.
HDD, QCOW, and QED have to be dynamically allocated if created in VirtualBox.
- be able to have snapshots
VirtualBox supports snapshotting of all six formats.
- 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. Other virtualization software generally don't support VDI, but it's pretty easy to convert from VDI to another format, especially with qemu-img convert
.
VMDK is developed by and for VMWare, but VirtualBox and QEMU (another common virtualization software) also support it. This format might be the the best choice for you because you want wide compatibility with other virtualization software.
VHD is the native format of Microsoft Virtual PC. Windows Server 2012 introduced VHDX as the successor to VHD, but VirtualBox does not support VHDX.
HDD is a format for Parallels. Parallels specializes in virtualization for macOS. This probably isn't suitable for you, especially considering that VirtualBox only supports an old version of the HDD format.
QCOW is the old original version of the qcow format. It has been superseded by qcow2, which VirtualBox does not support.
QED was an abandoned enhancement of qcow2. QEMU advises against using QED.
- performance
Each of the formats may have nuanced performance characteristics due to how the block storage is abstracted by the format, but I haven't found any benchmarks comparing the VirtualBox-supported formats.
There are bigger factors that influence performance, such as:
- 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 overhead.
You are correct in thinking that a .vdi
file is a virtual disk image file, and that they are used by snapshots.
When a snapshot is created, a new .vdi
file is created, in which the difference from the snapshot is stored. This is called "differencing storage".
Technically, a snapshot records an entire VM state, which includes all attached drives, however most people do also use the word as a synonym for "delta image", "difference image" or "child image" when discussing the role of a single VDI in a snapshot chain, other than the base VDI. Source
After a snapshot has been taken, VirtualBox creates differencing hard disk for each normal hard disk associated with the machine so that when a snapshot is restored, the contents of the virtual machine's virtual hard disks can be quickly reset by simply dropping the pre-existing differencing files. Source
You can imagine how this might be useful when you need to create multiple "branches" from one snapshot – each snapshot's VDI will contain only the differences added by that snapshot, not anything which exists in the base VDI. For example, consider a base disk (snapshot) with 50 GB of files and multiple child snapshots, each adding 10 GB of unique data. Each child VDI will only be as big as is necessary to store their 10 GB of data, rather than including the 50 GB from the base disk.
If you open the Virtual Media Manager (File→Virtual Media Manager on Windows), you can view a tree view of your virtual hard drives in the "Hard drives" tab. Here you can see the disks and their children. Clicking on a disk will display its information.
For example, I have a disk whose information displays:
Foo.vdi
Type: Normal
Location: C:\VirtualBox VMs\Foo\Foo.vdi
Storage details: Dynamically allocated storage
Attached to: Foo (Bar)
Its furthest descendant's information is:
{bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb}.vdi
Type: Differencing
Location: C:\VirtualBox VMs\Foo\Snapshots\{bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb}.vdi
Storage details: Dynamically allocated differencing storage
Attached to: Foo
In this example, "Foo" is the name of the VM, and "Bar" is the name of the first snapshot. "{bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb}" is the UUID of the last disk.
The VM's .vbox
file contains an XML document describing the VM, including its snapshots. The VirtualBox
node contains a Machine
child node, which can contain Snapshot
nodes. The stateFile
attribute on this node specifies the .sav
file associated with this snapshot, if any.
The
.sav
file is essentially a memory dump, though other processor information (such as registers) is probably stored too. Source
Strangely, he also says that.sav
files have nothing to do with snapshots, which is incorrect.
A.sav
file contains always the complete state of the guest at a certain point in time. It does not contain any information stored on external devices like virtual disks. When a snapshot is created, a.sav
file is created containing the VM state which is required to restore the guest state for that time and a new differential disk image is created for each virtual disk (which is not attached in some special mode to prevent that). From now on, guest disk write requests go to the differential image. When you restore a snapshot, the differential image is removed so all changes to the disk after the snapshot was created are lost. Source
To directly answer your questions:
[...] SAV is used for the current state. Is this true?
When the machine's state is saved, the current state at that time is saved in a .sav
file.
[...] we should only have one SAV file (since there will only be one current state for a virtual machine
Sure, there is only one current state, but the .sav
files created by a snapshot contain previous states.
[...] I found 2 SAV (and 2 VDI) files. Is that normal [...] ?
Is a snapshot represented by one of each type?
That's normal. I'm assuming that it's possible to have multiple snapshots without .sav
files if the snapshots were taken while the VM was not running, as there is no execution (volatile) state to be saved. If your machine is running when you take a snapshot, a .sav
file is created.
So what is really the difference between SAV and VDI?
A .vdi
file is a virtual disk, containing persistent storage. A .sav
file contains a dump of volatile state information, which allows you to resume the state of a machine. Together they facilitate the complete restoration of a VM state which was created through a snapshot.
Both can be used independently of one another. .sav
files are also used when you close a VM and save its state. .vdi
files can also be used as persistent storage outside of the scope of snapshotting.
Best Answer
I don't think so - for example, this blog post claims the following:
However, it also says the following:
I don't know if this applies to the newest version, but it sounds like you should go with VDI.