Cấu hình với Powershell
trên Powershell chạy với quyền admin và cấu hình iSCSI Initiator như sau.
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
Tiếp theo, để cho phép iSCSI đọc hoặc ghi vào ổ đĩa bạn làm như sau
# 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
cấu hình trên GUI
Mở Server Manager và chọn Tools – iSCSI Initiator

Tiếp theo, bạn nhấn chọn vào Yes để tiếp tục. Do iSCSI không cài đặt mặc định nên thông báo này được hiển thị

tiếp theo, nhập tên máy chủ hoặc địa chỉ IP của Target và chọn Quick Connect.

Sau khi iSCSI target đã phát hiện, nhấn chọn Done

Chọn Connect để tiếp tục.

Tiếp theo, chọn Advanced…

Tiếp theo, tích chọn vào Enable CHAP log on để tạo tài tên tài khoản và mật khẩu cho người dùng trên các tệp.

Chọn OK để tiếp tục.

Nếu không có lỗi gì xảy ra, thì Status sẽ thông báo là Connected

Trên Disk Management, đĩa iSCSI được đính kèm như sau.

Để sử dụng đĩa iSCSI, hãy bật nó trực tuyến đồng thời khởi tạo và gán ổ đĩa cho nó.
