So you're considering implementing Hyper-V and are just that little bit befuddled by the .vhdx file format - well search no more. These slides should help you learn the past, the present and the possible future of the format.
2. Hyper-V VM
Hyper-V VM consists following files
Configuration file
○ VMGUID.xml
Running memory file
○ VMGUID.bin
Virtual disk file(s)
○ VMNAME.vhdx
3. VM files
VMGUID.xml
Consists all configuration of VM in xml format
...
<name type="string">Win8</name>
<notes type="string"></notes>
<type_id type="string">Virtual Machines</type_id>
...
<MacAddress type="string">00-15-5D-01-08-76</MacAddress>
...
<controller0>
<drive0>
<pathname type="string">D:Win8.vhdx</pathname>
...
<processors>
<count type="integer">1</count>
...
VMGUID.bin
Created when machine is running, consiste memory map.
Used for save/pause the VM.
4. What is vhdx
vhdx is a file format used by Hyper-V ( Server
2012)
(Earlier with server 2008, it was .vhd)
This is the file formate used by hypervisor (Windows Hyper-V) and Windows
Azure to create virtual disk drive for virtual machines.
5. History
The .vhd format was created by Connectix for
Connectix Virtual PC product
○ Acquired by Microsoft in 2003
Supported by
○ Microsoft Virtual PC
○ Microsoft Virtual Server
○ Hyper-V
○ Oracle VirtualBox
○ Sun xVM
○ VMware ESX
○ VMware Workstation
○ Citrix XenServer
.vhdx over .vhd
○ From Windows 8 & Server 2012 Microsoft modified vhd format to vhdx
6. Types
Fixed size
This type of disk are created with the specified size. Space is allocated
at the time of creation
This gives higher performance
500 GB -
actual
FixedDisk.vhdx (500 GB)
7. Types
Dynamic expanding
Dynamically growing. Space is allocated as required
This gives better space management but slower in performance
500 GB - logical
DynamicDisk.vhdx (500 GB)
50 GB -actual
8. Types
Differencing
It freezes the parent disk and creates delta disk
Used for snapshot purpose
FixedDisk.vhdx (100 GB)
100 GB
DiffDiskA.avhdx (10 GB)
10 GB
DiffDiskAA.avhdx (5 GB)
5 GB
DiffDiskB.vhdx (20 GB)
20 GB
Parent
Parent
Child
Child
Child
9. Features
Maximum size supported is 64 TB.
With VHD it is 2 TB
Block size is 4k
Improved performance
Larger logical sector sizes for a virtual disk up to 4 KB
Large block sizes for a virtual disk up to 256 MB that enables tuning block
size to match the IO
Updated metadata structures
To prevent data loss during power failures
12. .vhdx file layout
Header
1MB -This is first object of file contains following sections
○ File type identifier
Contains a short, fixed signature to identify the file as a VHDX
○ Two headers
Acts as a root of the VHDX data structure tree, providing version
information, the location and size of the log, and some basic file metadata
Only one header is active at a time
VHDX_HEADER
Signature(UINT32) Checksum(UINT32) SequenceNumber(UINT64)
FileWriteGuid(GUID) DataWriteGuid(GUID) LogGuid(GUID)
LogVersion(UINT16) Version(UINT16) LogLength(UINT32)
LogOffset(UINT64) Reserved[4016](UINT8)
○ Two region table
Lists regions, which are virtually contiguous, variable-size, MB aligned
pieces of data within the file
Header Layout
text
File
Identifier
Header
1
Header
2
Region
Table 1
0
KB
64
KB
128
KB
192
KB
256
KB
1MB
Reserved
320
KB
Region
Table 2
13. .vhdx file layout
Log
The log is a single circular buffer stored contiguously at a location that is
specified in the VHDX header
Consists of variable-sized log entries to be written after unexpected
system failure event
Blocks
Payload blocks contain virtual disk payload data.
Sector bitmap blocks contain parts of the sector bitmap
BAT
BAT is a region consisting of a single array of 64-bit values, with an entry
for each block that determines the state and file offset of that block
Metadata Region
MetaData table - Mapping to MetaData items
MetaData items - User metadata and system metadata
14. API for vhdx
C++ API is available to create update .vhdx file.
Virtdisk.h, Virtdisk.dll, Virtdisk.lib
Supported from windows 7 onward
Available calls for .vhdx
AddVirtualDiskParent AttachVirtualDisk
BreakMirrorVirtualDisk CompactVirtualDisk
CreateVirtualDisk DeleteVirtualDiskMetadata
DetachVirtualDisk EnumerateVirtualDiskMetadata
ExpandVirtualDisk GetStorageDependencyInformation
GetVirtualDiskInformation GetVirtualDiskMetadata
GetVirtualDiskOperationProgress GetVirtualDiskPhysicalPath
MergeVirtualDisk MirrorVirtualDisk
OpenVirtualDisk ResizeVirtualDisk
SetVirtualDiskInformation SetVirtualDiskMetadata
15. VDS - Virtual Disk Service
Manages a wide range of storage configurations
From single disk to external storage arrays
Exposes an API (Windows Storage Management API)
16. Usability
Create new disk
Delete disk
Expand disk
Compact disk
Mirror disk
Attach disk
17. Comparison
Comparison with other virtual disk format
VIRTUAL DISK TYPE VHD VHDX VMDK VDI
BUILT BY Microsoft Microsoft VMware Sun Microsystems
MAX SIZE 2TB 64TB 62TB
(2TB before Sep-
2013)
2TB
TYPE - FIXED Yes Yes Yes Yes
TYPE - DYNAMIC Yes Yes Yes Yes
TYPE - DIFFERENCING/DELTA Yes Yes Yes No
MULTIPART No No Yes No
18. Get vhdx file information (GetVirtualDiskInformation)
Expand size (ResizeVirtualDisk)
Example