Building guest (virtual) Failover Cluster on Hyper-V host with Windows Server 2012 R2 – Part 1 – Create virtual machines


This article will guide you through how to build guest (virtual) cluster using Hyper-V on Microsoft Windows Server 2012 R2. Functional Failover Clustering is the first step before installation of clustered File Server or AlwaysOn Failover Cluster Instance on Microsoft SQL Server etc. You can use this guide on a single Hyper-V host or on the Hyper-V cluster.

Hyper-V role on Microsoft Windows Server 2012 R2 gave us great opportunity to simply create virtual machines and configure Failover Clustering with Cluster Disks with or without enabled Cluster Shared Volumes (CSV) that are located on a single shared VHD or VHDX file.

There are many concerns about guest clustering and few of them are true. As administrator or architect you need to consider if the highly-available VM is enough or if you need guest failover cluster that can be also assembled from the two or more highly-available VMs. If you require a very small downtimes during maintenance (for example patching on a File Server) or the failure of the guest operating system or application can cause a huge problem for your business then guest clustering on the Hyper-V is the best possibility for you.

Create VMs and add shared disks

  • Create two or more VMs.
    • I will create “contfsclu1n0” in “C:\ClusterStorage\Volume1\contfsclu1n0” and “contfsclu1n1” in “C:\ClusterStorage\Volume1\contfsclu1n1”.
  • Create VHD or VHDX that will be shared between VMs.
    • PowerShell is the fastest way:
New-VHD -Path "C:\ClusterStorage\Volume1\contfsclu1\Virtual Hard Disks\shared-witness.vhdx" -Dynamic -SizeBytes 1GB
New-VHD -Path "C:\ClusterStorage\Volume1\contfsclu1\Virtual Hard Disks\shared-disk0.vhdx" -Dynamic -SizeBytes 500GB
New-VHD -Path "C:\ClusterStorage\Volume1\contfsclu1\Virtual Hard Disks\shared-disk1.vhdx" -Dynamic -SizeBytes 500GB
  • Add shared virtual disk into both VMs.
    • Do it using PowerShell.
Add-VMHardDiskDrive -VMName contfsclu1n0 -Path "C:\ClusterStorage\Volume1\contfsclu1\Virtual Hard Disks\shared-witness.vhdx" -ShareVirtualDisk
Add-VMHardDiskDrive -VMName contfsclu1n1 -Path "C:\ClusterStorage\Volume1\contfsclu1\Virtual Hard Disks\shared-witness.vhdx" -ShareVirtualDisk
Add-VMHardDiskDrive -VMName contfsclu1n0 -Path "C:\ClusterStorage\Volume1\contfsclu1\Virtual Hard Disks\shared-disk0.vhdx" -ShareVirtualDisk
Add-VMHardDiskDrive -VMName contfsclu1n1 -Path "C:\ClusterStorage\Volume1\contfsclu1\Virtual Hard Disks\shared-disk0.vhdx" -ShareVirtualDisk
Add-VMHardDiskDrive -VMName contfsclu1n0 -Path "C:\ClusterStorage\Volume1\contfsclu1\Virtual Hard Disks\shared-disk1.vhdx" -ShareVirtualDisk
Add-VMHardDiskDrive -VMName contfsclu1n1 -Path "C:\ClusterStorage\Volume1\contfsclu1\Virtual Hard Disks\shared-disk1.vhdx" -ShareVirtualDisk
  • Or in GUI.
  • If you have a Hyper-V cluster then cluster your VMs (put them as high-available).
  • Install Microsoft Windows Server 2012 R2 on all VMs.

One response to “Building guest (virtual) Failover Cluster on Hyper-V host with Windows Server 2012 R2 – Part 1 – Create virtual machines”

  1. Hi, Rudolf! Thank you for sharing. When I want to add shared virtual disk into both VMs, an error as below came out. Could you tell me why, please? I am using Windows Server 2016. Thank you! ———————————————————————————————————————- Error Applying Hard Drive Changes Failed to modify device ‘Virtual Hard Disk’. The storage where the virtual hard disk is located does not support virtual hard disk sharing. Cannot get information for attachment ‘C:\clusterstorage\volume1\node1\shared_disk_1.vhdx’. The storage where the virtual hard disk is located does not support virtual hard disk sharing.

Leave a Reply

Your email address will not be published. Required fields are marked *

Active Directory Advanced function AlwaysOn Availability Groups AlwaysOn Failover Cluster Instances Building Cloud Cloud Cluster Cmdlet Database Deployment Design DFS Domain Controller DSC Fabric Failover Clustering File Server Group Policy Hardware Profile Host Hyper-V Installation Library Library Asset Library Server Network Operations Manager Orchestrator PowerShell PowerShell User Group PowerShell Workflow Security Service Manager SQL Server Storage System Center Template Time Time Synchronization Tips Virtual Machine Virtual Machine Manager VM Network VM Template Windows Server 2012 R2