Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / Windows Server 2019 / How to Configure and Connect an iSCSI Disk on Windows Server

March 15, 2024 Windows Server 2016Windows Server 2019

How to Configure and Connect an iSCSI Disk on Windows Server

iSCSI (Internet Small Computer System) is an SCSI protocol that allows to access storage devices over the IP protocol. Using iSCSI, you can connect your server to a shared network storage over a common TCP/IP network without using Fiber Channel (FC). In this article we’ll show how to configure an iSCSI target (virtual disk) on a server running Windows Server 2019 and connect this iSCSI LUN on other servers (in Windows Server 2016 and 2012 R2 it is configured in the same way). The first example of iSCSI usage: a file server needs more storage space, and we connect a virtual disk from another storage server over iSCSI. Another example is building of a failover cluster, when multiple servers need  to access a shared storage.

To use an iSCSI disk, you must configure a virtual disk (it is a common VHD/VHDX file) on a storage server and publish it as an iSCSI target, which iSCSI initiators (other servers or devices) connect to.

Contents:
  • Configuring an iSCSI Target on Windows Server
  • Install and Configure iSCSI Initiator on Windows Server

Configuring an iSCSI Target on Windows Server

First of all, open the Server Manager and enable the iSCSI Target Server role in File and Storage Services -> File and iSCSI Services.

server manager install iscsi target server role on windows server 2019

You can install the role from PowerShell:

Install-WindowsFeature -Name FS-iSCSITarget-Server

Then create a virtual disk on your iSCSI server. To do it, go to Server Manager -> File and Storage Services -> iSCSI and click To create an iSCSI virtual disk, start the New iSCSI Virtual Disk Wizard.

create new iSCSI virtual Disk Wizard

In the iSCSI virtual disk wizard, select a physical partition to place the virtual disk file. Then assign a name to the new iSCSI disk, set its size, type (Fixed Size, Dynamically expanding or Differencing) and the iSCSI target name.

At the Access Servers step, specify the servers (iSCSI initiators) that will be able to connect to the iSCSI target by selecting one of the following connection options:

  • IQN (you will have to enable iSCSI initiator on your server first and copy its IQN);
  • DNS Name;
  • IP Address;
  • MAC Address.

Let’s use the IP address option.

add iscsi initiator by an ip address on windows server

The next step in the wizard is to configure CHAP authentication protocol. It must be used if you want to authenticate the initiator’s connection. Enable it, enter a username and a 12-character password (or a longer one), and click Next -> Next -> Finish. Make sure that iscsiDisk2.vhdx has been created in D:\iSCSIVirtualDisks folder.

You can create an iSCSI disk using PowerShell. Let’s create a 200 GB virtual disk:

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

By default, a 4,096 KB dynamic disk is created independent of the value specified in the Size parameter. The dynamic disk will grow as needed.

create dynamic iscsi virtual disk file with New-IscsiVirtualDisk PowerShell cmdlet

If you want to use a fixed-sized disk (such disks reserve space on a physical drive when creating them), you can create it using the same command with the UseFixed parameter:

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

Use fixed VHDX file size for disks with high activity and higher IOPS requirements, because dynamic disks consume additional resources for incremental operations.

Then assign a name to the target. At this step, you can allow access to it from the initiator server IP address:

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

If you want, you can use an IQN name (iSCSI Qualified Name – a unique iSCSI device ID in the network) instead of the IP address:

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

New-IscsiServerTarget

Then it is recommended to check the result:

Get-IscsiServerTarget | fl TargetName, LunMappings

Get-IscsiServerTarget |

You can get a full target name using the Get-IscsiTarget cmdlet, and then connect the target:

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

Connect-IscsiTarget node

Install and Configure iSCSI Initiator on Windows Server

The next step is to connect to the virtual iSCSI disk you created from the second (initiator) server. Open the Control Panel and start the iSCSI initiator (or run iscsicpl.exe).

start microsoft iscsi initiator service on windows server

In the Service Management console (services.msc), set the automatic startup type for Microsoft iSCSI Initiator Service, or use this command:

Set-Service -Name MSiSCSI -StartupType Automatic

Go to the Discovery tab, click Discover Portal and enter the IP address of the first server (the iSCSI target). To route storage traffic through the specific network interface, click Advanced and change the default values in the dropdown lists to the following ones: Local Adapter –> Microsoft iSCSI Initiator, Initiator IP –> 172.17.244.8.

discovery iscsi target on windows server

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

Then go to the Targets tab and you will see a new connection there. To enable it, click Connect -> Advanced, select the values you want in the dropdown lists, check Enable CHAP log on and enter the user name and the 12-character password.

connect iscsi target on windows server initiator

Then initialize the iSCSI disk, which is initially in the Offline state. To do it, select Online, and then Initialize Disk in the context menu of the new disk in the Disk Management console. Create one or more partitions on the new disk and assign drive letters and labels to them. Format the volumes to NTFS.

To quickly initialize and format your new disk, you can use the following PowerShell one-liner (see an example in the article on disk and partition management with PowerShell):

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

Note. iSCSI disks don’t support ReFS.

Now you can use the virtual disk connected over iSCSI from another server as a common local drive.

bring iscsi drive online via disk management

Such virtual iSCSI disk may be used in Windows Server to create a virtual RAM drive in the memory.

You can also connect an iSCSI disk on the initiator host with PowerShell. To get the target IQN, use the Get-iSCSITarget cmdlet.

To connect to the iSCSI target, run this command:

Connect-IscsiTarget –IsPersistent $False and enter the IQN.

Connect-IscsiTarget with powershell

If using additional CHAP authentication, provide authentication credentials using the following command:

Get-iScsiTarget | Connect-iScsitarget –AuthenticationType ONEWAYCHAP –ChapUserName <username> -ChapSecret <secret>

If you want to provide high availability and load balancing for your iSCSI disks, you may use several redundant network components (network adapters, network switches) and an MPIO module.

0 comment
1
Facebook Twitter Google + Pinterest
previous post
Check User Login History in Active Directory with PowerShell
next post
How to Rebuild (Reset) a Corrupted Icon Cache on Windows 10?

Related Reading

Remote Desktop fix: The number of connections to...

February 7, 2025

How to Hide or Show the ‘Safely Remove...

August 13, 2024

Change Network Connection (Adapter) Priorities in Windows

August 5, 2024

Fix: Multiple Connections to a Server or Shared...

July 16, 2024

Configure File and Folder Access Auditing on Windows...

June 27, 2024

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMware
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025
  • How to Write Logs to the Windows Event Viewer from PowerShell/CMD

    March 3, 2025
  • How to Hide (Block) a Specific Windows Update

    February 25, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • How to Convert (Upgrade) Windows Server Evaluation to Full Version
  • Configuring Port Forwarding in Windows
  • Tracking and Analyzing Remote Desktop Connection Logs in Windows
  • Fixing “Winload.efi is Missing or Contains Errors” in Windows 10
  • How to Install and Activate the RDS Licensing Role and CALs on Windows Server
  • Configuring SFTP (SSH FTP) Server on Windows
  • Installing Remote Desktop HTML5 Web Client on Windows Server RDS
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top