Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

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

July 26, 2021 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 user name 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 size 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). In order 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 a 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
Checking User Logon History in Active Directory Domain with PowerShell
next post
How to Rebuild (Reset) a Corrupted Icon Cache on Windows 10?

Related Reading

Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

November 7, 2023

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

How to Use Ansible to Manage Windows Machines

September 25, 2023

How to View and Change BIOS (UEFI) Settings...

September 13, 2023

Leave a Comment Cancel Reply

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

  • How to Connect VPN Before Windows Logon

    November 14, 2023
  • Removing Azure Arc Setup Feature on Windows Server 2022

    November 9, 2023
  • Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

    November 7, 2023
  • Send Emails with Microsoft Graph API and PowerShell

    November 6, 2023
  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • How to Sign an Unsigned Device Driver in Windows
  • Configuring Port Forwarding in Windows
  • How to Convert (Upgrade) Windows Server 2019/2016 Evaluation to Full Version?
  • How to Clean Up Large System Volume Information Folder on Windows?
  • Fixing “Winload.efi is Missing or Contains Errors” in Windows 10
  • Configuring SFTP (SSH FTP) Server on Windows
  • Tracking and Analyzing Remote Desktop Connection Logs in Windows
Footer Logo

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


Back To Top