Introduction
VDI is the native virtual disk format of
VirtualBox. When VirtualBox creates a new
virtual machine it makes a .vdi file to act as its hard disk, unless another
format is chosen.
A VDI can be fixed, with the whole disk allocated at once, or dynamic, growing as the guest writes data. Snapshots are stored as further VDI files that record only the changes from their parent.
Structure
The file starts with a line of text naming the program, such as
<<< Oracle VM VirtualBox Disk Image >>>, padded to 64
bytes. Older files name innotek or Sun instead. At offset 64 comes the signature
0xBEDA107F, stored little-endian, then the version and the rest of the
header: the image type (dynamic or fixed), a description, the offsets of the block map
and of the data, the disk geometry, the disk size, the block size, which is 1 MB by
default, the number of blocks and of allocated blocks, and the IDs of the image, its last
snapshot and its parent.
The block map has one 4-byte entry per block of the virtual disk, giving the block’s position in the data area, or a special value for a block that has never been written. The data area holds the allocated blocks in the order they were first written.
0Text banner the program’s name, padded64 bytes64Header signature0xBEDA107F, version, type, offsets, sizes, IDsvaries…Block map one entry per block of the disk4 bytes per block…Data blocks the written parts of the diskrepeated
Links
Software
- VirtualBox and VBoxManage (Windows, macOS, Linux)
- QEMU and qemu-img, which run and convert VDI files (Windows, macOS, Linux)
- 7-Zip, which opens VDI files like an archive (Windows)
Developers
- libguestfs, C library and tools for reading and changing the files inside disk images