VHD (file format)
VHD and its successor VHDx are file formats representing a virtual hard disk drive. They may contain what is found on a physical HDD, such as disk partitions and a file system, which in turn can contain files and folders. They are typically used as the hard disk of a virtual machine, are built into modern versions of Windows, and are the native file format for Microsofts hypervisor, Hyper-V.
The format was created by Connectix for their Virtual PC product, known as Microsoft Virtual PC since Microsoft acquired Connectix in 2003. VHDx was introduced subsequently to add features and flexibility missing in VHD that had become apparent over time.
Since June 2005, Microsoft has made the VHD and VHDx Image Format Specifications available to third parties under the Microsoft Open Specification Promise.
Features
A Virtual Hard Disk allows multiple operating systems to reside on a single host machine. This method enables developers to test software on different operating systems without the cost or hassle of installing a second hard disk or partitioning a single hard disk into multiple volumes. The ability to directly modify a virtual machine's hard disk from a host server supports many applications, including:- Moving files between a VHD and the host file system
- Backup and recovery
- Antivirus and security
- Image management and patching
- Disk conversion
- Life-cycle management and provisioning
Supported formats
VHDs are implemented as files that reside on the native host file system. The following types of VHD formats are supported by Microsoft Virtual PC and Virtual Server:- Fixed hard disk image: a file that is allocated to the size of the virtual disk. Fixed VHDs consist of a raw disk image followed by a VHD footer.
- Dynamic hard disk image: a file that at any given time is as large as the actual data written to it, plus the size of the header and footer. Dynamic and differencing VHDs begin with a copy of the VHD footer, and for dynamic or differencing VHDs created by Microsoft products this results in a VHD-cookie string conectix at the beginning of the VHD file.
- Differencing hard disk image: a set of modified blocks in comparison to a parent image. The Differencing hard disk image format allows the concept of Undo Changes: when enabled, all changes to a hard drive contained within a VHD are stored in a separate file. Options are available to undo the changes to the VHD, or to merge them permanently into the VHD. Different child images based on the same parent image also allow "cloning" of VHDs; at least the globally unique identifier must be different.
- Linked to a hard disk : a file that contains a link to a physical hard drive or partition of a physical hard drive.
Advantages
- Ease of deployment: IT organizations can deploy standardized, 'pre-built' configurations on a single VHD. As an example, software engineering organizations that need a specific set of tools for a particular project could simply 'pull' the appropriately-configured VHD from a network location.
- Backup-and-Restore: Changes to the contents of a VHD are easily undone.
- Multi-User Isolation: Many current operating systems support having multiple users, but offer varying degrees of protection between them. By giving each user their own version of the operating system—say, by creating for each of them a differencing VHD based on a base installation of the OS—changes to any particular child image would have no effect on any of the other child images.
Native VHD Boot
Limitations
The VHD format has a built-in limitation of just under 2 TiB for the size of any dynamic or differencing VHDs. This is due to a sector offset table that only allows for the maximum of a 32-bit quantity. It is calculated by multiplying 232 by 512 bytes for each sector.The formula in the VHD specification allows a maximum of sectors. About 127 GiB is also the limit for VHDs in Windows Virtual PC. For fewer than sectors the CHS-value in the VHD footer uses a minimum of and a maximum of heads with sectors per track. The CHS algorithm then determines. The specification does not discuss cases where the CHS value in the VHD footer does not match the CHS geometry in the Master Boot Record of the disk image in the VHD. Microsoft Virtual Server has this limitation using virtual IDE drivers but 2 TiB if virtual RAID or virtual SCSI drivers are used.
Software support
Virtual Hard Disk format was initially used only by Microsoft Virtual PC. Later however, Microsoft used the VHD format in Hyper-V, the hypervisor-based virtualization technology of Windows Server 2008. Microsoft also used the format in Complete PC Backup, a backup software component included with Windows Vista and Windows 7. In addition, Windows 7 and Windows Server 2008 R2 include support for creating, mounting, and booting from VHD files.The Vista drive manager GUI supports a subset of the functions in the diskpart command line tool. VHDs known as vdisk in diskpart can be created, formatted, attached, detached, merged, and compacted. Compacting is typically a two step procedure, first unused sectors in the VHD are filled with zeros,. The virtual machine additions in older VPC versions and the virtual machine integration features in Windows Virtual PC contain precompact ISO images for the first step in supported guest systems.
Third-party products also use VHD file format. Oracle VirtualBox, part of Sun xVM line of Sun Microsystems supports VHD in versions 2 and later. In 2017 Red Gate Software and Windocks introduced VHD based support for SQL Server database cloning.
Offline modification
It is sometimes useful to modify a VHD file without booting an operating system. Hyper-V features offline VHD manipulation, providing administrators with the ability to securely access files within a VHD without having to instantiate a virtual machine. This provides administrators with granular access to VHDs and the ability to perform some management tasks offline. The Windows Disk Management MMC plugin can directly mount a VHD file as a drive letter in Windows 7/Server 2008 and newer.For situations where mounting a VHD within the operating system is undesirable, several programs enable software developers to inspect and modify VHD files, including.NET DiscUtils, WinImage, and R1soft Hyper-V VHD Explorer. 7-Zip supports extraction and inspection of VHD files.
Virtual Floppy Disk (VFD)
Virtual Floppy Disk is a related file format used by Microsoft Virtual PC, Microsoft Automated Deployment Services and Microsoft Virtual Server 2005. A VFD that contains an image of a 720 KB low-density, 1.44 MB high-density or 1.68 MB DMF 3.5-inch floppy disk can be mounted by Virtual PC. Other virtual machine software such as VMWare Workstation and VMware Player can mount raw floppy images in the same way.Windows Virtual PC for Windows 7 does not offer a user interface for manipulating virtual floppy disks; however, it still supports physical and virtual floppy disks via scripting. Under Hyper-V, VFD files are usable through the VM settings for Generation 1 virtual machines. Generation 2 virtual machines do not emulate a floppy controller and do not support floppy disk images.
Virtual Hard Disk (VHDX)
VHDX is the successor format to VHD. Where VHD has a capacity limit of 2040 GB, VHDX has a capacity limit of 64 TB. For disk images with this newer format the filename extensionvhdx
is used instead of vhd
. VHDX protects against power failures and is used by Hyper-V. VHDX can be mounted like VHD.