Introduction
VMDK is the virtual disk format of VMware. Every
VMware virtual machine, in Workstation, Fusion or ESXi, keeps its hard disk in one or more
.vmdk files. Other virtualisation software reads it too, and it is the disk
format inside OVF and OVA appliance packages.
A virtual disk can be stored in several ways: as one growing file, split into pieces of 2 GB, or as a fully allocated flat file. The type is written in a short text descriptor that tells the software which files hold the disk.
Structure
Every VMDK disk has a text descriptor. It may be a small file of its own, or embedded
inside the first data file. It starts with # Disk DescriptorFile and gives
a content ID, the ID of any parent disk, the createType (such as
monolithicSparse, twoGbMaxExtentSparse,
monolithicFlat or streamOptimized), one line per extent naming
its access, size in sectors, type and file, and ddb. lines with the disk’s
geometry and adapter type.
A flat extent is the raw disk, sector by sector. A
sparse extent starts with a header
whose magic number reads KDMV in the file (the bytes 4B 44 4D 56).
The header gives the version, the disk’s capacity, the grain size, which is the unit of
allocation and 64 KB by default, and the positions of the descriptor and the grain
directory. The grain directory points to grain tables, and each grain table entry points
to a grain in the file, or is zero when that part of the disk has never been written.
ESX snapshot deltas use an older sparse format, COWD.
0Sparse headerKDMV, version, capacity, grain size, table offsets512 bytes…Embedded descriptor the text descriptor, in a monolithic sparse filevaries…Grain directory and grain tablesvaries…Grains the written parts of the diskrepeated
A disk can be one file (monolithic: monolithicSparse, a stream-optimized file in an
OVA), or a descriptor beside its extents (monolithicFlat with
-flat.vmdk; split disks with -s001.vmdk, -s002.vmdk and so on, or -f001.vmdk), and a
snapshot adds a child disk that names its parent (the chain). ESXi uses
COWD and SEsparse extents.
The viewer shows the header, the embedded descriptor, both grain directories and every grain table, a list of every grain with its place in the file, and the footer and markers of a stream-optimized file. The virtual disk the guest sees opens as a nested file (read in windows, only as far as is looked at, however large the disk), so the partition table and file systems inside open in the viewers for those formats. For a descriptor or a split or child disk, drop the disk’s folder so the extent files come with it.
Not described
Known, not yet covered
- Viewer: a disk is opened as a file only when every extent file was opened with the descriptor (drop the disk’s folder); a child disk’s parent is applied when it is among those files. Encrypted descriptors and extents are out of scope of VMware’s note and are not read.
Unknown
- Viewer: raw device extents, which are not part of the file. An extent of the type
VMFSRDM,VMFSRAW,VMFSRDMPorDEVICE, or aFLATextent that names a device (/dev/…,\\.\PhysicalDrive0,/vmfs/devices/…) in afullDeviceorpartitionedDevicedisk, points at a physical disk of the host that made the VMDK. That disk is not in any file, so its bytes cannot be shown. The viewer reads these lines in full (type, size, device name, start sector, the range they cover in the virtual disk), marks the range unavailable, reads it as zeros and still opens the rest of the disk (the-pt.vmdkpartition table file of a partitioned device is read normally). The libvmdk specification marks the details ofVMFSRDMandVMFSRAWas to do;DEVICEis not listed by any source read, and is treated as a device by name. - Viewer: the SEsparse journal is not replayed. No source describes its records: QEMU’s author wrote in 2020 that he does not know its layout. The viewer shows whether the journal holds anything and reads the disk from the tables as they stand (SEsparse).
- Reference and viewer: the change-tracking file (
-ctk.vmdk) layout: libvmdk shows eight unexplained fields and no public source explains them. The file is shown as bytes. - Reference and viewer: the SEsparse journal, free bitmap and backmap (SEsparse), and the extent line’s partition UUID and device identifier values, and the meaning of
ddb.deletableandddb.thinProvisioned: no source read describes them; the viewer labels them not described. - Reference: the descriptor’s virtual hardware versions and adapter type meanings beyond the names the sources list.
Links
Software
- VMware Workstation Pro – VMware’s desktop virtual machine software (Windows, Linux)
- VMware Fusion – VMware’s virtual machine software for the Mac (macOS)
- VMware ESXi – VMware’s server hypervisor
- VirtualBox – free virtual machine software that uses VMDK disks (Windows, macOS, Linux)
- QEMU and qemu-img – run and convert VMDK files (Windows, macOS, Linux)
- 7-Zip – free archiver that opens VMDK files like an archive (Windows)
Developers
- libvmdk – library with Python bindings that reads VMDK files (C)
- libguestfs – library and tools for reading and changing the files inside disk images (C)