Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:VHDX

From ReverseEngineering.wiki
Format
On this wiki Facts · Code · Notes · Topics

Hyper-V's second-generation virtual disk: a 1 MiB header section (file identifier "vhdxfile", two "head" headers, two "regi" region tables), a metadata region, a block allocation table (BAT) and a log; little endian with CRC-32C checksums and MS GUIDs.

Layout of the first 1 MiB (qemu block/vhdx.h)

Each block is 64 KiB: file identifier at 0, header 1 at 64 KiB, header 2 at 128 KiB, region table 1 at 192 KiB, region table 2 at 256 KiB, the rest reserved up to 1 MiB.

  • File identifier: 8-byte signature "vhdxfile" (0x656C696678646876 as a little-endian u64) then a 256-wide UTF-16 creator string (diagnostic only).
  • Header ("head", 0x64616568): checksum (CRC-32C over the first 4 KiB of the block with the field zeroed), sequence_number (the header with the higher number is current), file_write_guid, data_write_guid, log_guid (zero = no valid log), log_version (0), version (1), log_length and log_offset (multiples of 1 MiB).
  • Region table ("regi", 0x69676572): checksum (CRC-32C over 64 KiB), entry_count (up to 2047), then 32-byte entries: guid, file_offset (multiple of 1 MiB), length, required flag (bit 0).

Region GUIDs (qemu vhdx.c)

BAT region 2DC27766-F623-4200-9D64-115E9BFD4A08; metadata region 8B7CA206-4790-4B9A-B8FE-575F050F886E. Both are required. GUIDs are stored in MS mixed-endian form (see Format:GPT partition table).

Metadata region

Starts with an 8-byte "metadata" signature, entry_count (<= 2047) and 32-byte entries (item_id GUID, offset, length, flags: 1 user, 2 virtual-disk, 4 required). Known items:

GUID Item
CAA16737-FA36-4D43-B3B6-33F0AA44E76B file parameters (block_size 1-256 MiB power of two; flag 1 leave blocks allocated = fixed, flag 2 has parent)
2FA54224-CD1B-4876-B211-5DBED83BF4B8 virtual disk size (max 64 TiB)
BECA12AB-B2E6-4523-93EF-C309E000C746 page 83 data (SCSI id)
8141BF1D-A96F-4709-BA47-F233A8FAAB5F logical sector size (512 or 4096)
CDA348C7-445D-4471-9CC9-E9885251C556 physical sector size (512 or 4096)
A8D35F2D-B30B-454D-ABF7-D3D84834AB0C parent locator (differencing disks)

BAT

64-bit entries: low 3 bits state, upper 44 bits file offset in MiB units. Payload block states: 0 not present, 1 undefined, 2 zero, 3 unmapped, 6 fully present, 7 partially present. Sector bitmap blocks are interleaved after every chunk_ratio payload blocks (qemu computes chunk_ratio from VHDX_MAX_SECTORS_PER_BLOCK = 2^23 sectors, the logical sector size and the block size; Unverified exact formula); sector-bitmap states: 0 not present, 6 present.

Log

Entries "loge" (64-byte header), descriptors "desc"/"zero" (32 bytes) and 4 KiB "data" sectors; replay required when log_guid is non-zero.

Code & repositories

  • qemu block/vhdx.h, block/vhdx.c (GPL-2.0).
  • 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