Blog

The iSCSI (Internet Small Computer System Interface) protocol is an implementation of the SCSI protocol over IP, enabling servers to connect to storage systems via a standard TCP/IP network without requiring Fibre Channel. In this article, we’ll cover the setup of an iSCSI storage on Windows Server 2019 and its utilization on other servers (the configuration process is similar in Windows Server 2016 and 2012 R2). Use case example: a file server requires additional storage capacity, and we connect a virtual disk from another storage server over iSCSI via the network.

You can purchase original Windows Server product keys in our catalog starting at 10.8 €.

Creating and Configuring an iSCSI Target

The first step is to create an iSCSI target (server). To do this, you need to enable the iSCSI Target Server role on the server hosting the storage. This can be done via the GUI or a PowerShell command.

1. Enable the iSCSI Target Server Role:

– Open Server Manager -> File and Storage Services -> File and iSCSI Services and install the iSCSI role.

– Alternatively, install it via PowerShell with the command:

Install-WindowsFeature -Name FS-iSCSITarget-Server

2. Creating an iSCSI Virtual Disk:

– In Server Manager, navigate to File and Storage Services -> iSCSI and launch the New iSCSI Virtual Disk Wizard.

– Select the physical disk where the virtual iSCSI disk will be created, specify its name and type (Fixed Size, Dynamically Expanding, or Differencing).

– At the initiator selection stage (servers connecting to the target), choose an identification method: IP Address, IQN, DNS Name, or MAC Address. We’ll use the IP Address option.

– If needed, configure authentication via CHAP: enter a username and a password (minimum 12 characters).

3. Example of Creating an iSCSI Disk via PowerShell:

– Create a 200 GB virtual disk:

New-IscsiVirtualDisk -Path C:\iSCSIVirtualDisks\iscsiDisk2.vhdx -Size 200GB

By default, this creates a dynamically expanding disk with a block size of 4,096 KB, regardless of the size specified in the Size parameter. The disk will grow as needed.

– To create a fixed-size disk:

New-IscsiVirtualDisk -Path C:\iSCSIVirtualDisks\iscsiDisk2.vhdx -Size 200GB -UseFixed

4. Configuring the Target and Access Permissions:

– Assign a name to the target and allow access from a specific IP address:

New-IscsiServerTarget -TargetName "iscsiTarget33" -InitiatorId @("IPAddress:172.17.244.8")

– Alternatively, use an IQN name for connection:

New-IscsiServerTarget -TargetName iscsiTarget33 -InitiatorIds "IQN: 1991-05.com.microsoft:win2019test.ddd.com"

5. Verifying the Result:

– Retrieve the list of targets and LUNs:

Get-IscsiServerTarget | fl TargetName, LunMappings

– Obtain the full target name with:

Get-IscsiTarget

– Connect to the target:

Connect-IscsiTarget -NodeAddress iqn.1991-05.com.microsoft:win2019test-iscsitarget33-target

Configuring the iSCSI Initiator on Windows Server

The next step is connecting to the created iSCSI disk from a second initiator server.

1. Launching the iSCSI Initiator:

– Open Control Panel -> iSCSI Initiator or run the command iscsicpl.exe.

– Ensure the Microsoft iSCSI Initiator Service is set to start automatically:

Set-Service -Name MSiSCSI -StartupType Automatic

2. Configuring the Connection:

– Go to the Discovery tab, click Discover Portal, and enter the iSCSI target IP address.

– Click Advanced and modify the default dropdown values: Local Adapter -> Microsoft iSCSI Initiator, Initiator IP -> 172.17.244.8.

– To connect to the iSCSI storage, ensure ports 860 and 3260 are open in Windows Firewall.

3. Connecting to the Target:

– Go to the Targets tab, where a new connection will appear. To enable it, click Connect -> Advanced, select values from the dropdowns, check Enable CHAP log on, and enter the username and a 12-character password.

4. Initializing the iSCSI Disk:

– After connecting, the disk will be in an Offline state. Open the Disk Management console, select the new disk, set it to Online, and then perform Initialize Disk.

– Create partitions on the disk and format it as NTFS.

For quick initialization and formatting of a new disk, use this one-line PowerShell command:

Get-Disk | Where-Object PartitionStyle -eq 'RAW' | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -Confirm:$false

Important: iSCSI disks do not support the ReFS file system.

Now, this virtual disk, connected from another server via the iSCSI protocol, can be used as a standard locally attached disk.

5. Connecting an iSCSI Disk via PowerShell

You can also connect an iSCSI disk on the initiator using PowerShell. To retrieve the target’s IQN, run:

Get-iSCSITarget

To connect, execute:

Connect-IscsiTarget –IsPersistent $False

If using CHAP authentication, the connection command is:

Get-iScsiTarget | Connect-iScsitarget –AuthenticationType ONEWAYCHAP –ChapUserName -ChapSecret

For high availability and load balancing, configure multiple redundant network components (network adapters, switches) and use the MPIO (Multipath I/O) module.

Configuring and connecting iSCSI disks in Windows Server is a straightforward and flexible solution for expanding storage or building fault-tolerant clusters. Using iSCSI, disks can be connected over the network as either local storage or network resources, enabling efficient data management.

banner for Windows Server
Buy Windows Server product key from
10.8 € Find Out More
Subscribe
Notify of
guest
0 comments
Newest
Oldest
Inline Feedbacks
View all comments