Today, we will learn how to install and configure the iSCSI Target & Initiator on Windows Server 2022. But before that, we need to know what iSCSI is!

What is iSCSI?

Internet Small Computer System Interface commonly abbreviated as iSCSI is a storage networking protocol that makes it possible to transmit SCSI (Small Computer System Interface) over TCP/IP networks. This is to mean that iSCSI enables the use of block-level storage over Ethernet networks, allowing a server to access storage devices as if they were locally attached, even if the storage devices are physically located in a different location. This can be beneficial for storage consolidation, disaster recovery, and virtualization. IBM is credited with originating the concept of iSCSI in 1998. The initial version of the protocol was proposed to the Internet Engineering Task Force (IETF) in 2000.

iSCSI works by encapsulating SCSI commands and data into IP packets for transmission over TCP/IP networks, allowing SCSI storage devices to be accessed over standard Ethernet connections. In iSCSI, packets are transmitted over a point-to-point connection and are then disassembled upon arrival. Once disassembled, the system can read the commands contained within the packets. This allows the shared storage to be seen as if it were locally mounted, and the shared block storage can include a range of options such as LVM partitions, HDD/SSD partitions, or other block files.

Normally, iSCSI works with the client-server model:

  • iSCSI target: To enable access to the storage resources, iSCSI requires a server setup that includes one or more NICs (network interface cards), HBAs (host bus adapters), or iSOEs (iSCSI offload engines). These components work together to create the necessary connection between the server and the storage resources.
  • iSCSI initiator: This is the client tool that makes it possible to send and receive the packets from the iSCSI target.

The below image can be used to understand the iSCSI architecture:

iSCSI architecture

Install iSCSI Target on Windows Server 2022

We will begin by installing the iSCSI Target on Windows Server 2022. To achieve this, you can use any of the two options below:

  • GUI
  • PowerShell

Method 1: Install iSCSI Target on Windows Server 2022 using GUI

To install the iSCSI Target on Windows Server 2022 using GUI, launch the server manager and click Add roles and features

How To Configure iSCSI Target Initiator on Windows Server 2022

Select role-based or feature-based installation

How To Configure iSCSI Target Initiator on Windows Server 2022 1

Select the destination server:

How To Configure iSCSI Target Initiator on Windows Server 2022 2

In the features tab, select the iSCSI Target then, Add Features button.

Configure iSCSI Target Initiator on Windows Server 2022 7

Once the installation is complete, close and proceed to the configuration.

Configure iSCSI Target Initiator on Windows Server 2022 8

Method 2: Install iSCSI Target on Windows Server 2022 using PowerShell

You can also install the iSCSI Target on your Windows Server 2022 using PowerShell. First, launch PowerShell with admin privileges then run the below command:

Install-WindowsFeature FS-iSCSITarget-Server -IncludeManagementTools

Sample Output:

How To Configure iSCSI Target Initiator on Windows Server 2022 5

Configure iSCSI Target on Windows Server 2022

Similar to installing, you can configure the iSCSI Target on Windows Server 2022 using both the GUI and the PowerShell. Follow any of the below methods to configure the iSCSI Target on Windows Server 2022.

Method 1: Configure iSCSI Target on Windows Server 2022 using GUI

On the server manager, click File and Storage Services. On the left pane, click on Tasks and select New iSCSI Virtual Disk.

Configure iSCSI Target Initiator on Windows Server 2022 9

On this tab, you are required to specify the name of the server and volume. For this guide, we have a disk/directory created on path C:iSCSIstorage

Configure iSCSI Target Initiator on Windows Server 2022 10

Set the name of your iSCSI virtual disk.

Configure iSCSI Target Initiator on Windows Server 2022 11

Specify the disk size of the virtual disk

Configure iSCSI Target Initiator on Windows Server 2022 12

Next, create a new iSCSI Target for the disk.

Configure iSCSI Target Initiator on Windows Server 2022 13

Set the name for the iSCSI Target.

Configure iSCSI Target Initiator on Windows Server 2022 14

Next, specify the initiators that are allowed to connect to the Target.

Configure iSCSI Target Initiator on Windows Server 2022 15

On this page, click add. You can provide the IP address of the initiator.

Configure iSCSI Target Initiator on Windows Server 2022 16

Configure the authentication to be used. For this example, we will use the CHAP method. Configure the username and password to be used when connecting to the iSCSI Target.

Configure iSCSI Target Initiator on Windows Server 2022 17

Now create the iSCSI Target.

Configure iSCSI Target Initiator on Windows Server 2022 19

Once complete, close the window. You will have a new disk created as shown:

Configure iSCSI Target Initiator on Windows Server 2022 20

Method 2: Configure iSCSI Target on Windows Server 2022 using PowerShell

All the above configurations can still be performed from the PowerShell. Launch PowerShell with elevated privileges and execute the below command to create an iSCSI Target.

New-IscsiServerTarget -TargetName "iscsiTarget01" -InitiatorId @("IPAddress:192.168.200.66","IPAddress:192.168.200.55") 

The above command provides the iSCSI Target name and the Initiator IP addresses for example 192.168.200.66 and 192.168.200.55.

Next, create a virtual disk by specifying the PATH and disk size :

New-IscsiVirtualDisk -Path "C:\iSCSIstorage\Disk01.vhdx" -SizeBytes 10GB

Next, assign the disk to the SCSI Target created earlier:

Add-IscsiVirtualDiskTargetMapping -TargetName "iscsiTarget01" -Path "C:\iSCSIstorage\Disk01.vhdx" 

Enable and configure the authentication method.:

Set-IscsiServerTarget `
-TargetName "iscsiTarget01" `
-EnableChap $True `
-Chap (New-Object PSCredential("windows", (ConvertTo-SecureString -AsPlainText "StrongPassw0rd!" -Force)))`
-PassThru 

View and confirm the made settings:

Get-IscsiServerTarget -TargetName "iscsiTarget01" 

Sample Output:

Configure iSCSI Target Initiator on Windows Server 2022 21

For the changes to apply, restart the service:

Restart-Service -Name WinTarget 

Configure the iSCSI Initiator on Windows Server 2022

The iSCSI Initiator is the client tool to connect and use the virtual disk on the iSCSI Target. There are two ways of installing and configuring the iSCSI Initiator on Windows Server 2022.

The two methods are:

  • Using GUI
  • Using PowerShell

Method 1: Configure the iSCSI Initiator on Windows Server 2022 using GUI

On the selected server as the iSCSI Initiator, launch the server manager and open tools. Here select the iSCSI Initiator

Configure iSCSI Target Initiator on Windows Server 2022 22

Start the service:

Configure iSCSI Target Initiator on Windows Server 2022 23

Provide the iSCSI Target’s IP address or hostname on this page and click Quick Connect.

Configure iSCSI Target Initiator on Windows Server 2022 24

You will see the Target detected as shown, click done and proceed

Configure iSCSI Target Initiator on Windows Server 2022 25

Now click on the connect to the Target:

Configure iSCSI Target Initiator on Windows Server 2022 26

On the below page, click on Advanced options

Configure iSCSI Target Initiator on Windows Server 2022 27

On this page, enable the CHAP authentication, and provide the username and password as configured:

Configure iSCSI Target Initiator on Windows Server 2022 28

Finally, click the OK button.

Configure iSCSI Target Initiator on Windows Server 2022 29

The status will change to connected.

Configure iSCSI Target Initiator on Windows Server 2022 30

Open the Disks, you will see the new iSCSI virtual disk.

Configure iSCSI Target Initiator on Windows Server 2022 31

Now right-click and bring the disk on

Configure iSCSI Target Initiator on Windows Server 2022 32

Next, initialize the disk.

Configure iSCSI Target Initiator on Windows Server 2022 33

Create a new volume on the disk.

Configure iSCSI Target Initiator on Windows Server 2022 34

Follow through the process and assign a drive letter to it.

Configure iSCSI Target Initiator on Windows Server 2022 35

You also need to provide a name for the disk.

Configure iSCSI Target Initiator on Windows Server 2022 36

Once a volume has been created, the disk will now appear as shown:

Configure iSCSI Target Initiator on Windows Server 2022 37

Method 2: Configure the iSCSI Initiator on Windows Server 2022 using PowerShell

You can also configure the iSCSI Initiator from the PowerShell. Follow the below steps after launching PowerShell with admin permissions.

First, start the service:

Start-Service -Name MSiSCSI 

Provide the iSCSI Target IP address/hostname:

Set-Service -Name MSiSCSI -StartupType Automatic 

Connect to the Target:

New-IscsiTargetPortal -TargetPortalAddress "192.168.200.65" 

Get the Target information:

Get-IscsiTarget 

Sample Output:

Configure iSCSI Target Initiator on Windows Server 2022 39

From the above output, the connection status is still false. For the connection to be successful, we need to add authentication.

Connect-IscsiTarget `
-NodeAddress iqn.1991-05.com.microsoft:rx-7-iscsitarget01-target `
-AuthenticationType ONEWAYCHAP `
-ChapUsername "windows" `
-ChapSecret "StrongPassw0rd!" `
-IsPersistent $True 

View the connection:

Get-IscsiConnection 

Sample Output:

Configure iSCSI Target Initiator on Windows Server 2022 40

Now view if the iSCSI disk is available:

Get-Disk | Format-Table -AutoSize -Wrap

Sample Output:

Configure iSCSI Target Initiator on Windows Server 2022 41

Enable read/write on the iSCSI disk. For this case, it is assigned number 1

Set-Disk -Number 1 -IsOffline $False

Initialize the disk:

Initialize-Disk -Number 1 -PartitionStyle GPT 

Confirm the made changes:

Get-Disk | Format-Table -AutoSize -Wrap 

Now assign a drive letter to the disk:

New-Partition -DiskNumber 1 -UseMaximumSize -AssignDriveLetter 

Format the disk to NTFS:

Format-Volume -DriveLetter E -FileSystem NTFS -Force 

Confirm the changes

Get-Volume | Format-Table -AutoSize -Wrap

Sample Output:

Configure iSCSI Target Initiator on Windows Server 2022 42

The end!

This guide has provided the required knowledge on configuring iSCSI Target & Initiator on Windows Server 2022. Now you are set to use iSCSI on Windows Server 2022 as desired. I hope this was insightful.

See more:

LEAVE A REPLY

Please enter your comment!
Please enter your name here