Guide

Connect a Windows server to iSCSI storage

This connects a Windows server to disks shared from a storage box over iSCSI, using two network paths at once. If one path fails, the disks stay connected.

15 minutesRun as a domain admin on the server
What improves

The server sees shared disks over two paths, so one path can fail without losing storage.

Why it matters

A single path to storage is a single point of failure for every VM on it.

How you do it

Start the iSCSI service, turn on multipath, add the storage box on each path and connect.

Before this guide

The storage box must already share the disks, as in Share disks over iSCSI. The server needs a card on each storage network and the Multipath I/O feature, as in Add team and storage network cards and Install the Hyper-V and clustering roles.

The example

PathThis serverStorage box
A10.0.61.1110.0.61.10
B10.0.62.1110.0.62.10

Start the iSCSI service

CON-HV-01
Set-Service MSiSCSI -StartupType Automatic
Start-Service MSiSCSI

Turn on multipath for iSCSI

With two paths, Windows sees every disk twice. Multipath I/O joins the two views into one disk. Do this before you connect.

CON-HV-01
Enable-MSDSMAutomaticClaim -BusType iSCSI | Out-Null
Set-MSDSMGlobalDefaultLoadBalancePolicy -Policy RR

RR is round robin: Windows uses both paths in turn.

Tell Windows where the storage is

Add the storage box once per path. Naming the server's own address on each line pins that path to the right card.

CON-HV-01
New-IscsiTargetPortal -TargetPortalAddress 10.0.61.10 -InitiatorPortalAddress 10.0.61.11 | Out-Null
New-IscsiTargetPortal -TargetPortalAddress 10.0.62.10 -InitiatorPortalAddress 10.0.62.11 | Out-Null

Connect to every share on both paths

CON-HV-01
foreach ($t in Get-IscsiTarget) {
    Connect-IscsiTarget -NodeAddress $t.NodeAddress -TargetPortalAddress 10.0.61.10 -InitiatorPortalAddress 10.0.61.11 -IsMultipathEnabled $true -IsPersistent $true | Out-Null
    Connect-IscsiTarget -NodeAddress $t.NodeAddress -TargetPortalAddress 10.0.62.10 -InitiatorPortalAddress 10.0.62.11 -IsMultipathEnabled $true -IsPersistent $true | Out-Null
}

-IsPersistent makes Windows reconnect after every restart.

Check it

CON-HV-01
Get-IscsiTarget  | Format-Table NodeAddress, IsConnected -AutoSize
Get-IscsiSession | Format-Table TargetNodeAddress, InitiatorPortalAddress, IsConnected, IsPersistent -AutoSize
Get-Disk | Where-Object BusType -eq 'iSCSI' |
    Format-Table Number, FriendlyName, @{n='GB';e={[math]::Round($_.Size/1GB,1)}}, PartitionStyle, OperationalStatus -AutoSize
TableWhat you want, with two shares
TargetsBoth shares listed, connected.
SessionsFour rows: each share once on each path, connected and persistent.
DisksTwo disks, shown as RAW and Offline. That is correct for new disks.
Seeing each disk twice?

If four disks are listed for two shares, Multipath I/O has not taken over yet. Restart the server and check again.

Note the server's iSCSI name

CON-HV-01
(Get-InitiatorPort | Where-Object ConnectionType -eq 'iSCSI').NodeAddress

It looks like iqn.1991-05.com.microsoft:con-hv-01.ad.contoso.com. The storage box uses this name to allow only your servers to connect.

Test the paths by failing a storage card

First look at the paths while everything is healthy. Each disk should show 02 Paths.

CON-HV-01
mpclaim -s -d
mpclaim -s -d 0
mpclaim -s -d 1

Now take one storage card away. On a physical server, pull its cable. If the server is a VM, disconnect the card on the machine it runs on:

Hyper-V host
Disconnect-VMNetworkAdapter -VMName 'CON-HV-01' -Name 'iSCSI-A'

Wait half a minute, then run the three mpclaim commands again. Each disk should show 01 Paths and still be Active/Optimized. The disks stay in Get-Disk throughout.

Use mpclaim while a path is down

Get-IscsiSession can fail with "Invalid property" while a session is retrying, and can still count the lost sessions as connected for the first half minute. It works again once the path is back.

Put the card back and check it kept its VLAN:

Hyper-V host
Connect-VMNetworkAdapter -VMName 'CON-HV-01' -Name 'iSCSI-A' -SwitchName 'CON-LAN'
Get-VMNetworkAdapterVlan -VMName 'CON-HV-01' | Format-Table @{n='Card';e={$_.ParentAdapter.Name}}, OperationMode, AccessVlanId -AutoSize

After a minute, each disk should be back to 02 Paths and the session count back to two per share. The sessions are persistent, so they reconnect on their own. Then repeat with iSCSI-B.

Once the disks are formatted and in use, run the test again and write a file to the disk while the card is out. That proves the disk still works on one path, not just that it is still listed.

Do not format yet

For a cluster, connect every node first, then bring the disks online and format them from one node only. Formatting from two nodes at once damages the disk.

Done when

Check

Every share shows two connected, persistent sessions, and each share appears as one disk.

Your progress is kept in this browser only.