SUBMIT A FILE TYPE CONTACT US SUPPORT ABOUT US

What Is a VHD File? How to Check a Virtual Hard Disk File Before You Trust It

A VHD file stores a disk in one file, and three decoders agreed on the intact data for only 3 of 24 damaged copies. Jump to your question below, or work through it in order.

45 min read Updated October 2026 Checked against sources and tests

What Is a VHD File? A virtual hard disk in one file, with a footer that names the kind

Short answer

VHD files are virtual hard disks stored in one file, and a footer of 512 bytes at the end starts with the text conectix. The footer names the kind, the disk size and a checksum. Dynamic VHD files repeat it at the start. Fixed VHD files are raw disks with that footer added.

We read 5 healthy VHD files with five readers and damaged our test files in 24 ways. Three decoders, qemu-img, 7-Zip and libvhdi, returned intact data for the same 3 damaged copies and split on 18. In 8 copies no decoder returned intact data.

To check VHD files without Windows, read the check steps. To see what is inside, read the layout. If your VHD file will not open, begin with the eight causes.

VHD files are virtual hard disks stored in one file. They contain a disk with its partitions and files, plus a footer of 512 bytes that names the kind. The ending .vhd is only a label, because the footer decides what a file is.

Picture a virtual machine saved as server.vhd. Hyper-V, Windows Disk Management and 7-Zip can open it as a disk. Text editors show odd symbols, because VHD files copy disks and are not pages of text. Sectors of the disk are stored one after another.

Microsoft Learn describes VHD as a publicly available image format specification. It names three kinds, fixed, expandable (also called dynamic or sparse) and differencing. All kinds have a minimum of 3 MB, and dynamic and differencing VHD files stop at 2,040 GB.

Wikipedia says Connectix built the format for Virtual PC, and Microsoft bought Connectix in 2003. It adds that Windows 8 and Windows Server 2012 brought VHDX, which allows disks up to 64 TB.

The Microsoft Download Center lists VHD Specifications, version 1.0, as a Word file of 181 KB. We did not open that document. Our byte map follows libvhdi project documentation, and we checked every value against our own VHD files.

FileInfo lists Microsoft as developer of the Virtual PC Virtual Hard Disk. It names a second file type with the same ending, VHDL source files. So the ending alone can mislead.

Wikipedia lists three media types in use, application/x-vhd, application/x-vhd-disk and application/x-virtualbox-vhd. We did not check IANA, and we found no PRONOM record for VHD.

Where our VHD files come from

We tested 5 healthy VHD files. qemu-img 8.2.2 made fixed.vhd and dynamic.vhd, and a script of 78 lines built diff.vhd, a differencing child of dynamic.vhd. All three contain a 16 MiB disk with one FAT16 partition and three files, notes.txt, data.bin and readme.txt, of 48, 3,000 and 12 bytes.

The other two healthy VHD files are public test images from the qemu project. The footer of hyperv2012r2-dynamic.vhd names creator win 6.3, and the footer of d2v-zerofilled.vhd names d2v 1.0. Both date from February 2016, and their disks are empty or all zeros.

We then made 24 damaged copies, and every copy changes one thing. We worked on Linux. We opened no VHD files in Windows, Hyper-V, VirtualBox or VMware, and we tested no files from Windows 10 or 11.

VHD file facts at a glance

Quick facts about VHD files
Property Value
Meaning Virtual Hard Disk. FileInfo lists Microsoft as developer.
Ending .vhd. Newer VHDX files end in .vhdx.
First bytes Dynamic and differencing VHD files start with 63 6f 6e 65 63 74 69 78, the text conectix, and end with the same 512 bytes. Fixed VHD files start with the raw disk, so the file command called ours a DOS/MBR boot sector.
Footer 512 bytes. Kind at byte 60, disk size at bytes 40 to 55 and checksum at bytes 64 to 67.
Kinds Fixed, dynamic (also called expandable or sparse) and differencing, per Microsoft Learn.
Sizes From 3 MB. Dynamic and differencing VHD files stop at 2,040 GB, per Microsoft Learn. qemu-img made a 2040G dynamic file and refused 2041G.
Byte order Numbers are stored high byte first. The disk size in our dynamic VHD file, 00 00 00 00 01 00 00 00, is 16,777,216.
Opens with Windows Disk Management and Hyper-V, per Microsoft Learn. We tested qemu-img, 7-Zip and libvhdi on Linux.
Our tests 5 healthy VHD files, 24 damaged copies, 6 conversions and one growth test.

Wrong page? VDI files belong to VirtualBox. See the VDI file page.

What Is Inside a VHD File? A footer, a header, a table and the blocks they name

Dynamic VHD files have five parts, a footer copy, a header of 1,024 bytes, a block table, data blocks and a closing footer. Our dynamic.vhd is 2,100,224 bytes long, and its footer says in 512 bytes what kind it is and how big its disk is.

We made dynamic.vhd with qemu-img, so every byte can be read. It contains a disk of 16 MiB with a partition and three files. Only one block of 2 MiB is stored, because the files are small. The figure shows its parts from start to end.

Diagram of one dynamic VHD file of 2,100,224 bytes in five blocks: a footer copy, a dynamic header, a block table, one block with its bitmap, and a closing footer, with three rules about the footer and the table.
Figure 1. One dynamic VHD file from our tests. The blocks are not drawn to scale.

Read the figure from the top. Readers need the footer first, because it names the kind and the disk size. In dynamic VHD files the footer also points to the header, and the header points to the table that finds every block.

The first 96 bytes of dynamic.vhd
xxd -l 96 dynamic.vhd
00000000: 636f 6e65 6374 6978 0000 0002 0001 0000  conectix........
00000010: 0000 0000 0000 0200 3274 9a2e 7165 6d32  ........2t..qem2
00000020: 0005 0003 5769 326b 0000 0000 0100 0000  ....Wi2k........
00000030: 0000 0000 0100 0000 ffff 10ff 0000 0003  ................
00000040: ffff edd8 d106 a155 a5e0 4304 9d45 e7e8  .......U..C..E..
00000050: 034b 01d2 0000 0000 0000 0000 0000 0000  .K..............

Bytes 0 to 7, 63 6f 6e 65 63 74 69 78, spell conectix. Bytes 8 to 11, 00 00 00 02, are the features field, and it was 2 in every VHD file we made. Bytes 12 to 15, 00 01 00 00, give format version 1.0.

Bytes 16 to 23 give the offset of the next structure. Here they read 512, where the dynamic header starts. Fixed VHD files have ff in all 8 bytes, because nothing follows. Bytes 24 to 27, 32 74 9a 2e, are a time stamp in seconds since 1 January 2000.

Bytes 28 to 31, 71 65 6d 32, spell qem2, the mark of qemu-img. Bytes 32 to 35, 00 05 00 03, give version 5.3. Bytes 36 to 39, 57 69 32 6b, spell Wi2k. Every VHD file we made says Wi2k, even though we worked on Linux, so this field is no proof of where a file was made.

Bytes 40 to 47 and 48 to 55 give original and current size, both 00 00 00 00 01 00 00 00, which is 16,777,216. Bytes 56 to 59, ff ff 10 ff, give a geometry of 65,535 cylinders, 16 heads and 255 sectors.

Bytes 60 to 63, 00 00 00 03, name the kind. 2 means fixed, 3 means dynamic and 4 means differencing. Bytes 64 to 67, ff ff ed d8, are the checksum, which is the one's complement of the sum of other footer bytes. One changed bit breaks it.

Bytes 68 to 83 are an identifier of 16 bytes, d1 06 a1 55 a5 e0 43 04 9d 45 e7 e8 03 4b 01 d2. Differencing VHD files store the identifier of their parent, and 7-Zip printed the same value as ID for this file. Byte 84 is the saved state, which is 0.

The header and the block table

The dynamic header and the start of the table
xxd -s 512 -l 48 dynamic.vhd
00000200: 6378 7370 6172 7365 ffff ffff ffff ffff  cxsparse........
00000210: 0000 0000 0000 0600 0001 0000 0000 0008  ................
00000220: 0020 0000 ffff f46f 0000 0000 0000 0000  . .....o........
xxd -s 1536 -l 48 dynamic.vhd
00000600: 0000 0004 ffff ffff ffff ffff ffff ffff  ................
00000610: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000620: ffff ffff ffff ffff ffff ffff ffff ffff  ................

The header starts at byte 512 with the text cxsparse. Its table offset, 00 00 00 00 00 00 06 00, is 1,536. The table has 00 00 00 08 entries, which is 8, and blocks are 00 20 00 00 bytes long, which is 2,097,152.

Eight blocks of 2 MiB make 16 MiB. The header checksum is ff ff f4 6f.

Entry 0 of the table reads 00 00 00 04. Multiply it by 512 and block 0 starts at byte 2,048. The block begins with a bitmap of 512 bytes, followed by 2,097,152 bytes of disk. The other seven entries read ff ff ff ff, so no block is stored for them, and readers return zeros.

The parts of a VHD file

Parts of VHD files
Part What it stores and where we saw it
conectix footer Kind, disk size, creator, time stamp, identifier and checksum in 512 bytes. All 5 healthy VHD files have one, and fixed VHD files have it only at the end.
Footer copy The same 512 bytes at the start of dynamic and differencing VHD files, so readers can start from either end. qemu-img read this copy in our tests.
cxsparse header 1,024 bytes that name the table, the number of entries and the block size. Differencing VHD files also store their parent name here.
Parent locators Up to 8 entries that point to the parent. Our diff.vhd stores two, W2ru for a relative path and W2ku for a full path, both in UTF-16.
Block table One 4 byte entry for every block. Multiply an entry by 512 to get the file offset. ff ff ff ff means no block is stored.
Bitmap 512 bytes at the start of every stored block. It marks which sectors of the block contain data.
Data block Sectors of the disk. In dynamic.vhd, block 0 contains the partition table, the FAT16 volume and our three files.

How two footers protect dynamic VHD files

Dynamic VHD files store the footer twice, so readers can find the kind from either end. In our tests qemu-img read the first copy and libvhdi read the last. Cutting off one copy gave different answers, as the damage grid shows.

The map is small. Our script reads the footer, the header and the table. It does not read the file system inside the disk, so damage in data blocks can pass it, as the 24 copies show.

Which Kind of VHD File Do You Have? Fixed, dynamic or differencing, and the ending names none

Three kinds of VHD files exist, fixed, dynamic and differencing, and byte 60 of the footer says which you have. For one 16 MiB disk, fixed.vhd is 16,777,728 bytes and dynamic.vhd is 2,100,224 bytes. The ending names none of them.

Questions about the size of VHD files come down to their kind. The footer answers without Windows. The figure shows our files side by side, with the limits we checked.

Bar chart of file sizes for one 16 MiB disk stored four ways, and for a 64 MiB disk with 10 MiB of data stored fixed and dynamic, with the creators and size limits we found and a note that the ending names none of them.
Figure 2. One disk in four files, a growth test and the limits we found. The ending names none of them.

Fixed

Microsoft says fixed VHD files are pre allocated for the maximum size requested. Ours is the raw disk of 16,777,216 bytes plus one footer of 512 bytes, which makes 16,777,728. Nothing marks the start, so the file command called it a DOS/MBR boot sector.

Fixed VHD files look like raw disks
file -b fixed.vhd
DOS/MBR boot sector; partition 1 : ID=0xe, start-CHS (0x0,32,33), end-
qemu-img info fixed.vhd
image: fixed.vhd
file format: raw
virtual size: 16 MiB (16777728 bytes)

qemu-img made the same mistake. Without -f vpc it guessed raw, and it reported a virtual size of 16,777,728 bytes, which is 512 more than the disk. Name the format yourself when you work with fixed VHD files.

Dynamic

Dynamic VHD files store only blocks that contain data. Our dynamic.vhd stores one block of 2 MiB and is 2,100,224 bytes long. The file command printed Microsoft Disk Image, Virtual Server or Virtual PC, so it reads the footer.

We also grew a test disk to 64 MiB with 10 MiB of random data. Fixed VHD files took 67,109,376 bytes and dynamic ones 12,588,544, which is 6 blocks of 2 MiB plus headers. Dynamic VHD files grow as disks fill.

Differencing

Differencing VHD files are children. Microsoft says a parent virtual disk is the basis, and later writes go to the child as differences while the parent is not modified. Children name their parent in their header.

qemu-img offers only fixed and dynamic when it writes VHD files, so we built diff.vhd with a script. It stores one block with one sector, sector 0, and its footer names creator chk 1.0. It is our file and not a Windows file, so read the differencing results with that in mind.

Files made by Windows tools

Two public VHD files show what Windows tools write. hyperv2012r2-dynamic.vhd is 266,240 bytes for a disk of 127 GiB, with 65,024 table entries that are all empty. d2v-zerofilled.vhd is 264,308,224 bytes for a disk of 251 MiB, with 126 entries and only zeros in its data.

Both use blocks of 2,097,152 bytes, as our VHD files do. Neither contains data, so they teach us layout and not content.

The limits we checked

Microsoft sets 3 MB as the smallest disk and 2,040 GB as the largest dynamic or differencing disk. qemu-img made a dynamic VHD file for a 2040G disk in 4,179,968 bytes. It refused 2041G and 2T with the message too large for file format vpc. Wikipedia gives 64 TB for VHDX.

The ending is not the type The file command named our dynamic VHD file a Virtual PC disk and our fixed VHD file a DOS/MBR boot sector. Both end in .vhd.
Size depends on kind One 16 MiB disk took 16,777,728 bytes in a fixed VHD file and 2,100,224 bytes in a dynamic one.
Children need parents Differencing VHD files store changes only. qemu-img wrote almost no data for ours, as the file study shows.
Rounded sizes Without force_size=on, qemu-img made an 8 MiB dynamic disk 2,048 bytes bigger, because it fits sizes to a geometry.

Not sure your file is a VHD file at all? Check it with our script.

What Did We Find in 5 Healthy VHD Files? Five readers and one quiet failure

We read 5 healthy VHD files with five readers. Our script, 7-Zip and libvhdi opened all 5. The file command called our fixed VHD file a boot sector, and qemu-img wrote almost no data for our differencing VHD file, because it does not read parents.

Three of the 5 VHD files are ours, so this is a small study and not a survey. qemu-img made fixed.vhd and dynamic.vhd, and our own script made diff.vhd. Two public test images from Windows tools contain no data.

Readers were file 5.45, qemu-img 8.2.2, 7-Zip 23.01 and libvhdi 20260901 through its Python module. We also wrote a 50 line Python script and used Sleuth Kit 4.12.1 to list files. We worked on Linux with Python 3.13 and opened no VHD files in Windows.

Readers counted as opening VHD files when they did their job. The file command had to print a VHD name, and our script had to print OK. qemu-img had to convert the file to raw, 7-Zip had to extract it and libvhdi had to read the entire disk. We compared SHA-256 hashes of results with the intact disk.

5 healthy VHD files read
5 readers on every file
24 damaged copies of our files
18 copies that split the decoders
Grid of five healthy VHD files against five readers. Every reader opened four of the files, and qemu-img returned almost no data for the differencing file because it does not read the parent.
Figure 3. Five healthy VHD files and five readers. A differencing file shows where one reader goes quiet.
What five readers found in 5 healthy VHD files
Test Result
Opened Our script, 7-Zip and libvhdi opened all 5 healthy VHD files. qemu-img opened all 5 as well, and the file command named 4 of them VHD files.
Together For 3 of 5 VHD files every reader gave the expected answer. The file command named fixed.vhd a boot sector, and qemu-img returned other data for diff.vhd.
Fixed file The file command printed DOS/MBR boot sector. qemu-img info without -f printed raw and a virtual size of 16,777,728 bytes. With -f vpc, qemu-img, 7-Zip and libvhdi returned the intact disk.
Differencing file qemu-img wrote a 16 MiB disk with 14 bytes that are not zero. 7-Zip and libvhdi merged child and parent. Sleuth Kit listed nothing, because it could not find the parent.
Windows made files All readers opened both. We compared no data, because their disks are empty or all zeros. Our script printed disk sizes of 136,365,211,648 and 263,454,720 bytes.
Sizes From 266,240 bytes to 264,308,224. Dynamic VHD files can be far smaller than their disks, as hyperv2012r2-dynamic.vhd shows with 266,240 bytes for 127 GiB.

Fixed VHD files hide their type

Fixed VHD files start with the raw disk, so the first bytes are a boot sector and not the text conectix. The file command printed DOS/MBR boot sector for fixed.vhd. That is correct for the start, and it means the command cannot spot fixed VHD files.

The footer is in the last 512 bytes. Our script reads both ends, so it printed OK for fixed.vhd with a disk of 16,777,216 bytes. qemu-img printed raw until we named the format.

A differencing VHD file and a quiet failure

qemu-img converted diff.vhd without an error and wrote a raw disk of 16 MiB. Only 14 bytes of it were not zero, all in sector 0, the one sector the child stores. qemu-img does not read parents, so everything else came back as zeros.

7-Zip did better. It found dynamic.vhd in the folder of the child and returned the three files. libvhdi returned them after we called its set_parent function. Sleuth Kit uses libvhdi, but it could not find the parent from the Windows style path in the header, and fls listed nothing.

Quiet failures are worse than refusals. You get a disk that looks valid and contains wrong data. Keep parents next to children, and use readers that follow the link.

Two VHD files from Windows tools

All five readers opened hyperv2012r2-dynamic.vhd and d2v-zerofilled.vhd, and our script printed OK for both. They show that our VHD files use the layout Windows tools write. They cannot show what readers do with data, because their disks are empty or all zeros.

Readers differ The file command missed fixed.vhd, and qemu-img returned other data for diff.vhd. Use a second reader on VHD files you rely on.
Fixed files hide their type They start with the raw disk. Read the last 512 bytes to find conectix.
Parents matter qemu-img ignored the parent of diff.vhd, while 7-Zip and libvhdi used it.
Fields can mislead Every VHD file we made says Wi2k as host operating system, even though we worked on Linux.

Read the study with care. It shows what five readers do with 5 VHD files, and 3 of them are ours. The two public files are empty. We tested nothing in Windows, Hyper-V, VirtualBox or VMware, so readers that agree on our VHD files can still fail on yours.

What Do Readers Do With a Damaged VHD File? 24 broken copies, three decoders and 18 split decisions

We damaged our VHD files in 24 ways. Three decoders returned intact data for the same 3 copies and split on 18. In 3 copies all three returned other data. 7-Zip refused none of the 24, while qemu-img and libvhdi opened 9 apiece.

The 24 damaged copies come in six groups. Group A changes the fixed VHD file, B the footers of the dynamic VHD file and C its header and table. D cuts the dynamic file and E breaks the parent of the differencing file. Group F is a raw disk, a VHDX file and a disk with a zeroed first sector.

Every copy changes one thing. We asked two questions about every one of them.

Did a decoder open it? Did it return the same data as the intact disk? For qemu-img and libvhdi we compared SHA-256 hashes of the 16 MiB disk they returned. For 7-Zip we compared the three files it extracted. The second question is the strict one.

Grid of 24 damaged copies of VHD files against five readers: the file command, qemu-img, 7-Zip, libvhdi and our check script. The three decoders agreed on the intact data for 3 copies and split on 18.
Figure 4. 24 damaged copies and five readers. An amber band marks a split between the three decoders.

The 3 copies every decoder read the same

B4 changes the footer checksum at the end of the dynamic VHD file. B5 changes the time stamp in the start copy and repairs its checksum, so the copies disagree. C2 changes the header checksum. All three decoders returned intact data from all three copies.

Our script flagged all three, and the file command still named them VHD files. Flags from strict checks are no proof that data is lost. They show that VHD files differ from what writers made.

Fixed VHD files are checked more strictly. A3 changes the footer checksum of the fixed file. qemu-img refused it with the message Incorrect header checksum, while 7-Zip and libvhdi returned the intact disk.

The copies that gave other data

In 8 copies no decoder returned intact data. C3 sets every table entry to ffffffff, and C5 zeroes the table. All three decoders opened both copies and wrote other data. C3 reads as an empty disk, and every entry of C5 points at the start of the file.

F3 zeroes the first sector of the disk inside the fixed VHD file. Its footer is intact, so all three decoders opened it and returned a disk without a partition table. Our script printed OK, because it checks wrappers and not disks. The file command printed data.

D1 and D3 cut the dynamic VHD file to half and to 4,096 bytes. qemu-img and libvhdi refused both, but 7-Zip opened both and wrote other data. C4 points entry 0 past the end of the file, and it got the same three answers.

E1 removes the parent of the differencing VHD file, and E2 swaps in a parent with another identifier. qemu-img and 7-Zip opened both and wrote other data. libvhdi refused both, and its message for E2 names a mismatch in the identifier.

These are quiet failures, because copies open and data is wrong. In all 8 copies, at least one decoder opened the VHD file and returned other data.

What one decoder reads that others refuse

7-Zip refused none of the 24 copies. It returned intact data from 16, including all 6 fixed copies. When the VHD structure fails, it falls back to reading the file as a raw disk. Its type check printed MBR and FAT for A1, A5 and F1, FAT with errors for B3 and C1, and VHDX for F2.

That fallback explains why 7-Zip returned the three files from 9 of the 12 copies that qemu-img and libvhdi both refused. They are A1, A2, A4, A5, A6, B3, C1, D2 and F1. For the other 3, C4, D1 and D3, it returned other data.

qemu-img reads the start copy of the footer and libvhdi reads the end footer. So B1, with its end footer cut off, was read by qemu-img and 7-Zip but not by libvhdi. B2, with its start copy zeroed, was read by libvhdi and 7-Zip but not by qemu-img.

libvhdi also opens VHDX files. It returned the intact disk from F2, a VHDX file named .vhd, while qemu-img refused it as a VHD file. When we told qemu-img the file was VHDX, it returned the same hash.

Where the file command and our script stand

The file command named 13 copies VHD files. For the other 11 it printed a boot sector, a VHDX name or data. Sleuth Kit listed files in 13 copies, some through libvhdi and some through its fallback to a raw read. Neither check says whether data is right.

Our script flagged 23 of 24 copies and passed only F3, whose disk sector is zero. It also flagged B4, B5 and C2, which all three decoders read. Flags mean checks failed. Passes mean wrappers are sound, and they do not mean disks are healthy.

Decoders differ Three decoders agreed on intact data for 3 of 24 copies and split on 18. Use two readers on VHD files you care about.
Fallbacks help 7-Zip returned the three files from 9 of the 12 copies that qemu-img and libvhdi both refused.
Opened is not intact In 8 copies no decoder returned intact data, and at least one opened the VHD file anyway.
Flags are prompts Our script flagged 23 of 24 copies, including 3 that all decoders read. Treat flags as reasons to look.

Read the grid with care. Every copy changes one thing in a file made by qemu-img, or in our differencing file. Damage in the wild changes many things at once. Same data means a hash matched the intact disk. We opened no copy in Windows or Hyper-V.

What Does Our Expert Say About VHD Files? A note from Neeraj Singh on trusting one reader

Check VHD files with two readers before you trust one answer. Three decoders agreed on intact data for 3 of 24 damaged copies, and 8 copies opened with other data. Footers take seconds to read, and second readers take little longer.

Neeraj Singh

Expert insight

“A VHD file is a disk in a file, and its wrapper and the data inside fail separately. In our tests three decoders returned intact data for only 3 of 24 damaged copies, and 8 copies opened with wrong data. Check the footer first, then read VHD files with two tools before you trust one answer.”

Neeraj Singh Manager, Tech Support & Operations 19+ years fixing Windows and system errors

Why one reader proves little

Readers that open VHD files show only that they could return something. They do not show that data is complete or that another reader agrees. In our tests qemu-img opened diff.vhd and wrote almost nothing, and 7-Zip opened 24 of 24 copies.

Checks have limits. Two readers that agree can both be wrong, and neither says whether the files inside are right. The script from the check reads the footer, the header and the table, so compare its answer with a second reader and look at your files.

Copy your VHD file before you open it. Work on the copy and keep the original untouched. Microsoft says Mount-DiskImage mounts VHD files in read and write mode unless you add the read only access value, so mounted disks can change.

How Do You Open a VHD File? Windows tools from Microsoft, three readers we tested and two outside pages

Open VHD files in Windows with Disk Management or with Mount-DiskImage, and expect to need administrator rights, per Microsoft. On Linux, qemu-img, 7-Zip and libvhdi opened our healthy VHD files. We opened no files in Windows, so we say nothing about those tools beyond what Microsoft lists.

The table lists programs we tested and ones Microsoft and Wikipedia name. Readers with version numbers are the ones we tested. We worked on Linux, so we opened no VHD files in Windows apps.

Looking for a VHD file opener? Every program in the table counts as one. Disk Management comes built into Windows. Our short post on how to open a VHD file in Windows and on Linux lists the steps in order.

Programs that open VHD files
Program What it does
Disk Management Search for Disk Management with Administrator permissions, then choose Action and Attach VHD. Microsoft says accounts must be in the Backup Operators or Administrators group. We did not test it.
Mount-DiskImage A PowerShell command that mounts VHD files so they appear as normal disks. Microsoft says it needs administrator privileges. We did not test it.
Hyper-V Microsoft Learn names Hyper-V, Virtual Server and Windows Virtual PC as products that use VHD files as boot disks of virtual machines. We did not test them.
7-Zip Version 23.01. Wikipedia says 7-Zip can open VHD files. It opened all 5 healthy VHD files and all 24 damaged copies, and returned intact data from 16 of the 24.
qemu-img Version 8.2.2. It reads VHD files when you give it -f vpc. It opened all 5 healthy VHD files and 9 of the 24 damaged copies.
libvhdi Version 20260901 through its Python module. It reads dynamic and differencing VHD files, and opens VHDX files too. It opened all 5 healthy VHD files and 9 of the 24 damaged copies.
The file command Version 5.45. It names the kind from the footer, but cannot spot fixed VHD files, which start with the raw disk.
Our script A 50 line Python script that reads the footer, the header and the table. It passed all 5 healthy VHD files and flagged 23 of 24 damaged copies.
Sleuth Kit Version 4.12.1. Its fls command lists files in disks. It uses libvhdi, falls back to a raw read and could not find the parent of diff.vhd.

Open VHD files in Windows

Microsoft gives four steps for Disk Management. Open it with Administrator permissions. Expand the Action menu and select Attach VHD. In the dialog, select Browse, locate your .vhd or .vhdx file and select OK. The page calls .vhdx the recommended type.

Microsoft documents the mount command too. It makes virtual hard disks and ISO files appear as normal disks. VHD files mount in read and write mode unless you set the access value to ReadOnly, and the type comes from the ending unless you set the storage type.

Mount a VHD file read only in PowerShell
Mount-DiskImage -ImagePath "C:\VMs\disk.vhd" -Access ReadOnly
Dismount-DiskImage -ImagePath "C:\VMs\disk.vhd"

We used neither command, because we had no Windows machine. Use ReadOnly when you want to look and not change, because the default is read and write.

Open VHD files on Linux

Three ways to name a VHD file
file -b dynamic.vhd
Microsoft Disk Image, Virtual Server or Virtual PC, Creator qem2 5.3 (W2k) Wed Oct 28 11:34:06 2026
qemu-img info dynamic.vhd
image: dynamic.vhd
file format: vpc
virtual size: 16 MiB (16777216 bytes)
disk size: 48 KiB
cluster_size: 2097152
7z l -slt dynamic.vhd (abridged)
Type = VHD
Physical Size = 2100224
Cluster Size = 2097152
Method = Dynamic
Creator Application = qem2 5.3
Host OS = Windows
Type = MBR
Physical Size = 16777216
Type = FAT
Physical Size = 15728640
Cluster Size = 4096

All three agree. The file command names the kind and the creator. qemu-img calls the VHD format vpc and prints a virtual size of 16 MiB and a disk size of 48 KiB. 7-Zip prints type VHD, method Dynamic and the creator, and lists the MBR and the FAT volume inside.

Read the data two ways
7z x dynamic.vhd -oout_dyn
ls -l out_dyn | awk '{print $5, $9}'
3000 data.bin
48 notes.txt
12 readme.txt
qemu-img convert -f vpc -O raw dynamic.vhd back.raw
sha256sum base.raw back.raw | cut -c1-12
4408d871de1c
4408d871de1c

7-Zip wrote the three files at 3,000, 48 and 12 bytes. qemu-img wrote the raw disk, and the first 12 characters of its hash, 4408d871de1c, match the hash of the original disk. Add -f vpc whenever your file is a fixed VHD file.

Open VHD files with Python

The libvhdi project ships a Python module named pyvhdi. It opens VHD files, reports disk sizes and kinds, and reads disks. Kinds use the same numbers as byte 60 of the footer.

Open a VHD file with pyvhdi
import pyvhdi
f = pyvhdi.file()
f.open('dynamic.vhd')
print(f.get_media_size(), f.get_disk_type())
16777216 3

The first number is the disk size and the second is the kind, where 3 means dynamic. Differencing VHD files need their parents, so we opened the parent too and called the set_parent function before we read. libvhdi refused 15 of 24 damaged copies, so read its answers with care. The copies it refused are listed in the grid.

Viewers and recovery tools for VHD files

These two links open outside pages. One is a viewer from FreeViewer and one is a recovery program from SysTools. We describe them from their own pages and tested neither.

FreeViewer VHDX & VHD Viewer

Opens and previews VHD and VHDX files

Viewer

SysTools Hyper-V Recovery

Recovers data from VHD and VHDX files

Recovery

The FreeViewer page describes a viewer that opens and previews VHDX and VHD files. It says the free version cannot save files to the desktop, and that the Pro version adds saving copies from corrupted VHDX files. The page does not mention differencing VHD files.

The SysTools Hyper-V Recovery page describes software that recovers data from VHD and VHDX files, including deleted, formatted and corrupt disks. It says the program extracts data and does not repair files, and that the demo version only previews. It does not mention differencing VHD files either. We list no prices, because they change.

Install programs from their makers. Download programs from the maker's own page, and write down the hash of your VHD file before you open it. Wikipedia and Microsoft both list built in ways to open VHD files, so try those first.

How Do You Check a VHD File? Six steps, and only the last two read the data

Check VHD files in six steps. Read the last 512 bytes and the first 512 bytes, then the header and table with our 50 line script. Only decoders return data. The script passed all 5 healthy VHD files and flagged 23 of 24 damaged copies.

First reads need no Python. The tail command prints the end of files and xxd prints bytes. For fixed.vhd they show the footer at the end, where fixed VHD files keep it.

Step 2 on the fixed file
tail -c 512 fixed.vhd | xxd -l 96
00000000: 636f 6e65 6374 6978 0000 0002 0001 0000  conectix........
00000010: ffff ffff ffff ffff 3274 9a2e 7165 6d32  ........2t..qem2
00000020: 0005 0003 5769 326b 0000 0000 0100 0000  ....Wi2k........
00000030: 0000 0000 0100 0000 ffff 10ff 0000 0002  ................
00000040: ffff e56d 4da8 bae7 0dd4 4785 b52d 6716  ...mM.....G..-g.
00000050: d955 13fe 0000 0000 0000 0000 0000 0000  .U..............

Read the first line from the left. Bytes 0 to 7 spell conectix. Bytes 16 to 23 are ff, because nothing follows fixed VHD files. Bytes 60 to 63 read 00 00 00 02, the code for fixed. The checksum is ff ff e5 6d.

Step 4 uses our script. It reads both ends of VHD files and then reads the rest.

Check VHD files with Python

The script reads the first and last 512 bytes and looks for conectix in either. It checks the footer checksum. For fixed VHD files it checks that the size is the disk size plus 512 bytes and that the footer is last.

For dynamic and differencing VHD files it checks that both footers match, reads the cxsparse header and its checksum, and checks that no table entry points outside the file. For differencing files it also looks for the parent beside the child and compares its identifier.

It prints OK or FLAG, the kind and the disk size. It never changes files.

Check the footer, the header and the table of a VHD file
import os, struct, sys

def total(b, skip):  # one's complement of the byte sum, checksum field left out
    return ~(sum(b[:skip]) + sum(b[skip + 4:])) & 0xFFFFFFFF

def peek(path):
    f = open(path, 'rb')
    size = f.seek(0, 2)
    f.seek(0); head = f.read(512)
    f.seek(max(size - 512, 0)); tail = f.read(512)
    foot = tail if tail[:8] == b'conectix' else head if head[:8] == b'conectix' else None
    if foot is None:
        return 'FLAG', 'no conectix cookie at the start or in the last 512 bytes'
    kind = {2: 'fixed', 3: 'dynamic', 4: 'differencing'}.get(struct.unpack('>I', foot[60:64])[0], 'unknown')
    disk = struct.unpack('>Q', foot[48:56])[0]
    bad = []
    if struct.unpack('>I', foot[64:68])[0] != total(foot, 64):
        bad.append('footer checksum')
    if kind == 'fixed':
        if size != disk + 512 or foot is not tail:
            bad.append('file size is not disk size + 512')
    elif kind in ('dynamic', 'differencing'):
        if head != tail:
            bad.append('start copy and end footer differ or are missing')
        f.seek(struct.unpack('>Q', foot[16:24])[0]); hdr = f.read(1024)
        if hdr[:8] != b'cxsparse':
            bad.append('no cxsparse header')
        else:
            if struct.unpack('>I', hdr[36:40])[0] != total(hdr, 36):
                bad.append('header checksum')
            at, n = struct.unpack('>QI', hdr[16:24] + hdr[28:32])
            f.seek(at); table = struct.unpack('>%dI' % n, f.read(4 * n))
            used = [t for t in table if t != 0xFFFFFFFF]
            if any(t * 512 < at + 4 * n or t * 512 >= size for t in used):
                bad.append('table entry outside the file')
            elif not used and size > at + 4 * n + 65536:
                bad.append('table empty but the file has more data')
            if kind == 'differencing':
                name = hdr[64:576].decode('utf-16-be').rstrip('\0')
                parent = os.path.join(os.path.dirname(os.path.abspath(path)), name)
                if not os.path.exists(parent):
                    bad.append('parent %s not found' % name)
                else:
                    pf = open(parent, 'rb'); pf.seek(-512, 2)
                    if pf.read(512)[68:84] != hdr[40:56]:
                        bad.append('parent id does not match')
    return ('FLAG' if bad else 'OK'), '%s, %d byte disk%s' % (kind, disk, ', ' + '; '.join(bad) if bad else '')

for p in sys.argv[1:]:
    print(*peek(p), os.path.basename(p), sep=' | ')

Here is what it printed for four healthy VHD files. They are fixed.vhd, dynamic.vhd, the differencing child diff.vhd and the Hyper-V file.

Four healthy files
python3 vhd_peek.py fixed.vhd dynamic.vhd diff.vhd hyperv2012r2-dynamic.vhd
OK | fixed, 16777216 byte disk | fixed.vhd
OK | dynamic, 16777216 byte disk | dynamic.vhd
OK | differencing, 16777216 byte disk | diff.vhd
OK | dynamic, 136365211648 byte disk | hyperv2012r2-dynamic.vhd

Every answer starts with OK or FLAG, then the kind, the disk size and the file name. The Hyper-V file reports a disk of 136,365,211,648 bytes, although the file is only 266,240 bytes long.

Four damaged copies
python3 vhd_peek.py A1_footer_cut.vhd B2_start_copy_zeroed.vhd C3_table_empty.vhd F3_first_sector_zeroed.vhd
FLAG | no conectix cookie at the start or in the last 512 bytes | A1_footer_cut.vhd
FLAG | dynamic, 16777216 byte disk, start copy and end footer differ or are missing | B2_start_copy_zeroed.vhd
FLAG | dynamic, 16777216 byte disk, table empty but the file has more data | C3_table_empty.vhd
OK | fixed, 16777216 byte disk | F3_first_sector_zeroed.vhd

A1 is the fixed file with its footer cut off, so the script finds no conectix mark. B2 has its start copy zeroed, so the two footers differ. C3 has every table entry set to ffffffff, yet the file has more data than an empty disk needs. F3 passes, because its footer is sound and only one disk sector is zero.

What the script found in our files

Our script on healthy and damaged VHD files
Result Cases
Passed (5 of 5 healthy files) Both ends agree, checksums match, sizes fit the kind and tables point inside the file. It also passed the two files from Windows tools.
Flagged (23 of 24 damaged copies) Every group has flags. Footers in groups A and B, header and table in C, cuts in D, parents in E and the raw disk and VHDX file named .vhd in F.
Passed (F3) Its footer is sound and only the first sector of the disk is zero. The script does not read disks, and all three decoders returned other data.
Flagged, decoders agree (B4, B5, C2) All three decoders returned intact data. The script flagged a checksum or a footer copy that differs from its twin.
Parent checks (E1, E2) It flagged E1 because the parent is missing and E2 because the parent id does not match. qemu-img and 7-Zip opened both and wrote other data.

The script has limits. It does not read file systems inside disks, so it passes F3. It does not repair anything. The 18 split decisions show where decoders disagree about data.

Check order for any VHD file

  1. Copy your VHD file, write its SHA256 hash and work on the copy.
  2. Read the first 8 bytes and the last 512 bytes. The text conectix must start one of them, and fixed VHD files have it only at the end.
  3. Name the kind with the file command and qemu-img info -f vpc. Fixed VHD files print as boot sectors, so do not stop there.
  4. Read the footer, header and table with our script. A flag names the part where your file stops making sense.
  5. Read data with two decoders, as in the Linux commands and the Python example, and compare files. Only this step reads data.
  6. Mount your disk read only in Windows and look at its files. Sound wrappers can pass every step above and still contain wrong disks, as F3 did.

Is a VHD File Safe to Open? A disk can contain anything, and the name proves nothing

VHD files are disks, so they can contain anything disks contain. Attaching one in Windows makes its files appear as a drive. Open VHD files from unknown senders with care. Names prove nothing, and headers of differencing VHD files store their parent names.

We attached no files in Windows, and we scanned none for malware. Our readers only read bytes and extract files. Our disks contain three small test files, so their contents are not the worry here.

Microsoft Learn says virtual disks made with the VHD API can work as boot disks. It says disks can contain file systems, and it names NTFS, FAT, exFAT and UDFS. So treat VHD files from strangers like disks from strangers.

Reading footers and headers Safe. Our script only reads bytes.
Writing down hashes Safe, and it shows which VHD file you received.
Attaching files in Windows Their files appear as drives. Microsoft says Mount-DiskImage mounts in read and write mode unless you set read only access. We attached no files.
Moving parents or children Children need their exact parents. E1 and E2 opened in some decoders with other data. Keep both files together and do not edit parents.
Trusting names Files named .vhd can be raw disks or VHDX files, as F1 and F2 show.
Sharing disk images unread Footers name programs and dates, and differencing headers name parent paths. VHD files store sectors, so they can contain deleted files. We did not test that.

The rename test

We gave two files the ending .vhd. F1 is a raw disk, and the file command printed a boot sector. F2 is a VHDX file, and the file command printed Microsoft Disk Image eXtended. 7-Zip returned the three files from both.

libvhdi refused F1 and returned the intact disk from F2, because it opens VHDX files. qemu-img refused both as VHD files. So the ending told no reader what the file was, and the first bytes did.

FileInfo lists VHDL source files with the same ending, which are text files. If your file manager hides endings, read the first bytes of anything you doubt. VHD files have conectix in their first or last 512 bytes.

What footers reveal

Footers store the creator, its version, the host operating system and a time stamp. In dynamic.vhd that reads qem2 5.3, Wi2k and 28 October 2026, and the file command prints the creator and date. The Hyper-V file reads win 6.3 and 19 February 2016.

Headers of differencing VHD files store the name and path of their parent. Children you share can show folder names from your machine. Read your file with the check script before you send it.

Mounting and changing disks

Attaching VHD files in Windows makes them drives, and Microsoft says the disk icon is colored blue in Disk Management. The mount command uses read and write mode unless you ask for read only access. Mounted disks can change, so work on copies.

Not sure? Check it first. Copy the hash, read your VHD file with our six step check and compare a second reader. If your VHD file arrived from someone you do not know, do not attach it on a machine you care about. Ask the sender about it through another route.

Why Will Your VHD File Not Open? Eight causes, and what to do about every one

Most VHD files that will not open fail for one of eight reasons. Read the first 8 bytes and the last 512 bytes first, then the header and table, then data. Three decoders agreed on intact data for 3 of 24 damaged copies, and 8 copies opened with other data.

We read 5 healthy VHD files and 24 damaged copies with five readers. The table groups what we saw into eight causes. Numbers in brackets match causes.

Every row says what happens to your VHD file and what to try. Fixes work on copies, and none changes the original. Readers that say nothing are no sign that disks are complete.

Eight causes of VHD files that will not open
Cause Result and fix
A fixed file with a bad footer (1) A1, A2, A4 and A6 cut, change or zero the footer of the fixed VHD file, or add 512 zero bytes after it. qemu-img and libvhdi refused all four, while 7-Zip returned intact files. Fix: Write the raw disk as a new fixed VHD file, or drop the last 512 bytes first. Commands are in the repair list.
A footer copy that is cut or zeroed (2) B1 cuts the end footer, B2 zeros the start copy and B3 zeros both. qemu-img read B1 and libvhdi read B2, and only 7-Zip read B3. Fix: Copy a good footer over a bad one, or borrow a footer from a new VHD file of the same size. See the repair commands.
A checksum or time stamp that differs (3) A3, B4, B5 and C2 change a checksum or one copy of the footer. All three decoders read B4, B5 and C2 the same. Only qemu-img refused A3, with the message Incorrect header checksum. Fix: 7-Zip and libvhdi need none. For qemu-img, drop the last 512 bytes of A3 and convert it as for A2.
A damaged header or table (4) C1 changes the cxsparse cookie, and C3, C4 and C5 break the table. All three decoders opened C3 and C5 and wrote other data. Fix: If only the 8 byte cookie is wrong, write it back, as the repairs below show. For damaged tables, ask for new copies. We tested no table repair.
A cut file (5) A5, D1, D2 and D3 are cut copies. qemu-img and libvhdi refused D1, D2 and D3. 7-Zip returned intact files from A5 and D2, and other data from D1 and D3. Fix: Compare size and hash with the source, then copy your VHD file again. We tested no repair.
A differencing file without its parent (6) E1 removes the parent and E2 swaps in a parent with another identifier. qemu-img and 7-Zip opened both and wrote other data, while libvhdi refused both. Fix: Put the exact parent beside the child. Our healthy diff.vhd opened that way in 7-Zip and libvhdi.
A file that is not a VHD file (7) F1 is a raw disk and F2 is a VHDX file, both named .vhd. The file command named the VHDX file. Fix: Read the first bytes. Read F2 as VHDX, and qemu-img returned the same hash. Raw disks need no repair.
A bad disk inside (8) F3 zeroes the first sector of the disk inside a sound wrapper. All three decoders opened it and returned other data, and our script passed it. Fix: None from us. Ask for a new copy, or try a partition recovery tool on a copy of the disk. We tested no repair.

Repairs we tested

We repaired 9 of 24 damaged copies with commands, and F2 by reading it as VHDX. After every repair, qemu-img, 7-Zip and libvhdi returned intact data and our script printed OK. The commands below are the ones we used, with short file names.

Nine repairs on copies of our files
# A1  fixed file, footer cut off
qemu-img convert -f raw -O vpc -o subformat=fixed,force_size=on A1.vhd A1_fixed.vhd
# A2, A3, A4  fixed file, bad footer
head -c -512 A2.vhd > A2.raw
qemu-img convert -f raw -O vpc -o subformat=fixed,force_size=on A2.raw A2_fixed.vhd
# A6  fixed file, 512 zero bytes added
head -c -512 A6.vhd > A6_fixed.vhd
# B1  dynamic file, end footer cut off
head -c 512 B1.vhd > footer.bin
cat footer.bin >> B1.vhd
# B2  dynamic file, start copy zeroed
tail -c 512 B2.vhd > footer.bin
dd if=footer.bin of=B2.vhd bs=512 count=1 conv=notrunc
# B3  both footers zeroed, borrow a footer from a new file of the same size
qemu-img create -f vpc -o subformat=dynamic,force_size=on donor.vhd 16M
head -c 512 donor.vhd > donor.bin
dd if=donor.bin of=B3.vhd bs=512 count=1 conv=notrunc
dd if=donor.bin of=B3.vhd bs=512 seek=$(( $(stat -c %s B3.vhd) / 512 - 1 )) count=1 conv=notrunc
# C1  header cookie changed
printf 'cxsparse' | dd of=C1.vhd bs=1 seek=512 conv=notrunc

Borrowed footers work when donors have the same disk size, the same kind and a data offset of 512, like our donor. They would not work for differencing VHD files, whose footers name a parent.

Check VHD files that will not open, step by step

We tested the steps on Python 3.13 and Linux. We opened no VHD files in Windows, and the steps keep originals untouched at every point.

  1. Copy your VHD file, write its SHA256 hash and work on the copy.
  2. Read the first 8 bytes and the last 512 bytes with the check order. The text conectix must start one of them.
  3. Read the footer, header and table with our check script. A flag names the part where your file stops making sense.
  4. Read data with 7-Zip and qemu-img, as in the commands for Linux, and compare files.
  5. If one reader refuses your VHD file, try another before you decide, as the grid of 24 copies shows in the damage results. 7-Zip refused none of them.
  6. If your VHD file is smaller than its source says, copy it again and compare hashes.
  7. Mount the disk read only in Windows and look at its files.

What to send a helper

Short messages about VHD files get faster answers. Include the details below and add the script output. Its first line gives OK or FLAG, the kind and the disk size.

A message that gets an answer
Subject: VHD file will not open
File: name, size in bytes and SHA256 hash
Check: the output of vhd_peek.py
Kind: fixed, dynamic or differencing, from byte 60 of the footer
Reader: name, version and the exact words of the error
Source: where the VHD file came from and when it was copied

What no step can fix

Cut dynamic files No decoder returned intact data from D1 or D3. Ask for new copies or look for backups. We tested no repair tool.
Broken tables If tables are empty or zeroed, data is out of reach for the three decoders. All three opened C3 and C5 and wrote other data.
Strict readers qemu-img and libvhdi refused 15 copies apiece. One refusal is no proof that VHD files are lost, because 7-Zip returned intact data from 9 copies that both refused.
Files of another type Read the first bytes and open them as the type they are.
Wrong endings Files named .vhd can be VHDX files. Read as VHDX, F2 returned the intact disk.

Do not try online repair sites. Sites that offer to fix or convert any VHD file for free can keep your upload, and disks can contain private files. Footers also name programs and dates, as the privacy check shows. Try the steps above on a copy first.

How Do You Convert a VHD File to VHDX or Raw? One disk, six formats and the same hash every time

qemu-img wrote our 16 MiB disk as a fixed VHD file, a dynamic VHD file, VHDX, VMDK, VDI and qcow2, and all six converted back to the same raw disk. Its hash started with 4408d871de1c every time. File sizes ranged from 196,608 to 16,777,728 bytes.

We converted one raw disk of 16 MiB with qemu-img 8.2.2. It contains one FAT16 partition and three files. After every round trip we compared the SHA-256 hash of the raw disk with the original.

File sizes in bytes after converting one disk six ways
Format Bytes Starts with
Raw disk 16,777,216 A boot sector, with no mark
Fixed VHD 16,777,728 A boot sector, with the footer last
Dynamic VHD 2,100,224 The text conectix
VHDX 16,777,216 The text vhdxfile
VMDK 196,608 The letters KDMV
VDI 2,098,176 The text <<< QEMU, with 7f 10 da be at byte 64
qcow2 458,752 The letters QFI and fb, 51 46 49 fb

No format wins every row. VMDK was smallest at 196,608 bytes, and fixed VHD files were largest at 16,777,728. Sizes are no ranking, because our disk is almost empty and dynamic formats store only blocks that contain data.

First bytes differ, and that is how you separate formats. Dynamic VHD files start with conectix, while fixed VHD files start with a boot sector, like the raw disks they wrap.

Convert VHD files with qemu-img

One command writes every format, and the last command lists sizes, which match the table. Add -f vpc when your source is a VHD file, and -O raw to get raw disks back.

Six conversions of one disk
qemu-img convert -f raw -O vpc -o subformat=fixed,force_size=on base.raw fixed.vhd
qemu-img convert -f raw -O vpc -o subformat=dynamic,force_size=on base.raw dyn.vhd
qemu-img convert -f raw -O vhdx base.raw disk.vhdx
qemu-img convert -f raw -O vmdk base.raw disk.vmdk
qemu-img convert -f raw -O vdi base.raw disk.vdi
qemu-img convert -f raw -O qcow2 base.raw disk.qcow2
ls -l fixed.vhd dyn.vhd disk.* | awk '{print $5, $9}'
458752 disk.qcow2
2098176 disk.vdi
16777216 disk.vhdx
196608 disk.vmdk
2100224 dyn.vhd
16777728 fixed.vhd

Every conversion read base.raw and left it untouched. The VMDK page and the VDI page cover files from the last four commands.

Convert VHD files in Windows

Microsoft documents the Convert-VHD command in the Hyper-V module. It reads formats from endings, .vhd or .vhdx, copies data to a new disk and accepts types Fixed, Dynamic and Differencing. Microsoft says conversion is an offline operation, so disks must not be attached.

Two examples from the Microsoft page
Convert-VHD -Path c:\test\testvhd.vhd -DestinationPath c:\test\testvhdx.vhdx
Convert-VHD -Path c:\test\child1vhdx.vhdx -DestinationPath c:\test\child1vhd.vhd -VHDType Differencing -ParentPath c:\test\parentvhd.vhd

We did not use them. The second example converts a differencing VHDX file to a VHD file and names the parent with the parent path value.

A size trap with qemu-img

qemu-img fits sizes of VHD files to a disk geometry. A dynamic disk of 8 MiB came out at 8,390,656 bytes, which is 2,048 bytes bigger, until we added force_size=on. Every VHD file we made uses that option, so sizes on this page match the disks we meant.

Fixed files The disk plus a footer of 512 bytes. Ours took 16,777,728 bytes.
Dynamic files Only blocks with data. Ours took 2,100,224 bytes.
Back to raw All six formats converted back to a raw disk with the same hash.
Mind the geometry Without force_size=on, an 8 MiB disk grew by 2,048 bytes.

Keep the original file. Convert from your VHD file and keep it. Compare hashes of converted disks with the source, as we did, before you delete anything.

How Does a VHD File Differ From VHDX, VMDK and VDI Files? The first bytes name the type

First bytes name the type. Dynamic VHD files start with conectix, VHDX files with vhdxfile, VMDK files with KDMV and qcow2 files with QFI. Fixed VHD files and raw disks both start with a boot sector. The ending names none of them.

Seven kinds of disk image get mixed up because all of them store a disk. The table lists what separates them. Every row ends with its source.

VHD, VHDX, VMDK, VDI, qcow2 and raw disks compared
Type What separates it
Fixed VHD file Starts with the raw disk, so the first bytes are a boot sector. The footer is in the last 512 bytes. The file command printed DOS/MBR boot sector. Source: Our tests.
Dynamic VHD file Starts with 63 6f 6e 65 63 74 69 78, the text conectix, and ends with the same 512 bytes. Source: Our tests.
VHDX file Starts with the text vhdxfile. Wikipedia says it arrived with Windows 8 and Windows Server 2012 and allows disks up to 64 TB. Our file is 16,777,216 bytes. Source: Wikipedia and our tests.
VMDK file Starts with the letters KDMV, as in our 196,608 byte file from qemu-img. Source: Our tests.
VDI file Starts with a line of text. qemu-img wrote <<< QEMU VM Virtual Disk Image >>>, with 7f 10 da be at byte 64. Source: Our tests.
qcow2 file Starts with 51 46 49 fb, the letters QFI and fb. Our file is 458,752 bytes. Source: Our tests.
Raw disk image Has no mark at all. First bytes are a boot sector. Our F1 copy was a raw disk named .vhd. Source: Our tests.

VHD or VHDX

Microsoft calls .vhdx the recommended type in Disk Management. Wikipedia says VHDX arrived with Windows 8 and Windows Server 2012 and allows disks up to 64 TB, against 2,040 GB for dynamic VHD files.

Readers treat them differently. qemu-img refused our VHDX file named .vhd when we asked for VHD, and read it as VHDX. libvhdi opened it either way, and 7-Zip printed type VHDX. The conversions show the VHDX file we made.

Separate them with our script

Our script looks for conectix at both ends. For VHDX files and raw disks named .vhd, it prints FLAG and says it found no conectix cookie. It names the kind of every VHD file that has one, and it never guesses.

Why the ending misleads

We gave two files the ending .vhd, a raw disk and a VHDX file. The file command named the VHDX file and called the raw disk a boot sector. FileInfo lists a third use of the ending, VHDL source files. Endings are labels, and first bytes say what files are.

Which one do you have

Disk images Read the disk image page for the idea of a disk in a file, and the DD file page for raw copies.
VirtualBox or VMware disks Read the VDI file page for VirtualBox and the VMDK file page for VMware.
Forensic images Read the E01 file page for evidence images that store disks the way VHD files do.
Floppy or Mac images Read the IMA file page for floppy images and the DMG file page for Mac disk images.

What Is the VHD File Format Made Of? The facts we could check, and where they came from

Connectix built the VHD format, and Microsoft bought the company and documents the format. Facts below come from Microsoft, Wikipedia and FileInfo, from libvhdi documentation and from our checks of 5 healthy VHD files and 24 damaged copies.

Facts about the VHD file format
Part What we could check
Maker Microsoft, per FileInfo and Microsoft Learn. Wikipedia says Connectix built the format for Virtual PC, and Microsoft bought Connectix in 2003.
Name Virtual Hard Disk. Wikipedia lists the media types application/x-vhd, application/x-vhd-disk and application/x-virtualbox-vhd. We did not check IANA.
First bytes The text conectix at byte 0 of dynamic and differencing VHD files, and in the last 512 bytes of every VHD file. The libvhdi documentation and our files agree.
Structure A footer of 512 bytes. Dynamic and differencing VHD files add a footer copy, a header of 1,024 bytes with the cookie cxsparse and a block table. Their data blocks start with a bitmap of 512 bytes. Numbers are stored high byte first.
Sizes From 3 MB. Dynamic and differencing VHD files stop at 2,040 GB, per Microsoft Learn. Our blocks were 2,097,152 bytes in every file, including the two from Windows tools.
Kinds Byte 60 of the footer reads 2 for fixed, 3 for dynamic and 4 for differencing. We read 2 and 3 in files made by qemu-img and 4 in our own differencing file.
Specification Microsoft lists VHD Specifications, version 1.0, on its Download Center as a Word file of 181 KB. We did not open it.
Related types VHDX arrived with Windows 8 and Windows Server 2012, per Wikipedia. VMDK, VDI and qcow2 are other disk formats we converted to and from.
Risks VHD files are disks. Microsoft says disks made with the VHD API can work as boot disks, and Mount-DiskImage mounts in read and write mode by default.
Our tests 5 healthy VHD files, 24 damaged copies, 6 conversions and one growth test. Three decoders, the file command and a 50 line script all worked on Linux.

About the values we list

Facts about layout come from libvhdi documentation, and we checked first bytes and field offsets against our VHD files. Facts about kinds, sizes and tools come from Microsoft Learn. FileInfo is a directory, so we use it for the developer and the second file type only.

Where we found no record, we say so. We did not check IANA for media types, and we found no PRONOM record for VHD. The date of the specification comes from a file name, and we did not open that document to confirm it.

What we left out

We opened no VHD files in Windows, Hyper-V, VirtualBox or VMware, and we tested no files from Windows 10 or 11. We used neither Microsoft command. We tested no recovery tool, and we scanned no files for malware.

Three of our 5 healthy VHD files are our own, and one of them is a differencing file built by a script and not by Windows. The two public files are empty. Our damaged copies change one thing at a time. We tested one version of every reader, and readers that fail on our files can still work on yours.

Sources checked

For kinds and sizes, see Microsoft Learn on VHD. For attaching files, see the Disk Management page and the mount command page. For conversion, see the Microsoft page for the convert command.

For history, see Wikipedia on the VHD format. For the developer and the second file type, see FileInfo on VHD files. For the specification, see the Microsoft Download Center page. Our byte map follows libvhdi project documentation, and every count came from files and scripts in our research folder.

Frequently Asked Questions About VHD Files

What is a VHD file?

VHD files are virtual hard disks stored in one file. They contain disks with partitions and files, and a footer of 512 bytes names the kind, the disk size and a checksum. Our dynamic VHD file starts with the text conectix and ends with the same 512 bytes.

How do I open a VHD file?

Microsoft lists Disk Management with Attach VHD, a PowerShell mount command and Hyper-V for Windows. We tested qemu-img, 7-Zip and libvhdi on Linux instead. 7-Zip opened all 5 healthy VHD files and all 24 damaged copies, and we opened no VHD files in Windows.

What does VHD stand for?

VHD stands for Virtual Hard Disk. FileInfo lists Microsoft as developer, and Wikipedia says Connectix built the format for Virtual PC. Microsoft Learn calls it a publicly available image format specification.

Is a VHD file safe to open?

VHD files are disks, so they can contain any file disks can. Microsoft says the mount command mounts disks in read and write mode unless you ask for read only access. Copy your file first, and open VHD files from unknown senders with care.

What is inside a VHD file?

Footers of 512 bytes, and for dynamic VHD files footer copies, headers of 1,024 bytes, block tables and data blocks. Our dynamic.vhd is 2,100,224 bytes with one block of 2 MiB. That block contains a partition table, a FAT16 volume and three files.

Can I delete a VHD file?

We did not test deletion, and our sources give no deletion steps. Check which virtual machine or backup uses your VHD file first, because differencing files need their parents. Copy your file and write its hash before you delete anything.

How do I convert a VHD file to VHDX or raw?

Microsoft documents a PowerShell command for VHD and VHDX. We used qemu-img for six formats, and all six converted back to the same raw disk with the same hash. Add the format option when your source is a VHD file.

Why will my VHD file not open?

Eight causes cover what we found. The first four are bad footers on fixed VHD files, bad footer copies, differing checksums and damaged headers or tables. The last four are cut files, missing parents, files of another type and bad disks inside.

What is the difference between VHD and VHDX?

Microsoft calls VHDX the recommended type in Disk Management. Wikipedia says it arrived with Windows 8 and Windows Server 2012 and allows disks up to 64 TB, against 2,040 GB for dynamic VHD files. VHDX files start with the text vhdxfile.

How can I check if a VHD file is damaged?

Read the first 8 bytes and last 512 bytes, then the header and table, then data with two decoders. Our script flagged 23 of 24 damaged copies, and three decoders agreed on intact data for only 3 of them.

What are fixed, dynamic and differencing VHD files?

Fixed VHD files are raw disks plus footers, so our 16 MiB disk took 16,777,728 bytes. Dynamic VHD files store only blocks with data and took 2,100,224 bytes. Differencing VHD files store changes and need their parent files.

How big can a VHD file be?

Microsoft Learn sets a minimum of 3 MB for every kind and a maximum of 2,040 GB for dynamic and differencing VHD files. qemu-img made a dynamic file for a 2040G disk in 4,179,968 bytes and refused 2041G. Wikipedia gives 64 TB for VHDX.

Still Stuck With a VHD File? Seven routes out, depending on what went wrong

Your VHD file will not open

Read the first bytes and the footer of your VHD file. The cause table lists what to try in order.

You need another format

The conversion part covers VHDX, VMDK, VDI and qcow2.

Is it a VirtualBox or VMware disk? The page on VDI files covers VirtualBox, and the page on VMDK files covers VMware.

Is it a raw copy of a disk? The page on DD files covers raw copies, and the page on disk image files explains the idea.

Did you look for a database inside the disk? The page on MDF files covers SQL Server data files, which disks can store. 7-Zip and the page on ZIP files cover archives you find in them.

Is it a file type you do not know? Browse the file extension resource library, or send it on the submit a file type page.

Do you need the format facts? Read the format part for the footer, kinds, sizes and sources of VHD files.