Windows 2019
Sponsored Link

Windows Server Failover Clustering : Shared Storage (CUI)
2019/07/09
 
Configure Windows Server Failover Clustering (WSFC).
It needs more than 2 Nodes to configure WSFC and also they are in Active Directory Domain.
Furthermore, they need more than 2 shared storages, for Data and for Quorum.
Considering the above, this example is based on the environment like follows.
                                   |
+----------------------+           |           +----------------------+
|  [      AD DS     ]  |10.0.0.100 | 10.0.0.110|  [  iSCSI Target  ]  |
|    fd3s.srv.world    +-----------+-----------+    tgt01.srv.world   |
|                      |           |           |                      |
+----------------------+           |           +----------------------+
                                   |
+----------------------+           |           +----------------------+
|  [ Cluster Node#1 ]  |10.0.0.101 | 10.0.0.102|  [ Cluster Node#2 ]  |
|    rx-7.srv.world    +-----------+-----------+    rx-8.srv.world    |
|                      |                       |                      |
+----------------------+                       +----------------------+

 
On CUI Configuration, run PowerShell and Set like follows.
[1]
[2] Configure 2 shared storage on iSCSI Target Server.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

# create [iSCSITarget01] target
# specify Nodes for InitiatorId
PS C:\Users\Administrator> New-IscsiServerTarget -TargetName "iSCSITarget01" -InitiatorId @("IPAddress:10.0.0.101","IPAddress:10.0.0.102") 

ChapUserName                :
ClusterGroupName            :
ComputerName                : RX-7.srv.world
Description                 :
EnableChap                  : False
EnableReverseChap           : False
EnforceIdleTimeoutDetection : True
FirstBurstLength            : 65536
IdleDuration                : 00:00:00
InitiatorIds                : {IPAddress:10.0.0.110, IPAddress:10.0.0.111}
LastLogin                   :
LunMappings                 : {}
MaxBurstLength              : 262144
MaxReceiveDataSegmentLength : 65536
ReceiveBufferCount          : 10
ReverseChapUserName         :
Sessions                    : {}
Status                      : NotConnected
TargetIqn                   : iqn.1991-05.com.microsoft:rx-7-iscsitarget01-target
TargetName                  : iSCSITarget01

# create a disk for Quorum (generally 512MB is enough size)
PS C:\Users\Administrator> New-IscsiVirtualDisk -Path "C:\iSCSIDisk\Quorum01.vhdx" -SizeBytes 512MB 

ClusterGroupName   :
ComputerName       : tgt01.srv.world
Description        :
DiskType           : Dynamic
HostVolumeId       : {808CAB52-0000-0000-0000-602200000000}
LocalMountDeviceId :
OriginalPath       :
ParentPath         :
Path               : C:\iSCSIDisk\Quorum01.vhdx
SerialNumber       : 461F99AA-A539-4124-926B-159F065674A4
Size               : 536870912
SnapshotIds        :
Status             : NotConnected
VirtualDiskIndex   : 1241990459

# create a disk for Data (specify any size you need for Data disk)
PS C:\Users\Administrator> New-IscsiVirtualDisk -Path "C:\iSCSIDisk\Disk01.vhdx" -SizeBytes 30GB 

ClusterGroupName   :
ComputerName       : tgt01.srv.world
Description        :
DiskType           : Dynamic
HostVolumeId       : {808CAB52-0000-0000-0000-602200000000}
LocalMountDeviceId :
OriginalPath       :
ParentPath         :
Path               : C:\iSCSIDisk\Disk01.vhdx
SerialNumber       : B47F9A77-8598-4D9B-A40C-B18760356FC6
Size               : 32212254720
SnapshotIds        :
Status             : NotConnected
VirtualDiskIndex   : 1389577936

# assign disks to iSCSI target
PS C:\Users\Administrator> Add-IscsiVirtualDiskTargetMapping -TargetName "iSCSITarget01" -Path "C:\iSCSIDisk\Quorum01.vhdx" 
PS C:\Users\Administrator> Add-IscsiVirtualDiskTargetMapping -TargetName "iSCSITarget01" -Path "C:\iSCSIDisk\Disk01.vhdx" 

# enable CHAP for iSCSI Target and set Username and Password for authentication
# required password length over 12 chars
PS C:\Users\Administrator> Set-IscsiServerTarget `
-TargetName "iSCSITarget01" `
-EnableChap $True `
-Chap (New-Object PSCredential("username", (ConvertTo-SecureString -AsPlainText "UserP@ssw0rd01" -Force)))`
-PassThru 

ChapUserName                : username
ClusterGroupName            :
ComputerName                : tgt01.srv.world
Description                 :
EnableChap                  : True
EnableReverseChap           : False
EnforceIdleTimeoutDetection : True
FirstBurstLength            : 65536
IdleDuration                : 00:13:44
InitiatorIds                : {IPAddress:10.0.0.101, IPAddress:10.0.0.102}
LastLogin                   :
LunMappings                 : {TargetName:iSCSITarget01;VHD:"C:\iSCSIDisk\Quorum01.vhdx";LUN:0, TargetName:iSCSITarget0
                              1;VHD:"C:\iSCSIDisk\Disk01.vhdx";LUN:1}
MaxBurstLength              : 262144
MaxReceiveDataSegmentLength : 65536
ReceiveBufferCount          : 10
ReverseChapUserName         :
Sessions                    : {}
Status                      : NotConnected
TargetIqn                   : iqn.1991-05.com.microsoft:tgt01-iscsitarget01-target
TargetName                  : iSCSITarget01

# confirm settings
PS C:\Users\Administrator> Get-IscsiServerTarget -TargetName "iSCSITarget01" 

ChapUserName                : username
ClusterGroupName            :
ComputerName                : tgt01.srv.world
Description                 :
EnableChap                  : True
EnableReverseChap           : False
EnforceIdleTimeoutDetection : True
FirstBurstLength            : 65536
IdleDuration                : 00:14:01
InitiatorIds                : {IPAddress:10.0.0.101, IPAddress:10.0.0.102}
LastLogin                   :
LunMappings                 : {TargetName:iSCSITarget01;VHD:"C:\iSCSIDisk\Quorum01.vhdx";LUN:0, TargetName:iSCSITarget0
                              1;VHD:"C:\iSCSIDisk\Disk01.vhdx";LUN:1}
MaxBurstLength              : 262144
MaxReceiveDataSegmentLength : 65536
ReceiveBufferCount          : 10
ReverseChapUserName         :
Sessions                    : {}
Status                      : NotConnected
TargetIqn                   : iqn.1991-05.com.microsoft:tgt01-iscsitarget01-target
TargetName                  : iSCSITarget01

# restart service
PS C:\Users\Administrator> Restart-Service -Name WinTarget 
[3] Configure iSCSI Initiator and login to Target Server on all Cluster Nodes.
PS C:\Users\Administrator> Start-Service -Name MSiSCSI 
PS C:\Users\Administrator> Set-Service -Name MSiSCSI -StartupType Automatic 
PS C:\Users\Administrator> New-IscsiTargetPortal -TargetPortalAddress "10.0.0.110" 

InitiatorInstanceName  :
InitiatorPortalAddress :
IsDataDigest           : False
IsHeaderDigest         : False
TargetPortalAddress    : 10.0.0.110
TargetPortalPortNumber : 3260
PSComputerName         :

PS C:\Users\Administrator> Get-IscsiTarget 

IsConnected NodeAddress                                          PSComputerName
----------- -----------                                          --------------
      False iqn.1991-05.com.microsoft:tgt01-iscsitarget01-target

PS C:\Users\Administrator> Connect-IscsiTarget `
-NodeAddress iqn.1991-05.com.microsoft:tgt01-iscsitarget01-target `
-AuthenticationType ONEWAYCHAP `
-ChapUsername "username" `
-ChapSecret "UserP@ssw0rd01" `
-IsPersistent $True 

AuthenticationType      : ONEWAYCHAP
InitiatorInstanceName   : ROOT\ISCSIPRT\0000_0
InitiatorNodeAddress    : iqn.1991-05.com.microsoft:rx-7.srv.world
InitiatorPortalAddress  : 0.0.0.0
InitiatorSideIdentifier : 400001370000
IsConnected             : True
IsDataDigest            : False
IsDiscovered            : True
IsHeaderDigest          : False
IsPersistent            : True
NumberOfConnections     : 1
SessionIdentifier       : ffffc6096ff83010-4000013700000002
TargetNodeAddress       : iqn.1991-05.com.microsoft:tgt01-iscsitarget01-target
TargetSideIdentifier    : 0100
PSComputerName          :

PS C:\Users\Administrator> Get-IscsiConnection 

ConnectionIdentifier : ffffc6096ff83010-1
InitiatorAddress     : 0.0.0.0
InitiatorPortNumber  : 31170
TargetAddress        : 10.0.0.110
TargetPortNumber     : 3260
PSComputerName       :
[4] On a Node in Cluster, Format iSCSI disk with NTFS.
# show disks
PS C:\Users\Administrator> Get-Disk | Format-Table -AutoSize -Wrap 
Number Friendly Name   Serial Number                        HealthStatus OperationalStatus Total Size Partition Style
------ -------------   -------------                        ------------ ----------------- ---------- ---------------
1      MSFT Virtual HD 461F99AA-A539-4124-926B-159F065674A4 Healthy      Offline               512 MB RAW
2      MSFT Virtual HD B47F9A77-8598-4D9B-A40C-B18760356FC6 Healthy      Offline                30 GB RAW
0      Red Hat VirtIO                  

# turn to online and initialize with GPT
PS C:\Users\Administrator> Set-Disk -Number 1 -IsOffline $False 
PS C:\Users\Administrator> Set-Disk -Number 2 -IsOffline $False 
PS C:\Users\Administrator> Initialize-Disk -Number 1 -PartitionStyle GPT 
PS C:\Users\Administrator> Initialize-Disk -Number 2 -PartitionStyle GPT 

# create partition with assigning drive letter
PS C:\Users\Administrator> New-Partition -DiskNumber 1 -UseMaximumSize -AssignDriveLetter 

   DiskPath: \\?\scsi#disk&ven_msft&prod_virtual_hd#1&1c121344&0&000000#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}

PartitionNumber  DriveLetter Offset                                        Size Type
---------------  ----------- ------                                        ---- ----
2                D           16777216                                 495.94 MB Basic

PS C:\Users\Administrator> New-Partition -DiskNumber 2 -UseMaximumSize -AssignDriveLetter 

   DiskPath: \\?\scsi#disk&ven_msft&prod_virtual_hd#1&1c121344&0&000001#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}

PartitionNumber  DriveLetter Offset                                        Size Type
---------------  ----------- ------                                        ---- ----
2                E           16777216                                  29.98 GB Basic

# format with NTFS
PS C:\Users\Administrator> Format-Volume -DriveLetter D -FileSystem NTFS -Force 

DriveLetter FriendlyName FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining      Size
----------- ------------ -------------- --------- ------------ ----------------- -------------      ----
D                        NTFS           Fixed     Healthy      OK                    479.76 MB 495.93 MB

PS C:\Users\Administrator> Format-Volume -DriveLetter E -FileSystem NTFS -Force 

DriveLetter FriendlyName FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining     Size
----------- ------------ -------------- --------- ------------ ----------------- -------------     ----
E                        NTFS           Fixed     Healthy      OK                     29.91 GB 29.98 GB
Matched Content