In Part 3 of my Hyper-V Cluster with Shared VHD series, I’ll cover creating the shared virtual hard disk and the Failover Cluster.

Creating the Shared VHDX Files

Now that we have our guest virtual machine cluster nodes created with all of the prerequisites, we’re ready to add the shared virtual hard disk and create the Failover Cluster.

In the Failover Cluster Manager, go to Roles, click on the name of one of the virtual machines, and click Settings.

Virtual machine settings

Virtual machine settings

In the VM settings, go to Hardware and click SCSI Controller. Then, click Hard Drive and Add.

Add hard drive

Add hard drive

Click New to start the New Virtual Hard Disk Wizard. For disk type, choose either fixed size or dynamically expanding. On the Name and Location screen, ensure that you’ve selected your shared storage location. Since VM’s typically have their virtual hard disks stored with the rest of the VM configuration files, you may want to set up a new folder for your shared VHD files. Click Finish on the wizard and you'll be taken back to the Setting for your VM. Note: Don’t hit Apply yet!

Specify name and location of VHD files

Specify name and location of VHD files

Settings of VM cluster

Settings of VM cluster

After creating the shared virtual hard disk, expand the hard disk by clicking the plus next to the hard drive. Click Advanced features, check Enable virtual hard disk sharing, and click OK.

Enable virtual hard disk sharing

Enable virtual hard disk sharing

If you did happen to hit Apply, the Enable virtual hard disk sharing will be grayed out. If this happens to you, you have two options: shut down the VM and enable sharing; or, you can remove the virtual hard disk, reattach it, and then enable sharing before clicking Apply.

Enable virtual hard disk sharing - Grayed out

Enable virtual hard disk sharing - Grayed out

If you're going to have an even number of cluster nodes, you'll also need to create a small disk to act as the disk witness for quorum purposes. If you don't, the cluster creation process will take over the large disk as the disk witness... and you really don't want that. As a general rule, I always create the witness disk because I never know if I'm going to need to come back at a later time and add more nodes.

Or, like everything else, you can do this in PowerShell with the following commands:

New-VHD -Dynamic C:\ClusterStorage\Volume1\Shared\Cluster_Shared.vhdx –SizeBytes 120GB
Add-VMHardDiskDrive -VMName “VM Name” -Path C:\ClusterStorage\Volume1\Cluster_Shared.vhdx –ShareVirtualDisk
New-VHD -Dynamic C:\ClusterStorage\Volume1\Shared\Cluster_Quorum.vhdx –SizeBytes 1GB
Add-VMHardDiskDrive -VMName “VM Name” -Path C:\ClusterStorage\Volume1\Cluster_Quorum.vhdx –ShareVirtualDisk

Create new VHD with PowerShell

Create new VHD with PowerShell

In the VM, we’ll need to bring the disk online and get it ready for usage.

Disk Management

Disk Management

Right-click on the new disk and choose Online. Right-click on the disk again and choose Initialize Disk. Once the disk has been initialized, format the disk as NTFS, but do not assign a disk letter.

Or, here’s the PowerShell to do the same thing:

Get-Disk | Where PartitionStyle –EQ ‘Raw’ | Initialize-Disk –PassThru | New-Partition –UseMaximumSize | Format-Volume -FileSystem NTFS

Format disk with PowerShell

Format disk with PowerShell

Creating the Failover Cluster

Open the Failover Cluster Manager and click on Create Cluster.

Create cluster

Create cluster

Click Next on the first screen and enter the names of both servers on the next screen. After doing that, click Next.

Enter server names

Enter server names

If you haven't already run a validation test, the wizard will prompt you for whether or not you want to run a test. It isn't necessarily required (unless you contact Microsoft for support), but it can be a good tool for letting you know if you have configuration problems.

Validation Warning

Validation Warning

In my test environment, I chose to run all tests and the configuration was validated.

Start validation

Start validation

Validation report

Validation report

If you've run the validation (or decide to skip it), the next step is to pick a name for your cluster.

Enter cluster name

Enter cluster name

Once you've done that, confirm your selections (ensuring that All all eligible storage to the cluster is checked) and click Next. The cluster configuration will run and you should be given a confirmation when it completes.

Ready to create cluster

Ready to create cluster

Cluster creation completed

Cluster creation completed

Articles in seriesHyper-V Cluster with Shared VHD
1 Comment
  1. hameed 4 years ago

    You have a Scale-Out File Server that has a share named Share1. Share1 contains a virtual disk file named Disk1.vhd.
    You plan to create a guest failover cluster.
    You need to ensure that you can use the virtual disk as a shared virtual disk for the guest failover cluster.
    Which cmdlet should you use?
     

Leave a reply

Your email address will not be published.

*

© 4sysops 2006 - 2023

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account