Creating a Virtual Machine to be stored on a Cluster Shared Volume

Creating a Virtual Machine to be stored on a Cluster Shared Volume

  • Comments 5
  • Likes

Cluster Shared Volumes is a new feature of Windows Server 2008 R2 Failover Clustering intended to enhance the capabilities of Highly Available Virtual Machines. It is recommended to utilize Cluster Shared Volumes if you intend to use the Live Migration feature of Windows Server 2008 R2 Hyper-V. In this blog I would like to cover a simple yet common oversight when creating a Virtual Machine to be used with Cluster Shared Volumes.

How to enable Cluster Shared Volumes

To enable Cluster Shared Volumes, on which you will place your Virtual Machines, we can use Failover Cluster Manager or the following Failover Cluster PowerShell CmdLets.

Using Failover Cluster Manager, simply select the cluster and from the Configure pane select Enable Cluster Shared Volumes.

Figure 1: Enabling Cluster Shared Volumes

clip_image002

Using PowerShell, ensure that the Failover Cluster module is loaded and run the following command:

PS C:\> get-cluster “your cluster name” | %{$_.EnableSharedVolumes="Enabled"}

Read the exception returned by the above command and then enable CSV following the instructions.

We must stop here for the fine print:     Cluster Shared Volumes Support for Hyper-V
In Windows Server 2008 R2, the Cluster Shared Volumes feature included in failover clustering is only supported for use with the Hyper-V server role. The creation, reproduction, and storage of files on Cluster Shared Volumes that were not created for the Hyper-V role, including any user or application data stored under the ClusterStorage directory of the system drive on every node, are not supported and may result in unpredictable behavior, including data corruption or data loss on these shared volumes. An example of a file type that is created for the Hyper-V role is a virtual hard disk (.vhd) file.

Once enabled, you can add one or more available storage clustered disks as a Cluster Shared Volume:

Figure 2: Adding disks to be used as Cluster Shared Volumes

clip_image004

Now that we enabled and added disks as Cluster Shared Volumes, we will have the following folder structure on the %SystemDrive%, which will typically be C:\

C:\ClusterStorage\Volume1
C:\ClusterStorage\Volume2
C:\ClusterStorage\Volume3

VolumeN above represents an entire clustered disk. These folders can be renamed for administrative purposes; however the C:\ClusterStorage folder must remain as it is.

For our example here I will rename C:\ClusterStorage\Volume1 to C:\ClusterStorage\AccntsDB-VMs.

For a more detailed walk-through of using Cluster Shared Volumes for virtual machine live migration see the following blog from one of our Clustering & High-Availability Program Managers, Symon Perriman:

Deploying Cluster Shared Volumes (CSV) in Windows Server 2008 R2 Failover Clustering

Now for the main purpose of this blog…

Creating the Virtual Machine on the Cluster Shared Volume:

For a Highly Available VM to function correctly all configuration and data files for the virtual machine must reside on a cluster shared disk that will be accessible to which ever node currently owns the VM. When using Cluster Shared Volumes this means all files must reside in the same folder, the folder where the Cluster Shared Volume disk is mounted, in our example C:\ClusterStorage\AccntsDB-VMs.

We create the Virtual Machine using Hyper-V Manager, as you would any VM. You can create a new VHD to install into or utilize an existing VHD. Below is an example of each. The critical point in this process is where to locate the entire Virtual Machine, not only the VHD file. I have seen many people copy the VHD file to the correct CSV folder but miss this step, resulting in all of the configuration files being placed into the default location, which most likely will not be available to all nodes in the cluster resulting in failures when attempting to make highly available or move the VMs between cluster nodes.

While creating a New Virtual Machine, choose a location:

Figure 3: Change the VM location to the desired CSV folder

clip_image006

Specifying a VHD file for the VM:

Figure 4: Specify the location and name for the VHD

clip_image008

Or use an existing VHD… (Of course we would need to have copied the file to this location previously)

                                                    Figure 5: Specify the location of an existing VHD

                                                    clip_image010

Once you have located the VM and VHD(s) onto the Cluster Shared Volume properly, proceed with creating the virtual machine as you normally would. In addition, we still need to create the Highly Available virtual machine resource using Failover Cluster Manager.

For a more detailed walk-through of creating virtual machines for live migration please see the following blog from one of our Clustering & High-Availability Program Managers, Symon Perriman:

Deploying Cluster Shared Volumes (CSV) in Windows Server 2008 R2 Failover Clustering

For more information please reference:

Understanding Cluster Shared Volumes in a Failover Cluster

Understanding Hyper-V and Virtual Machines in the Context of a Cluster

Errors you may encounter if not done properly include:

The operation has failed. None of the virtual machine configurations chosen was successfully made highly available.

clip_image012

Report Errors:

“Disk path 'C:\ProgramData\Microsoft\Windows\Hyper-V' is not a path to storage in the cluster or to storage that can be added to the cluster. You must ensure this storage is available to every node in the cluster to make this virtual machine highly available.”

There was a failure bringing the virtual machine configuration resource 'Virtual Machine Configuration New Virtual Machine' online.

Chris Allen
Senior Support Escalation Engineer
Microsoft Enterprise Platforms Support

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • This works great, but what about importing (from a exported VM)?  I can't seem to find a way in Hyper-V 2008R2 to specify that the VM should be created on the Cluster Shared Volume (CSV), rather than the local C: drive when I use the "import" function (even though the VM that was exported was created on the CSV, and not on the local drive, and the exported VM files are on the CSV as well).  Can you provide some pointers (even if they're esoteric/require regedits,etc) that will allow me to take advantage of the export/import feature of Hyper-V, rather than having to go through the "new VM" interface for each system?

    Thank you!

  • Try tuning the Machine off first exported to the ClusterStorage Share Location folder, then you can import the virtual machine from there.

  • Sorry for the typos...

  • How do I create a Highlay available VM from powershell ?

  • We have an issue at customer site where the environment has VMs running on CSV. The issue is when the customer performs replication from a SAN storage, he was loosing access to CSVs. Can anyone tell me the reason behind this ?