How to Use VHDX or VHD files with Hyper-V Environment & When?

VHD and VHDX are both file format that works similarly to an external hard disk for storing partition systems and folders. However, VHDX is a successor to VHD which was introduced by Microsoft in 2012 but one thing they didn’t change is the compatibility between these files and Hyper-V. So you can still work on creating VHD files in your Hyper-V environment without any issue. VHDX is undoubtedly an advanced version of VHD since there are some differences in both file formats which suggests this statement. In this blog, we will discuss these differences in detail which will help you decide why and when to use VHDX or VHD with Hyper-V.

How is VHDX different from VHD?

There is not just one difference to point out so we have prepared the comparison based on a few pointers.

  1. Compatibility – since VHD is an older version it is supported by 2008, 2008R2, 2012R2, and 2012 servers whereas the VHDX file format is only supported by the 2012 Windows server.
  2. Storage Capacity – the capacity of the format has been massively increased from 2TB storage capacity in VHD format to 64TB capacity in the latest version of VHDX.
  3. Logical Sector Size – the latest and upgraded VHDX file format supports 4KB worth of logical sector size. On the other hand, VHD can only manage 512 bytes of the logical sector.
  4. Protection of user data – VHDX has a special feature of self-protection from unexpected file corruption that can lead to loss of data. The protection of data from corruption is possible as VHDX tracks the metadata since corruption can be caused by issues like a sudden power outage. It also has the upper hand on VHD file format as it provides larger blocks for dynamic and differential disks that have custom metadata features.
  5. Feature of resizing – VHDX has a live resizing option which was not there in VHD format.
  6. Trimming and Data Alignment – data alignment is very smooth in VDX file format as compared to VHD format and the trimming feature makes VHDX one step above the VHD format.
  7. Storage types – both VHD and VHDX have different types of storage, Fixed and dynamic being two of the primary storage types. In fixed storage, when the VHD file is created, the space is allotted and the virtual disk size remains constant whether the file is added or deleted. In dynamic storage type, the size of the VHD or VHDX file increases when the files are added. So in a way, it can be said that dynamic storage is an extendable type that increases VHD or VHDX size when needed.

As you can see based on the above-mentioned points VHDX is a better choice due to many reasons. However, there are still some situations where you would prefer to work with VHD rather than VHDX. For example- Hyper-V VHDX is not compatible with previous variants of Windows servers than the 2012 version. So now you have all the points to check for the type of format you want to use.

Need to upgrade VHD to VHDX

Now you know that VHDX has more advantages and it cannot be used earlier than the 2012 versions. Therefore to achieve maximum utilization it is recommended to upgrade the VHD file to VHDX format. This can be achieved using PowerShell.

Run the PowerShell as an administrator and then run the below-mentioned command on it for the conversion.

Convert-VHD -Path ‘C:\New Virtual Disks\Fixed Disk.vhd’ -DestinationPath ‘C:\New Virtual Disks\Fixed Disk.vhdx’

Now you will be able to use upgraded VHDX files.

Wrapping it up

VHD and VHDX are both file formats supported by Hyper-V but VHDX is a successive advanced version of the VHD file format. There are differences in both the file types that will suggest to the users which one they would prefer. In case they have VHD files and they want to convert or upgrade them to VHDX it can be done using PowerShell. For fixing corruption in the VHD and VHDX files, user can use VHD recovery tool.