Freigeben über


iSCSI Storage for My Cluster Test Lab - Part 1

Introduction

Hello!

This week I'm going to write about some recent test lab configuration fun:

You want an iSCSI target on Windows Server? You got it!

You want shared storage presented to a laptop-lab failover cluster? You got it!

You want all that done with PowerShell? You got it (well, mostly)!

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'm going to show 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:

Happy? Good. Onwards.

PowerShell

First up, on my laptop (the Hyper-V host), I need to create a new VHD and present it to the relevant Hyper-V guest.

#On Hyper-V Host

$VhdPath = "D:\Virtual\Hyper-V\Virtual Hard Disks\HALODC02_2K12\iSCSI_VHDs.vhd"

New-VHD -Path $VhdPath -SizeBytes 100GB -Dynamic

Add-VMHardDiskDrive -VMName "3_Lab-HALODC02_2K12_R2" -Path $VhdPath -ControllerType SCSI -ControllerNumber 0

 

   

Easy. Now, I need to log on to the 2012 R2 server and configure the new disk.

#On iSCSI target server

Get-Disk | Where-Object {$_.PartitionStyle -eq "RAW"} |

Initialize-Disk -PartitionStyle MBR -PassThru |

New-Partition -UseMaximumSize -DriveLetter Z |

Format-Volume -FileSystem NTFS -Force -Confirm:$False -NewFileSystemLabel "iSCSI_VHDs"

 

 

A doddle. Next, install the necessary components so the server can act as an iSCSI target.

Install-WindowsFeature fs-iscsitarget-server

 

 

Yes, it really is that simple! Ok, now we want to create an iSCSI target with our failover cluster nodes as initiators.

New-IscsiServerTarget -Targetname "iSCSITarget" -InitiatorId @("DNSName:HALOMEM01.halo.net","DNSName:HALOMEM03.halo.net")

 

 

Now, to create a couple of iSCSI virtual disks on the newly added storage. The first disk will be used for the cluster quorum, the second for file server storage.

New-IscsiVirtualDisk -SizeBytes 4GB -Path Z:\Quorum\Q.vhdx -Description "Quorum"

New-IscsiVirtualDisk -SizeBytes 50GB -Path Z:\Storage\Storage.vhdx -Description "Cluster Storage"

 

 

 

Almost there. The final couple of commands add these new iSCSI virtual disks to our newly created target.

Add-IscsiVirtualDiskTargetMapping -TargetName "iSCSITarget" -Path Z:\Storage\Storage.vhdx

Add-IscsiVirtualDiskTargetMapping -TargetName "iSCSITarget" -Path Z:\Quorum\Q.vhdx

 

This cmdlet doesn't provide any output, so nothing to see here, move along...

 

Conclusion

All done. Before I go let's summarise the steps:

  1. Add a VHD to our Hyper-V guest (laptop)
  2. Initialise, partition and format the newly added disk (W2K12R2 server)
  3. Install iSCSI Target windows feature (W2K12R2 server)
  4. Create iSCSI target (W2K12R2 server)
  5. Create iSCSI virtual disks (W2K12R2 server)
  6. Add iSCSI virtual disks to ISCSI target (W2K12R2 server)

 

That's it for Part 1 - see you next week.

Comments

  • Anonymous
    November 27, 2015
    Add iSCSI shared storage to a Windows 2008 R2 Cluster...
  • Anonymous
    August 23, 2016
    Thank you! Very useful