Windows 2019
Sponsored Link

iSCSI : Configure iSCSI Initiator (CUI)2019/04/10

 
Configure iSCSI Initiator.
This example is based on Windows Server 2019, but it's the same procedure on Windows 10.
On CUI configuration, set like follows.
[1] Run PowerShell with Admin Privilege and Configure iSCSI Initiator.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

# start iSCSI Initiator service & set [automatic] for Startup
PS C:\Users\Administrator> Start-Service -Name MSiSCSI 
PS C:\Users\Administrator> Set-Service -Name MSiSCSI -StartupType Automatic 

# set iSCSI Target to connect to
PS C:\Users\Administrator> New-IscsiTargetPortal -TargetPortalAddress "10.0.0.101" 

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

# show iSCSI Target
PS C:\Users\Administrator> Get-IscsiTarget 

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

# connect to iSCSI Target
# [-NodeAddress] ⇒ the name confirmed above
# [-ChapUsername] ⇒ username that you set on iSCSI Target Config
# [-ChapUsername] ⇒ password of the user above
PS C:\Users\Administrator> Connect-IscsiTarget `
-NodeAddress iqn.1991-05.com.microsoft:rx-7-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-8.srv.world
InitiatorPortalAddress  : 0.0.0.0
InitiatorSideIdentifier : 400001370000
IsConnected             : True
IsDataDigest            : False
IsDiscovered            : True
IsHeaderDigest          : False
IsPersistent            : True
NumberOfConnections     : 1
SessionIdentifier       : ffffad8000e19010-400001370000001a
TargetNodeAddress       : iqn.1991-05.com.microsoft:rx-7-iscsitarget01-target
TargetSideIdentifier    : 0100
PSComputerName          :

# show established connection
PS C:\Users\Administrator> Get-IscsiConnection 

ConnectionIdentifier : ffffad8000e19010-19
InitiatorAddress     : 0.0.0.0
InitiatorPortNumber  : 16322
TargetAddress        : 10.0.0.101
TargetPortNumber     : 3260
PSComputerName       :

# show disks
# on the example blow, [Number 1] is the iSCSI disk
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 D1F8597A-48E9-483F-93EB-84CEDBAD5011 Healthy      Offline                10 GB RAW
0      Red Hat VirtIO                                       Healthy      Online                 80 GB MBR
[2] To enable to read or write to iSCSI disks, set like follows.
# turn it online
PS C:\Users\Administrator> Set-Disk -Number 1 -IsOffline $False 

# initialize it with GPT partitoon type
PS C:\Users\Administrator> Initialize-Disk -Number 1 -PartitionStyle GPT 

# confirm settings
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 D1F8597A-48E9-483F-93EB-84CEDBAD5011 Healthy      Online                 10 GB GPT
0      Red Hat VirtIO                                       Healthy      Online                 80 GB MBR

# assign drive letter and create partition
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                                   9.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                      9.94 GB 9.98 GB

# confirm settings
PS C:\Users\Administrator> Get-Volume | Format-Table -AutoSize -Wrap 

DriveLetter FriendlyName FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining     Size
----------- ------------ -------------- --------- ------------ ----------------- -------------     ----
D                        NTFS           Fixed     Healthy      OK                      9.94 GB  9.98 GB
                         NTFS           Fixed     Healthy      OK                    514.32 MB   549 MB
C                        NTFS           Fixed     Healthy      OK                     64.48 GB 79.46 GB
Matched Content