The next useful innovation that appeared in Windows Server 2016 is the new format of virtual disks — VHD Set (VHDS) enabling the simultaneous use of one virtual disk by multiple virtual machines. This feature is used in guest cluster scenarios (file cluster, SQL Server AlwaysOn FCI, etc.), when shared disks have to be available for all virtual machines cluster nodes. VHD Set technology is designed to replace Shared VHDX feature and also doesn’t not require the configuration of virtual HBA and SAN for the presentation of one LUN to several VMs.
In Windows Server 2012 R2 to provide guest clustering features the format of shared virtual disks, Shared VHDX, was used. However, Shared VHDX has some drawbacks:
- no opportunity to change the size or migrate Shared VHDX
- VHDX doesn’t support backup, checkpoints or replication
VHDS doesn’t have these restrictions, but it is available only in the VM running the guest Windows Server 2016. VHDS supports the following new features:
-
- host-level support of backup and replication
- VHD Set size change on-the-fly (without stopping the VM)
- support of hot disk migration
- creating checkpoints for .vhds files
To create a new VHD Set, select New -> Virtual Disk in the graphical menu of Hyper-V Manager. Specify VHD Set as disk format, then select the type of the disk (fixed or dynamic), file name, location and size.
You can create the disk using PowerShell too:
New-VHD –Path c:\clusterstorage\vmstorage01\DynamicDisk.vhds -SizeBytes 40Gb -Dynamic
When creating a disk, it is enough to specify vhds file extension, and PowerShell will automatically create the VHD Set. When creating a disk of VHD Set format, two files appear:
- .avhdx – a disk file containing data (it can be both fixed and dynamic)
- .vhds – a small (260 KB) metadata file to coordinate the interaction between guest cluster nodes
Here is an example how to create a wo-node guest cluster using VHDS.
Let’s create two new VHD Sets. The first one will be a Witness disk in the cluster quorum, and the second will be the disk for data. For example, our cluster is represented by two VMs. Connect both VHD Sets on each virtual machine. You can do it either in the Hyper-V graphical interface or in PowerShell:
Add-VMHardDiskDrive -VMName VMCL01 -Path "c:\ClusterStorage\SharedDisk\VM_Quorum.vhds" -SupportPersistentReservations
Add-VMHardDiskDrive -VMName VMCL01 -Path "c:\ClusterStorage\SharedDisk\VM_Shared.vhds" -SupportPersistentReservations
Add-VMHardDiskDrive -VMName VMCL02 -Path "c:\ClusterStorage\SharedDisk\VM_Quorum.vhds" -SupportPersistentReservations
Add-VMHardDiskDrive -VMName VMCL02 -Path "c:\ClusterStorage\SharedDisk\VM_Shared.vhds" -SupportPersistentReservations
Install Failover Clustering feature on each virtual server:
Install-WindowsFeature -Name Failover-Clustering -IncludeManagementTools -ComputerName VMCL01
Install-WindowsFeature -Name Failover-Clustering -IncludeManagementTools -ComputerName VMCL02
Initialize the disks:
get-disk |? OperationalStatus -Like "Offline" | Initialize-Disk
Create NTFS partitions:
New-Volume -DiskNumber 1 -FileSystem NTFS -FriendlyName Quorum
New-Volume -DiskNumber 2 -FileSystem NTFS -FriendlyName Data
Now you have to create a cluster:
# Compatibility check
Test-Cluster VMCL01,VMCL02
# Creating cluster
New-Cluster -Name FSCluster01 -Node VMCL01,VMCL02 -StaticAddress 192.168.0.50
(Get-ClusterResource |? Name -like "Cluster Disk 1").Name="Quorum"
(Get-ClusterResource |? Name -like "Cluster Disk 2").Name="Data"
# Specify the Witness disk
Set-ClusterQuorum -DiskWitness Quorum
# Add Cluster Shared Volume
Get-ClusterResource -Name Data | Add-ClusterSharedVolume
If you have done it right, a two-node guest cluster will appear.
You can convert Shared VHDX to VHD Set. The conversion is performed offline (the disk must not be used and must be disconnected from all VMs) using Convert-VHD cmdlet:
Convert-VHD "C:\ClusterStorage\SharedDisk\old.vhdx" "C:\ClusterStorage\SharedDisk\new.vhds"
So, VHD Set in Windows Server 2016 allows to create a MSFT guest cluster without using complex technologies, like NPIV, virtual HBA and virtual SAN network. Virtual VHDS originally supports changing size, snapshots and migration.
1 comment
Thanks very helpful.