VHD (file format)
By Microsoft
VHD, or Virtual Hard Disk, is a file format developed by Microsoft, originally created by Connectix, that stores the complete contents of a virtual machine's disk, including its partition structure, file system, and files, as a single file…
Definition
VHD, or Virtual Hard Disk, is a file format developed by Microsoft, originally created by Connectix, that stores the complete contents of a virtual machine's disk, including its partition structure, file system, and files, as a single file on a host system. It lets a virtualization hypervisor treat that file as if it were a physical hard drive, enabling virtual machines to be created, copied, and moved as portable disk images.
Overview
Virtualization needed a way to represent a guest operating system's storage without dedicating a physical disk to every virtual machine, and VHD was created to fill that role by packaging an entire disk's contents into one host file. The format originated with Connectix's Virtual PC product and came to Microsoft when it acquired Connectix in 2003, after which VHD became the standard disk format for Microsoft's virtualization products. Mechanically, a VHD file mirrors the structure of a real disk: it contains a partition table, one or more file system volumes, and metadata describing geometry and disk type, wrapped in a footer that identifies the file to compatible software. VHD supports different allocation modes, including fixed-size disks that reserve their full capacity on the host immediately, dynamically expanding disks that grow as data is written, and differencing disks that store only the changes relative to a parent VHD, useful for snapshots and shared base images. A newer variant, VHDX, extended the format with larger capacity limits, better resilience to unexpected power failures, and support for larger sector sizes. VHD's closest counterpart is VMDK, VMware's equivalent virtual disk format, and the two are not natively interchangeable, though conversion tools exist to move disks between Hyper-V, VMware, and other hypervisors. Compared to VMDK, VHD and VHDX are the native formats for Microsoft's Hyper-V and for Azure virtual machine images, while VMDK is native to VMware's ESXi and Workstation products. In practice, VHD and VHDX files are used to create and distribute virtual machine templates, back up entire system disks for later restoration, and mount as regular drives directly within Windows without needing a hypervisor, since Windows can natively mount VHD files as though they were physical disks. Azure historically used VHD as the underlying format for many virtual machine disk images in its infrastructure. The format's limitations include that older VHD, as opposed to VHDX, caps disk size well below what modern workloads may need, and dynamically expanding disks, while space-efficient, can suffer from fragmentation and slower performance compared to fixed-size disks. Working across hypervisor ecosystems still typically requires explicit conversion between VHD or VHDX and formats like VMDK, adding friction for organizations running mixed virtualization environments. Organizations standardizing on Microsoft's virtualization stack generally treat this as an acceptable trade-off, since native Windows and Hyper-V tooling around VHD and VHDX outweighs the occasional need to interoperate with disk images from other vendors in most day-to-day operational scenarios.
Key Concepts
- Single-file representation of an entire virtual disk's contents
- Fixed, dynamically expanding, and differencing disk allocation modes
- Native support for mounting VHD files directly within Windows
- VHDX successor format with larger capacity and crash resilience
- Standard disk format for Microsoft Hyper-V virtual machines
- Historical use as the base format for Azure virtual machine images
- Descriptor and data structure inherited from Connectix Virtual PC
Use Cases
Frequently Asked Questions
From the Blog
Python File I/O: Reading and Writing Files
Almost every real Python program reads or writes files — logs, configs, CSVs, JSON, reports. This guide covers text files, CSV, JSON, binary files, and the modern pathlib approach, with best practices for safe file handling.
Read More ProgrammingPython File Handling: Read and Write Files
Learn to read and write files in Python using open() and the with statement. Covers text and binary modes, reading line by line, appending, and safe file handling.
Read More ProgrammingUnderstanding Python String Formatting (f-strings)
F-strings are the fastest, most readable way to format strings in Python. Learn how to embed variables, format numbers, align text, and debug with f-string syntax.
Read More ProgrammingUnderstanding Python Modules and Packages
A Python module is a single .py file and a package is a folder of modules. Learn how imports, __init__.py, and namespaces organize larger Python projects.
Read More