VHD Management

 The following is a primer on managing virtual hard drives using Hyper-V manager. Virtual hard disk files are stored as either .vhd or .vhdx files which use .avhd and .avhdx differencing disks respectively for snapshots. Both formats support either fixed size or dynamically expanding. The .vhdx format is new as of Server 2012 and provides some improvements over the previous .vhd format including increased storage capacity.

For a list of changes in the VHDX format, see http://technet.microsoft.com/en-us/library/hh831446.aspx

All examples are performed using Hyper-V 3.0 on Windows Server 2012 (minimum version required).

Reducing VM disk usage

Delete any unused snapshots and snapshot subtrees that are not needed. This is done in Hyper-V Manager. Each snapshot will create a differencing .avhd/.avhdx file which has dependency on the original VM. Once the snapshot is removed, there will be a period of heavy disk IO while the .avhd/.avhdx file(s) are merged with the parent disk image. Progress information will be visible under Hyper-V Manager, status for the Virtual Machine on which the operation was performed. For an indication of the individual VHD usages:

Under VM properties, view the Hard Drive submenu and click Inspect:


Note the current file size:


For advanced disk optimization, remove all snapshots and wait until the changes are merged to a single VHD. This is a prerequisite to performing the following tasks.

Converting to VHDX format

The process of converting a VHD to VHDX involves creating a copy of the converted .vhd file to a new .vhdx file of equivalent size.




Choose Dynamically expanding unless, you explicitly require a Fixed size disk clip_image012



This process will copy the entire VHD to a .vhdx file and therefore it requires significant sequential disk IO as well as sufficient disk space for the copy. For example a 100GB VHD will be copied to a new 100GB .vhdx file, requiring at least 100GB of free space in the target location.

Once the copy has completed, manually change the Virtual hard disk path to the new .vhdx file. Test the VM with the new disk configuration before deleting the original disk.





Update 2014

Sysinternals Disk2VHD now supports the creation of .VHDX directly!


You may need to check the file permissions on the new .VHDX file before using it with an existing VM.


Update March 2015

There is also a scenario where you may want to shrink the logical (partition size) of the .VHDX file you have hopefully created (as opposed to another .VHD). The Resize-VHD cmdlet is available in Windows 8 and Server 2012 or higher and is used as follows to shrink to the smallest size:

Resize-VHD –Path c:\BaseVHDX.vhdx –ToMinimumSize

For this to be effective, shrink the partition size contained on the .VHDX to be as small as possible as well.

If you'd like to share this, click below:

Leave a Reply