iSCSI Storage for My Cluster Test Lab - Part 2
Continuation
Welcome back!
As promised, this week I'm going to continue writing about some recent test lab configuration fun:
You want an iSCSI target on Windows Server? You got it (last week)!
You want shared storage presented to a laptop-lab failover cluster? You got it (this week, in fact - see below)!
You want all that done with PowerShell? You got it (almost)!
Yours,
Mr. PoSh Chap Esq.
Context
Recently, I wrote a script to fix a customer's failover cluster migration issue. To reproduce the issue my lab needed to be a reasonable reflection of the customer's Windows Server 2008 R2 cluster.
I already had a two node Windows Server 2008 R2 cluster, but it didn't have any shared storage. PowerShell and Windows Server 2012 R2 would soon fix this...
In part 1, I showed you the commands I executed to configure an iSCSI target on a 2012 R2 server.
In part 2, I'll show you how I then configured the nodes of the Windows Server 2008 R2 cluster.
Here's an overview of my lab:
Still happy? Good. Downwards.
PowerShell
Right. we already have the iSCSI target set up and presenting storage on the Windows 20012 R2 server (see part 1). Now, we need to present that shared storage to our failover cluster nodes.
As the nodes are Windows Server 2008 R2, the first step is a departure from PowerShell. Yes, it breaks my heart, but here it is - iSCSIcpl.exe.
And, there it was... in all its GUI glory. Makes me feel wrong. Anyway, type the FQDN of your iSCSI target into the Quick Connect box and away you go - the default options are sufficient for a lab. You'll end up with something resembling the screenshot above.
Right, back to PowerShell. I'm going to add the newly presented iSCSI disks to my cluster. Here's a 'Before' screenshot from diskmgmt.msc.
Here's the PowerShell to add the disks to the cluster. Notice the use of Import-Module. As we're on Windows Server 2008 R2, we're highly likely to be dealing with v2 of PowerShell.
Import-Module FailoverClusters
Get-ClusterAvailableDisk | Add-ClusterDisk
Here's the 'After' shot from Cluadmin.msc.
Nice. Now to reconfigure the quorum to use new 4GB disk (volume E:). We'll configure the quorum as a node and disk majority.
Set-ClusterQuorum -NodeAndDiskMajority "Cluster Disk 1"
Add the file server role to the cluster, referencing the 50GB disk (Volume F:). The role will have the static address of 10.100.10.142.
Add-ClusterFileServerRole -Storage "Cluster Disk 2" -StaticAddress 10.100.10.142
Excellent. I've now configured my cluster to use the new iSCI storage.
Might as well validate it with the Test-Cluster cmdlet.
Hmmm. Some stuff to review and fix...
Conclusion
Before I go let's summarise the steps:
Part 1
- Add a VHD to our Hyper-V guest (laptop)
- Initialise, partition and format the newly added disk (W2K12R2 server)
- Install iSCSI Target windows feature (W2K12R2 server)
- Create iSCSI target (W2K12R2 server)
- Create iSCSI virtual disks (W2K12R2 server)
- Add iSCSI virtual disks to ISCSI target (W2K12R2 server)
Part 2
- Use Quick Connect with iSCSIcpl.exe (Node 1)
- Get available disks and add them to the cluster (Node 1)
- Configure Quorum to use 4GB disk (Node 1)
- Add File Server role to cluster using 50GB disk (Node 1)
- Validate cluster
Easy enough. Easy now.
Bonus Material
I performed a couple of additional configuration steps on my cluster. This was to set up a number of shares for the File Server role. Here's what I did...
I had a number of unique share names stores in shares.txt. These names were used to create new folders on the F: drive.
Get-Content c:\shares.txt | ForEach-Object {New-Item -Path F:\$_ -Type Directory}
With the directories created, I had to share them.
Get-ChildItem F: | ForEach-Object {Net Share $_=`F`:\$_}
Nothing complicated. The Failover Cluster Manager msc automatically picks the new shares up.
Coda
Thanks to PowerShell my environment was reconfigured in no time, allowing me to get on with what I do best - write scripts!