This blog is part of a series that started with Windows 8 Storage and Hyper-V Part 1 – Introduction:
http://www.hyper-v.nu/archives/hvredevoort/2012/01/windows-8-storage-and-hyper-v-part-1-introduction/

VHD HISTORY

If you have been working with any of the Microsoft virtualization products, you are familiar with the Virtual Hard Disk format. VHD was introduced with Microsoft’s acquisition of Connectix and their Virtual PC product in 2003.  Seven years ago Microsoft decided to make the VHD Image Format Specification available to third parties under the Microsoft Open Specification Promise.

In June 2005 Microsoft promised that the VHD file format would have a future well beyond the then prevalent virtualization products ….. and boy did they keep their promise!

The Microsoft VHD file format specifies a virtual machine hard disk that can reside on a native host file system encapsulated within a single file. The format is used by Virtual PC 2007, Virtual Server 2005 R2 and Hyper-V and the format will be used by future versions of Microsoft Windows Server that includes hypervisor-based virtualization technology. Beyond that, the VHD format is broadly applicable, because it is agnostic to the virtualization technology, host operating system, or guest operating system with which it is used.

Customers and partners who invest the VHD file format will have a clear path forward to future Windows virtualization technologies. In addition, Microsoft plans to design its systems management tools around the VHD file format for improved patching and manageability.

image

Since the release of Windows 7 and Windows Server 2008 R2, the VHD format became even more versatile when Microsoft promised not only to standardize the variety of container files, but also introduced native VHD. This technology made it very easy to boot from VHD and have multiple operating systems on one machine. Since then VHD’s could not only be created via the Hyper-V manager but also via the inbox Disk Manager and Diskpart. Because the VHD format was opened up a multitude of VHD tools surfaced (vhdtool, disk2vhd, wim2vhd and many more). There was no easy way to just mount the VHD from the command line so 3rd parties jumped on this as well. I should not forget to mention James O’Neill’s awesome Hyper-V PowerShell Management Library which he created when he still worked for Microsoft.

The VHD related commands in that library are:
Get-VHDDefaultPath, Get-VHDInfo, New-VHD, Compact-VHD, Test-VHD, Convert-VHD, Merge-VHD, Mount-VHD, Unmount-VHD

VHDX

During the \\build conference we learnt that Microsoft will introduce a new advanced version of the Virtual Hard Disk format called VHDX in Windows 8 (both client and server). What do we currently know about this VHDX?

 

image

  • It can be used in all VHD scenario’s (including boot from VHDX)
  • The maximum size has gone up from 2TB (minus 8K) in VHD to 16TB in VHDX (minimum 3MB)
  • It will be the default virtual disk format for Hyper-V in Windows 8 (and is not supported by earlier versions)
  • It will be convertible to VHD and back to VHDX
  • It can be created by the default Hyper-V PowerShell Library in Windows 8
  • It has a default larger block size (32MB for fixed and dynamic disks and 2MB for differencing) and aligns at 1MB boundaries (in a range between 1 and 256MB, although this is not a hard limit)
  • Its sector size matches the physical sector size and sectors and all internal I/O is 4K aligned working well for advanced format disks like 4K disks
  • It is equal to or faster in speed than VHD disks
  • It can be mounted, browsed and ejected from Windows Explorer
  • It is more resilient to power failures as it uses a log file for metadata changes like block allocations and state changes (the data blocks itself are not logged)

image

  • It accepts user embedded data (key/value pairs)
  • It does not accept mixing a VHDX child and a VHD parent.
  • It is scriptable (PowerShell, WMI)
  • It supports online maintenance/metadata operations (moving, merging, mirroring, re-parenting) greatly enhancing availability.

image

As you can see there is substantial innovation in the new Microsoft Virtual Hard Disk format which will not only be put to good use in Hyper-V alone. It is one of the great building blocks of the Microsoft Storage story in Windows 8.

CREATING VHDX WITH POWERSHELL

Creating a new VHDX and using it for a new VM is as easy as this:

Import-Module Hyper-V
New-VHD –VHDFormat VHDX –Path D:\VHD\Parent.vhdx –VHDType Dynamic -SizeBytes 50GB

Creating a VHDX with a Parent and Child relationship looks like this:
New-VHD –VHDFormat VHDX –Path D:\VHD\Child.vhdx –ParentPath D:\VHD\Parent.vhdx –VHDType Dynamic
-SizeBytes 50GB

In one of the next parts you’ll see that we can place Hyper-V guests and their VHD(x) files on an SMB2 Share as well.

Creating a VM is child’s play:
New-VM –Name VM01 –Path D:\VHD\Child.vhdx –Memory 6GB

Sources: Wikipedia, SNIA.org, Building Windows 8

__________________________________________________________________________________________________________________________________________
You can follow me on Twitter:  @hvredevoort  and you are welcome to +K me at Klout