Last Update: Sep 04, 2024 | Published: May 31, 2017
In this post, I will show you how to deploy VHD Sets on Windows Server 2016 (WS2016) Hyper-V.
A requirement of any cluster disk is that all nodes in the cluster can access it. Therefore, the cluster disk should reside on storage that the guest cluster nodes can access. This is the case regardless of where they go:
I can create a VHD Set using New-VHD. This is the same New-VHD as always but now it understands that a virtual hard disk with a .VHDS extension is a VHD Set. The following example will:
New-VHD -ComputerName "Host1" -Path C:ClusterStorageCSV1VHDSetsDBCluster-Witness.vhds -SizeBytes 1GB -Dynamic
The above example is perfect for a witness disk. I can create a data disk too:
New-VHD -ComputerName "Host1" -Path C:ClusterStorageCSV1VHDSetsDBCluster-Data1.vhds -SizeBytes 500GB -Dynamic
At this point, there are 4 files in the VHDSets folder:
Now, we need to connect the VHD Set disks to the virtual machines of the cluster. I will connect the two VHD sets to virtual machines called vDB1 and vDB2. First, I will attach the witness disk. Note, we are using Add-VMHardDiskDrive and the -SharedVirtualDisk flag will instruct the virtual machine that the disk is a VHD Set.
Add-VMHardDiskDrive -ComputerName "Host1" -VMName "vDB1" -ControllerNumber 0 -ControllerLocation 1 -Path C:ClusterStorageCSV1VHDSetsDBCluster-Witness.vhds -ShareVirtualDisk Add-VMHardDiskDrive -ComputerName "Host4" -VMName "vDB2" -ControllerNumber 0 -ControllerLocation 1 -Path C:ClusterStorageCSV1VHDSetsDBCluster-Witness.vhds -ShareVirtualDisk
Next, I can attach the data disks. We will use the same command as before but we will change the names of the .VHDS file:
Add-VMHardDiskDrive -ComputerName "Host1" -VMName "vDB1" -ControllerNumber 0 -ControllerLocation 1 -Path C:ClusterStorageCSV1VHDSetsDBCluster-Data1.vhds -ShareVirtualDisk Add-VMHardDiskDrive -ComputerName "Host4" -VMName "vDB2" -ControllerNumber 0 -ControllerLocation 1 -Path C:ClusterStorageCSV1VHDSetsDBCluster-Data1.vhds -ShareVirtualDisk
After you have created your VHD Set, you can view it in Hyper-V Manager or Failover Cluster Manager. Note, many of the options that are there for regular VHDX files are gone and some of the sharing checkboxes of WS2012 R2 are gone too. VHD Sets on WS2016 are only shared disks, so those options to manage sharing are no longer required. If you want to manage performance, instead of implementing QoS on the virtual hard disk, you should do it on the CSV or Scale-Out File Server. This is new in WS2016.
Operations that were previously unavailable, are possible now. Some of these, such as replicating a virtual cluster with VHD Sets, must use virtual machine groups. Create a virtual machine group including all of the virtual machines in the guest cluster and enable Hyper-V Replica using the members of the group.
You might be asked to increase the size of a VHD Set data disk. Shared VHDX in WS2012 R2 required that the cluster was powered down, which makes a mockery of the concept of high availability. In WS2016, you just resize the disk:
Resize-VHD -ComputerName "Host1" -Path C:ClusterStorageCSV1VHDSetsDBCluster-Data1.vhds -SizeBytes 1024GB
Finally, you will need to extend the volume in the guest OS of one of the virtual cluster nodes.