Introduction
In this article, we will explore the what, who, where, when, why, and how of Internet Small Computer System Interface (iSCSI) as Storage Server functionality on the Windows Server 2019 platform, so let's get started.
Overview
iSCSI (Internet Small Computer System Interface) is a protocol that allows clients (initiators) to send SCSI commands to storage devices (targets) over IP networks.
What
iSCSI is a network protocol that uses IP networks to transmit SCSI commands, enabling the use of storage area networks (SANs) over TCP/IP networks. It facilitates block-level data transfer between servers and storage devices.
Who
iSCSI is widely used by enterprises, data centers, and organizations of all sizes that require scalable and efficient storage solutions. IT professionals and network administrators typically manage iSCSI implementations.
Where
iSCSI is implemented in data centers, enterprise networks, and any environment that requires network-based storage solutions. It can be used over LANs, WANs, or the Internet.
When
iSCSI is used when there is a need for network-attached storage solutions that provide flexibility, scalability, and cost-effectiveness. It is especially useful in virtualized environments and disaster recovery scenarios.
Why
Using iSCSI offers several advantages and some disadvantages:
Pros | Cons |
---|---|
Cost-effective compared to traditional SANs. | Performance may be limited by network bandwidth. |
Utilizes existing IP infrastructure. | Network congestion can impact performance. |
Easy to set up and configure. | Requires proper network management and security. |
Scalable and flexible storage solution. | Potential for latency issues in high-traffic networks. |
How
Setting up iSCSI involves several steps:
Install iSCSI Software | Use your operating system’s package manager to install iSCSI initiator and target software (e.g., `apt-get install open-iscsi` on Ubuntu). |
Configure iSCSI Target | Set up the storage device as an iSCSI target by defining the IQN, LUNs, and network interfaces. |
Configure iSCSI Initiator | Set up the client device to connect to the iSCSI target by defining the target IQN and network address. |
Test the Configuration | Connect the initiator to the target and verify that the storage is accessible and performs as expected. |
Consequences
Implementing iSCSI has both positive and negative consequences:
Positive |
|
Negative |
|
Conclusion
iSCSI is a powerful and cost-effective solution for network-based storage, offering flexibility and scalability. While it provides significant advantages, such as reduced costs and easy configuration, it requires careful network management to avoid performance and security issues. Overall, iSCSI is a valuable tool for organizations looking to optimize their storage infrastructure.
Install iSCSI Target
Install iSCSI Target to configure Storage Server. A storage on a network is called iSCSI Target, a Client that connects to iSCSI Target is called iSCSI Initiator.
Using Command Line Interface (CLI)
Step [1]Run PowerShell with Admin Privilege and Install iSCSI Target Server.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
# install iSCSI Target with admin tools
PS C:\Users\Administrator> Install-WindowsFeature FS-iSCSITarget-Server -IncludeManagementTools
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True Yes SuccessRest... ...
WARNING: You must restart this server to finish the installation process.
# restart computer to apply changes
PS C:\Users\Administrator> Restart-Computer -Force
Using Graphical User Interface (GUI)
On GUI installation, Set like follows.
Step [2]Run Server Manager and Click [Add roles and features].
Step [3]Click [Next] button.
Step [4]Select [Role-based or feature-based installation].
Step [5]Select a Host which you'd like to add services.
Step [6]Check a box [iSCSI Target Server].
Step [7]Addtional features are required to add iSCSI Target. Click [Add Features] button and proceed Next.
Step [8]Click [Next] button.
Step [9]Click [Install] button.
Step [10]After finishing installation, click [Close] button.
Configure iSCSI Target
Configure iSCSI Target Server. A storage on a network is called iSCSI Target, a Client which connects to iSCSI Target is called iSCSI Initiator.
Using Command Line Interface (CLI)
Step [1]Run PowerShell with Admin Privilege and Configure iSCSI Target Server.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
# create iSCSI Target
# [-TargetName] ⇒ any Target name
# [InitiatorId] ⇒ specify Initiators to allow to connect to Target
# for specifying Initiators, possible to specify methods like follows not only IPAddress
# IPAddress, IPv6Address, DNSName, IQN, MACAddress
PS C:\Users\Administrator> New-IscsiServerTarget -TargetName "iSCSITarget01" -InitiatorId @("IPAddress:10.0.0.110","IPAddress:10.0.0.111")
ChapUserName :
ClusterGroupName :
ComputerName : RX-7.bizantum.local
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 iSCSI virtual disk
# [-Path] ⇒ any PATH you'd like to create v-disk
# [-SizeBytes] ⇒ disk size
PS C:\Users\Administrator> New-IscsiVirtualDisk -Path "C:\iSCSIDisk\Disk01.vhdx" -SizeBytes 10GB
ClusterGroupName :
ComputerName : RX-7.bizantum.local
Description :
DiskType : Dynamic
HostVolumeId : {808CAB52-0000-0000-0000-602200000000}
LocalMountDeviceId :
OriginalPath :
ParentPath :
Path : C:\iSCSIDisk\Disk01.vhdx
SerialNumber : D1F8597A-48E9-483F-93EB-84CEDBAD5011
Size : 10737418240
SnapshotIds :
Status : NotConnected
VirtualDiskIndex : 2102166038
# assign iSCSI virtual disk to iSCSI Target
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 : RX-7.bizantum.local
Description :
EnableChap : True
EnableReverseChap : False
EnforceIdleTimeoutDetection : True
FirstBurstLength : 65536
IdleDuration : 00:36:56
InitiatorIds : {IPAddress:10.0.0.110, IPAddress:10.0.0.111}
LastLogin :
LunMappings : {TargetName:iSCSITarget01;VHD:"C:\iSCSIDisk\Disk01.vhdx";LUN:0}
MaxBurstLength : 262144
MaxReceiveDataSegmentLength : 65536
ReceiveBufferCount : 10
ReverseChapUserName :
Sessions : {}
Status : NotConnected
TargetIqn : iqn.1991-05.com.microsoft:rx-7-iscsitarget01-target
TargetName : iSCSITarget01
# confirm settings
PS C:\Users\Administrator> Get-IscsiServerTarget -TargetName "iSCSITarget01"
ChapUserName : username
ClusterGroupName :
ComputerName : RX-7.bizantum.local
Description :
EnableChap : True
EnableReverseChap : False
EnforceIdleTimeoutDetection : True
FirstBurstLength : 65536
IdleDuration : 00:40:38
InitiatorIds : {IPAddress:10.0.0.110, IPAddress:10.0.0.111}
LastLogin :
LunMappings : {TargetName:iSCSITarget01;VHD:"C:\iSCSIDisk\Disk01.vhdx";LUN:0}
MaxBurstLength : 262144
MaxReceiveDataSegmentLength : 65536
ReceiveBufferCount : 10
ReverseChapUserName :
Sessions : {}
Status : NotConnected
TargetIqn : iqn.1991-05.com.microsoft:rx-7-iscsitarget01-target
TargetName : iSCSITarget01
# restart service
PS C:\Users\Administrator> Restart-Service -Name WinTarget
Using Graphical User Interface (GUI)
Step [2]Run Server Manager and Click [File and Storage Services].
Step [3]Select [iSCSI] on the left pane and click [To create an iSCSI.....] link on the right pane.
Step [4]Specify the server and volume for setting iSCSI disk. This example shows to configure a disk on a custom path (C:iSCSIDisk).
Step [5]Specify any name for virtual disk.
Step [6]Specify the disk size for virtual disk.
Step [7]Specify the iSCSI Target to assign this virtual disk. If the Target is new, select like follows.
Step [8]Specify any name for iSCSI Target.
Step [9]Specify access servers to this iSCSI Target. Click [Add...] button.
Step [10]Select a method to identify the initiator. This example shows to set initiators by IP address like follows.
Step [11]Configure authentication method between Target and Initiator. This example shows to configure CHAP like follows. If select CHAP, set username and password too that are used for connecting to Target from Initiator.
Step [12]If it's OK all, click [Create] button.
Step [13]After finishing creating, click [Close] button.
Step [14]A new virtual disk has been listed like follows.
Configure iSCSI Initiator
This example is based on Windows Server 2019, but it's the same procedure on Windows 10.
Using Command Line Interface (CLI)
Step [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.bizantum.local
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
Step [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
Using Graphical User Interface (GUI)
Step [3]Run Server Manager and Open [Tools] - [iSCSI Initiator].
Step [4]Click [Yes] button to proceed. This message is shown because iSCSI service is not running by default.
Step [5]Input Target's Hostname or IP address on [Target] field and click [Quick Connect] button.
Step [6]iSCSI Target has been detected like follows, click [Done] button.
Step [7]Click [Connect] button.
Step [8]Click [Advanced] button.
Step [9]Check a box [Enable CHAP log on] and specify username and password on the fileds. They are the just one you set on iSCSI Target's configuration.
Step [10]Click [OK] button.
Step [11]If it's no ploblem, the status turns to [Connected] like follows. It's OK to configure iSCSI initiator settings.
Step [12]On the [Disk Management] tool, the iSCSI Disk has been attached like follows.
Step [13]To use the iSCSI Disk, turn it online and also initialize and assign drive letter to it.
- Get link
- X
- Other Apps
Comments
Post a Comment
Thank you for your comment! We appreciate your feedback, feel free to check out more of our articles.
Best regards, Bizantum Blog Team.