Format:VMDK
| On this wiki | Facts · Code · Notes · Topics |
|---|
VMware's virtual disk format: a text descriptor (createType, extent lines) that may sit in its own file or be embedded in a sparse extent whose binary header starts "KDMV"; version 1-3, grain size in sectors, grain directory/table mapping, optional stream-optimized deflate grains with markers.
Forms
- Text descriptor file (
# Disk DescriptorFile,version=1,CID=,createType="...", extent linesRW <sectors> FLAT|SPARSE "file" [offset]). QEMU's probe acceptsversion=1,version=2orversion=3lines (LF or CRLF). - Sparse extent files (monolithicSparse, twoGbMaxExtentSparse, streamOptimized) start with 'KDMV' (bytes 4B 44 4D 56;
VMDK4_MAGIC) and often embed the descriptor at sectordesc_offset(default 0x200 bytes in QEMU). - 'COWD' (
VMDK3_MAGIC) marks old ESX sparse (vmfsSparse) extents. - QEMU also knows createType values vmfs, vmfsSparse, seSparse, twoGbMaxExtentSparse, twoGbMaxExtentFlat, monolithicFlat, monolithicSparse and streamOptimized.
Sparse header (VMDK4Header, little endian, qemu block/vmdk.c)
magic KDMV (4); version (4; QEMU rejects > 3 and opens version 3 read-only); flags (4); capacity (8, sectors); granularity (8, grain size in sectors, Unverified: 128 sectors = 64 KiB is the usual value); desc_offset (8, sectors); desc_size (8); num_gtes_per_gt (4, 512 typical); rgd_offset (8, redundant grain directory); gd_offset (8; 0xFFFFFFFFFFFFFFFF = directory is in the footer, stream-optimized); grain_offset (8, overhead); then single-byte filler, 4 newline-detection check bytes and compressAlgorithm (2; 1 = deflate).
Flags: bit 0 newline-detect, bit 1 redundant grain table in use, bit 2 zeroed-grain GTEs, bit 16 compressed grains, bit 17 markers present. Offsets in sectors (<< 9 for bytes).
Mapping
Grain directory -> grain tables (num_gtes_per_gt entries of 32-bit sector numbers) -> grains. GTE 0 = unallocated, 1 = zeroed grain (when bit 2 is set). Stream-optimized extents carry markers; qemu defines marker types 0 end-of-stream, 1 grain table, 2 grain directory, 3 footer, and reads the real header from a footer when gd_offset is 0xFFFFFFFFFFFFFFFF. Unverified: each grain is stored as a marker (u64 LBA, u32 compressed size) followed by deflate data.
ESXi seSparse
Header with u64 fields (constant magic, version 0x0000000200000001, capacity, grain_size must be 8 in QEMU, grain table offsets, journal); QEMU opens it read-only.
Code & repositories
- qemu
block/vmdk.c(GPL-2.0). libyal libvmdk (LGPL-3) documents the format. - https://github.com/qemu/qemu @
a19f59a72d96056d9a8f48cf6c77f5787491e414· license: GPL-2.0-only (declared by the contributor; GitHub's detector did not recognize COPYING)
block/qcow2.h, vpc.c, vhdx.h/.c, vmdk.c, vdi.c: on-disk structures of the virtual disk formats (COPYING is GPL-2.0; individual files carry GPL/MIT headers)
Tested on: source read, not run: source read only · checked 2026-10-19; last activity 2026-10-17