Hyper-V VHD Set, introduced in Windows Server 2016, is a virtual disk model you can use as a shared disk for guest clusters and clustering between VMs.
Hyper-V VHD Set supports all standard features, including online resizing and Hyper-V replica support; you can even include it in application-consistent checkpoints.
To create Hyper-V VHD Set files, you can use either Hyper-V Manager or PowerShell.
In Hyper-V Manager, navigate to Action, select New and then click Hard Disk. In the Choose Disk Format wizard, select VHD Set and follow the onscreen steps.
To create Hyper-V VHD Set files using PowerShell, execute the following PowerShell commands:
New-VHD -Path C:\Temp\ClusterWitnessDisk.VHDS -SizeBytes 1GB -Dynamic
New-VHD -Path C:\Temp\ClusterDataDisk.VHDS -SizeBytes 10GB -Dynamic
The New-VHD command line might take a few minutes to complete based on the size of VHDS file, as shown in Figure 1 below.
You need to specify the VHDS extension when you create VHD Set files with PowerShell.
Once you create the Hyper-V VHD Set files, you can attach them to the VMs that will participate in the cluster using the PowerShell commands below:
Add-VMHardDiskDrive -VMName "ClusterVM1" -ControllerNumber 0 -ControllerLocation 1 -Path C:\Temp\ClusterWitnessDisk.VHDS -ShareVirtualDisk
Add-VMHardDiskDrive -VMName "ClusterVM2" -ControllerNumber 0 -ControllerLocation 1 -Path C:\Temp\ClusterWitnessDisk.VHDS –ShareVirtualDisk
Optimize Hyper-V VHD Set files with PowerShell
Similar to VHD and VHDX files, you can optimize Hyper-V VHD Set files. You will, however, need to use the Optimize-VHDSet PowerShell command instead of the Optimize-VHD cmdlet that you use for VHD and VHDX files.
To optimize a VHD Set file, execute the following PowerShell command:
Optimize-VHDSet -Path C:\Temp\ClusterDataDisk.VHDS
When you execute the command above, the process compacts the Hyper-V VHD Set file by reclaiming unused blocks and rearranging the blocks so information stored in the VHD Set can be read faster. This improves the performance of the VHD Set file.
You can also resize the VHD Set files by executing the following PowerShell command:
Resize-VHD -Path C:\Temp\ClusterDataDisk.VHDS -SizeBytes 30GB
You can only use Hyper-V VHD Set files for guest clustering. VHD Set files aren't meant for general VM deployments.
Dig Deeper on Microsoft Hyper-V and Virtual Server
Related Q&A from Nirmal Sharma
Use System Center Virtual Machine Manager and PowerShell to make logical network management easy. Execute a script to display network virtualization ... Continue Reading
Hyper-V replication is easy to use, but there are a number of steps you should take during Hyper-V replication setup to ensure you stay abreast of ... Continue Reading
Manage Hyper-V clusters more easily with PowerShell cmdlets and scripts that automate the retrieval and display of node information, including node ... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.