Tag Archives: Storage

Building a Hyper-V Cluster – iSCSI Storage – Part 3/5

Configuring iSCSI storage for a Hyper-V Cluster

In this video we use iSCSI target server built in to Server 2012R2 to present shared storage to our cluster nodes.

Install and Configure iSCSI Target

We must first install the FS-iSCSITarget-Server feature. Once this is installed we will create a target on our storage server. Next we will create virtual disks for the witness disk and CSV. These virtual disks will be attached to the target and presented to our cluster nodes as LUNs. Finally, we will configure the target to allow access from the IQNs of our hyper-v host nodes.  We can discover the IQN of the hyper-v hosts by running the command: (Get-InitiatorPort).NodeAddress on the cluster nodes.

 PowerShell Commands

#Install target server
Install-WindowsFeature -Name FS-iSCSITarget-Server, iSCSITarget-VSS-VDS -IncludeManagementTools -Restart
#create target
New-IscsiServerTarget -TargetName HyperVCluster
New-IscsiVirtualDisk -Path c:\HVC1-W.vhdx -SizeBytes 1GB
New-IscsiVirtualDisk -Path c:\HVC1-CSV.vhdx -SizeBytes 50GB
Add-IscsiVirtualDiskTargetMapping -TargetName HyperVCluster -Path C:\HVC1-W.vhdx
Add-IscsiVirtualDiskTargetMapping -TargetName HyperVCluster -Path C:\HVC1-CSV.vhdx
#(Get-InitiatorPort).NodeAddress
#Allow nodes to access target LUNs
Set-IscsiServerTarget -TargetName HyperVCluster -InitiatorId @("IQN:iqn.1991-05.com.microsoft:2012r2-node1.demo.lcl","IQN:iqn.1991-05.com.microsoft:2012r2-node2.demo.lcl")

Connect Nodes to iSCSI Target

Once the target is created and configured, we need to attach the iSCSI initiator in each node to the storage. We will use MPIO to ensure best performance and availability of storage.  When we enable the MS DSM to claim all iSCSI LUNs we must reboot the node for the setting to take affect. MPIO is utilized by creating a persistent connection to the target for each data NIC on the target server and from all iSCSI initiator NICs on our hyper-v server.  Because our hyper-v servers are using converged networking, we only have 1 iSCSI NIC.  In our example resiliency is provided by the LBFO team we created in the last video.

PowerShell Commands

Set-Service -Name msiscsi -StartupType Automatic
Start-Service msiscsi
#reboot requres after claim
Enable-MSDSMAutomaticClaim -BusType iSCSI
Set-MSDSMGlobalDefaultLoadBalancePolicy -Policy RR
New-IscsiTargetPortal –TargetPortalAddress 192.168.1.107
$target = Get-IscsiTarget -NodeAddress *HyperVCluster*
$target| Connect-IscsiTarget -IsPersistent $true -IsMultipathEnabled $true -InitiatorPortalAddress 192.168.1.21 -TargetPortalAddress 10.0.1.10
$target| Connect-IscsiTarget -IsPersistent $true -IsMultipathEnabled $true -InitiatorPortalAddress 192.168.1.21 -TargetPortalAddress 10.0.1.11

Prepare the LUNs for use in the Cluster

Finally, once storage is available from both nodes, we must online, initialize and format the LUNs so that they will be ready for import into the cluster. This is only done from one node in the cluster as cluster disks must only ever be online on one node at a time.

 PowerShell Commands

#Prep Drives from one node
$Disk = get-disk|?{($_.size -eq 1GB) -or ($_.size -eq 50GB)}
$disk|Initialize-Disk -PartitionStyle GPT
$disk|New-Partition -UseMaximumSize -AssignDriveLetter| Format-Volume -Confirm:$false

Resources

What’s New for iSCSI Target Server in Windows Server 2012 R2
Storage Team Blog – iSCSI Target Server in Windows Server 2012 R2
Storage Team Blog – iSCSI Target Storage (VDS/VSS) Provider
iSCSI Target Cmdlets in Windows PowerShell
MultiPath I/O (MPIO) Cmdlets in Windows PowerShell
Bruce Langworthy – MSFT: Managing iSCSI Initiator connections with Windows PowerShell on Windows Server 2012

Check out the other post in this series!