The most common question on clusters is do I need shared storage ? Yes you do oh such a huge cost eh are you using windows server 2012 R2 no not yet.
Well you should use 2012R2 one of the best options is Shared VHDX
Hyper-V V3.0 ( windows server 2012 R2 )makes it possible to share a virtual hard disk file between multiple virtual machines. Sharing a virtual hard disk file (.vhdx) provides the shared storage that is necessary for a Hyper-V guest failover cluster.
Sharing a virtual hard disk file (.vhdx) means that you can create and manage a guest failover cluster to protect the application services running inside your virtual machines. Before Windows Server 2012 R2, if you wanted to create a Hyper-V guest failover cluster, you needed to expose your storage topology to the virtual machine.
Starting in Windows Server 2012 R2, you can deploy a Hyper-V guest failover cluster that is no longer bound to your storage topology. You can implement a guest failover cluster by using a shared virtual hard disk, Fibre Channel, Server Message Block (SMB), Storage Spaces, or ISCSI storage options. Shared virtual hard disks are only available in Windows Server 2012 R2. Hyper-V makes it possible to share a virtual hard disk file between multiple virtual machines. Sharing a virtual hard disk file (.vhdx) provides the shared storage that is necessary for a Hyper-V guest failover cluster.
Using a shared virtual hard disk is ideal for the following situations:
- SQL Server database files.
- File server services running within a virtual machine.
- Database files that reside on shared disks.
In this scenario I have a 64 node Cluster based on Shared VHDX. Let me show you how you should start.
First we need some virtual disk files VHDX and the quickest and easiest way to do this is by powershell
If you run this line you will create 10 Virtual disk on the M drive with a fixed size of 4 GB. if you want other options use the get-help New-VHD
1..10 | % { New-VHD -Path m:\ShareData$_.VHDX -Fixed -SizeBytes 4GB }
This is Cool in a few seconds several disks. yes but what now well If you have a cluster already then you can add the disk to the VM and use them if not you can create a cluster.
But Robert adding the disk is so much work, I know. Imaging you have 64 nodes this will take days yes how fun is that User PowerShell
In the following line you can easy add the disk to the VM
1..10 | % { $p = "m:\shareData" + $_ + ".VHDX" ; 10..66 | % { $v = "Demo" + $_; Write-Host $v, $p; Add-VMHardDiskDrive -VMName $v -Path $p -ShareVirtualDisk } }
But you can also share a disk in the GUI and the best part is it can be done live.
As you can see several steps are needed to do this. just with one line in PowerShell it is done.
Now that We added the Disks We can use the disks.
Easy as Get-ClusterAvailableDisk | Add-ClusterDisk or in the GUI
Now that the disks are in place We can create a a sample File server that is using this disk.
I installed already the file server role on all the nodes. not by hand
1..9 | % { Install-WindowsFeature -computername Demo0$_ File-Services, FS-FileServer, Failover-Clustering }
1..9 | % { Install-WindowsFeature -computername Demo0$_ RSAT-Clustering -IncludeAllSubFeature }
So the first nine servers are file servers. but keep in mind if you do this you have to adjust the ownership, creating a file server every node will own this and if not all the nodes have the FS role installed you will get in trouble !
Now you can add the share to the fileserver. Remember do this in the Cluster Manager and not on the share it self
Now we have a File server on a shared VHDX isn’t that cool.