With Microsoft Hyper-V clusters, when thinking about shared storage for our virtual machines, a special type of volume is created that solves many of the problems that exist with Windows clusters and shared volumes. This new type of volume is called a clustered shared volume or CSV. What are clustered shared volumes? What benefit do they bring to the table when thinking about using them for Hyper-V clusters? Also, what is the process to create clustered shared volumes when utilizing them in a Windows Server 2016 Hyper-V cluster?
What are Clustered Shared Volumes?
Clustered Shared Volumes or CSV’s are special shared storage between Windows Server 2016 clusters specifically designed for Hyper-V that allow each host in a cluster to be able to have simultaneous read-write access to the same LUN or shared disk. Typically, when looking at traditional shared storage in a standard Windows Server cluster, when cluster roles failover between hosts in the cluster, drive ownership is changed, and the volume is dismounted and remounted.
This is undesirable when thinking about virtual machines in a Hyper-V cluster as you want multiple hosts to be the compute/memory for VMs that potentially reside on a single shared storage volume. With a clustered shared volume, the roles can fail over quickly from one to another without requiring this change in drive ownership, dismounting, remounting storage that is required with a tradition shared volume. So, when creating shared storage for our Hyper-V cluster, we definitely want to configure clustered shared volumes.
Storage Resiliency
Another great benefit from using Cluster Shared Volumes in Windows Server 2016 is the new storage resiliency that is built in when used for Hyper-V virtual machines. In previous Windows versions, when a VM failed to read or write to a storage volume, the VM or applications running in the VM would crash.
With Windows Server 2016, when failures are detected writing to the VHD/VHDX, the VM is placed into a critical pause state. In this pause state, everything in the VM is frozen including I/O. Once the storage housing the VHD/VHDX is available once again, the VM is brought back to a running state and read/write I/O is resumed. The key benefit here is the session state of the VM is retained so it picks right up where it left off. If the failures are short in nature clients most likely wouldn’t see even a blip in service.
Creating Clustered Shared Volumes
Let’s take a look at how to create the CSV both in Windows Failover Cluster administrator GUI as well as in PowerShell.
Let’s first look at creating CSV’s in the GUI Windows Failover Cluster manager console. When we expand Storage >> Disks we see the Available storage presented to our Windows Server 2016 Hyper-V cluster. Note the below Assigned To status of the VM Storage volume is Available Storage.
Also, when we look at the properties of the VM Storage volume we see what looks to be normal disk properties presented as the owner node – H1 is the owner of this disk.
If we try to create a virtual machine on the volume as it is configured as simply available storage, we receive an error when the virtual machine is created:
To add this to a Clustered Shared Volume, we simply right click on the volume and select the Add to Cluster Shared Volume option.
Now we see the Assigned To status change to Cluster Shared Volume.
If we look at the properties of the VM Storage volume now that it has been converted to a Clustered Shared Volume, we see the below. The volume has been now presented as a ClusterStorage mount.
Now, when we provision a new virtual machine on the volume as it is configured as a clustered shared volume, the new virtual machine creation is successful. Also, it passes the High Availability configuration.
Creating Clustered Shared Volumes using PowerShell
Using PowerShell, we can easily create the Cluster Shared Volumes for our Hyper-V cluster. If you want or need rename a particular cluster disk resource that will be used for VM storage, that can be done using the following commandlet. Below, the commandlet assumes the cluster disk that you want to use for CSV is named “Cluster Disk 1”.
- (Get-ClusterResource | ?{$_.Name -eq “Cluster Disk 1”}).name = “VM Storage”
We can add a particular cluster disk to the Cluster Shared Volume using the following command.
- Get-ClusterResource -Name “VM Storage”| Add-ClusterSharedVolume
In PowerShell, to view configured Cluster Shared Volumes, you can use the get-clustersharedvolume command:
Thoughts
Clustered Shared Volumes are an integral part of the storage configuration for a Windows Server 2016 Hyper-V cluster. In using CSV storage, the Hyper-V hosts can access the CSV storage simultaneously without having to dismount and remount the virtual machine storage. Shared storage that all hosts can access simultaneously is a requirement for having a redundant and highly available Hyper-V architecture. Also, the storage resiliency that is new to Windows Server 2016 provides a compelling benefit to Cluster Shared Volumes. Failures that are detected are mitigated by pausing virtual machines which saves the state of the VM and returns the state once storage connectivity is restored. Creating the CSV volumes are extremely easy either in the Windows Server Failover Cluster console or with PowerShell. Be sure to use this new type of cluster volume with any Hyper-V implementation.
Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.