Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Virtual Disk Image (VDI) format

The Virtual Disk Image (VDI) format is used by VirtualBox virtualization products as one of its image formats.

Overview

A VDI file consists of:

  • file header
  • block map
  • media (or image) data blocks

Characteristics

CharacteristicsDescription
Byte orderlittle-endian
Character stringsASCII

File header

The file header is of variable size and consists of:

OffsetSizeValueDescription
Pre-header
064Unknown (file banner text), which contains an ASCII string, seen "<<< Sun xVM VirtualBox Disk Image >>>\n", "<<< Oracle VM VirtualBox Disk Image >>>\n" and "<<< QEMU VM Virtual Disk Image >>>\n"
Header
644"\x7f\x10\xda\xbe"Signature
6821Minor format version
7021Major format version
724Header size, which does not include the size of the pre-header
764Image type
804Image flags
84256Image description, which contains an ASCII string
3404Blocks map offset, relative to the start of the file
3444Data (blocks) area offset, relative to the start of the file
Geometry
34840Number of cylinders (no longer used?)
35240Number of heads (no longer used?)
35640Number of sectors (no longer used?)
3604Bytes per sector
 
36440Unknown (unused)
3688Data (or disk or media) size, in number of bytes
3764Block size, in number of bytes
38040Unknown (block extra data)
3844Number of (media data) blocks
3884Number of allocated blocks
39216(Disk) identifier, contains an UUID
40816Last snapshot identifier, contains an UUID
If header size > 360
42416Link identifier, contains an UUID
44016Parent (disk) identifier, contains an UUID
If header size > 392
456...Unknown

Format versions

Format versionDescription
1.0Presumably format version used in VirtualBox pre-release
1.1Version used by first release of VirtualBox

Image types

ValueIdentifierDescription
1Dynamic-size (or sparse) VDI image (variant Standard)
2Fixed-size (static) VDI image (variant Fixed)
3Undo (temporary differential image)
4Differential (or differencing) VDI image

Image flags

ValueIdentifierDescription
0x00000001VDI_IMAGE_FLAGS_FIXEDIs a fixed image, all blocks were pre-allocated
0x00000002VDI_IMAGE_FLAGS_DIFFIs a differential image
0x00000100VDI_IMAGE_FLAGS_ZERO_EXPANDZero-Expansion Optimization, 0-byte filled block is stored as a block number of -2 (0xfffffffe) on write

Block map

The block (or image or index) map contains an array of 32-bit block numbers.

Where block number:

  • -1 (0xffffffff) represents an unallocated block. The block is sparse or stored in the parent file.
  • -2 (0xfffffffe) represents a zero block. The block is sparse.
  • physical block number, where 0 represents the first block. The block is stored in the file.
block_physical_offset = data_area_offset + (physical_block_number * block_size)