iSCSI and MPIO on Azure VMs
-
Phase 0: Before you start
-
Phase 1: The foundation
-
Phase 2: Day-to-day operations
-
Phase 3: Enterprise architecture
-
Phase 4: Troubleshooting step by step
-
Phase 5: Final project and career
This iSCSI MPIO Azure lesson is about block storage over the network. One server (the target) shares a disk and another server (the initiator) uses it as if it were sitting inside the box, and MPIO, short for multipath I/O, lets the initiator reach that disk over more than one path so the app keeps running when one path is lost.
On premises, this is how SAN arrays feed databases and clusters. In Azure you’ll run into it with Azure Elastic SAN, with marketplace storage appliances, and in pretty much every migration of a cluster that expects shared disks.
In the lab you’ll build a real iSCSI target with targetcli on one Azure VM, connect to it from a second VM over two paths using Linux multipath, and then break the access list and one of the paths on purpose.
| Time | You need | Cost | By the end you can |
|---|---|---|---|
| About 60 minutes | A free account and the CLI | Around 5 US cents: two small VMs, their public IPs and a 4 GiB disk for an hour. To compare, Elastic SAN Premium base capacity costs about USD 115 per TiB per month in Central India (Azure Retail Prices API, October 2026) | Configure an iSCSI target and initiator, set up multipath, and fix ACL and path failures |
What it is, in one line
iSCSI sends disk commands over an ordinary IP network, and MPIO gives one disk several network paths so that one failure doesn’t take it down.
In Simple Words
Two roads to the same warehouse
A shop gets its stock from a warehouse on the other side of town. With only one road, a single flood leaves the shelves empty, so the shop uses two roads: trucks run on both, and if one road closes they all take the other.
There’s also a guard at the warehouse with a list of shops allowed to collect, and a new shop under a different name gets turned away even when the road is perfect.
In iSCSI terms, the warehouse is the target, the shop is the initiator, the roads are the paths and the guard’s list is the ACL of initiator names (IQNs).
Engineer's View
How iSCSI and multipath fit together
- Target: the server that shares the storage. On Linux that’s LIO, configured with targetcli, which has backstores (the disk), a target IQN, LUNs, portals (IP and port 3260) and ACLs.
- Initiator: the client side. On Linux it’s open-iscsi, with the initiator name (IQN) kept in /etc/iscsi/initiatorname.iscsi, and on Windows it’s the iSCSI Initiator plus the MPIO feature.
- Session: one login from the initiator to a target portal. With two portals you get two sessions, and the same LUN shows up as two SCSI disks (sdc and sdd, for example).
- Multipath: multipathd notices that both disks carry the same WWID and joins them into one device, /dev/mapper/mpatha. That’s the device you format and mount, never sdc or sdd.
- Timeouts: when you use multipath, keep the iSCSI replacement timeout low (5 seconds) so a dead path is given up on quickly and multipath shifts I/O to the other path.
- In Azure: Elastic SAN gives you iSCSI volumes inside volume groups, and access is controlled with network rules or private endpoints rather than IQN ACLs. Microsoft recommends several sessions per volume if you want its full performance.
How it works, step by step
Here’s what happens when the app writes to /data:
- The app writes a file to /data, which is mounted from /dev/mapper/mpatha.
- multipath chooses a path according to its policy (service-time by default), say sdc through portal 10.57.1.4.
- open-iscsi wraps the SCSI write inside iSCSI and sends it over TCP port 3260.
- LIO on vm-target checks that the initiator IQN is on the ACL and then writes to the Azure data disk behind disk1.
- If the 10.57.1.5 path dies, its session fails after 5 seconds and multipath sends all the I/O through 10.57.1.4.
In this lab both portals sit on one VM, so you’re protected against a path failure but not against the server itself going down. Real SAN arrays and Elastic SAN place the paths on different controllers or nodes.
If you keep only one rule from this lesson, keep this one: mount the multipath device and never a single path disk.
Build an iSCSI target and connect over two paths with multipath
Before you run any command, double-check it
Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.
1Network and two VMs
Create a VNet, a target VM with a 4 GiB data disk and an initiator VM. The public IPs are there only so apt works, and no inbound port gets opened:
az group create --name rg-saat-l57 --location centralindia --tags course=saatvedha-azure lesson=57 -o none
az network vnet create --resource-group rg-saat-l57 --name vnet-l57 --address-prefixes 10.57.0.0/16 --subnet-name snet-san --subnet-prefixes 10.57.1.0/24 -o none
az vm create --resource-group rg-saat-l57 --name vm-target --image Canonical:ubuntu-24_04-lts:server:latest --size Standard_B1s --vnet-name vnet-l57 --subnet snet-san --private-ip-address 10.57.1.4 --public-ip-sku Standard --nsg-rule NONE --admin-username azureuser --generate-ssh-keys --tags course=saatvedha-azure lesson=57 -o none --data-disk-sizes-gb 4
az vm create --resource-group rg-saat-l57 --name vm-init --image Canonical:ubuntu-24_04-lts:server:latest --size Standard_B1s --vnet-name vnet-l57 --subnet snet-san --private-ip-address 10.57.1.10 --public-ip-sku Standard --nsg-rule NONE --admin-username azureuser --generate-ssh-keys --tags course=saatvedha-azure lesson=57 -o none
az network nic ip-config create --resource-group rg-saat-l57 --nic-name vm-targetVMNic --name ipconfig2 --private-ip-address 10.57.1.5 -o noneThe second IP config gives the target its second portal address. Azure only delivers traffic to an IP that’s on the NIC, and the OS has to know about it too, which is why the target script adds it.
2Build the iSCSI target
Save this as C:\azure-lab\iscsi\target.sh:
#!/bin/bash
# iSCSI target on vm-target: one LUN, two portals, one allowed initiator
set -e
apt-get update -qq > /dev/null
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq targetcli-fb > /dev/null
ip addr add 10.57.1.5/24 dev eth0 || true
T=iqn.2026-10.com.saatvedha:target1
targetcli /backstores/block create name=disk1 dev=/dev/disk/azure/scsi1/lun0
targetcli /iscsi create $T
targetcli /iscsi/$T/tpg1/luns create /backstores/block/disk1
targetcli /iscsi/$T/tpg1/portals delete 0.0.0.0 3260
targetcli /iscsi/$T/tpg1/portals create 10.57.1.4 3260
targetcli /iscsi/$T/tpg1/portals create 10.57.1.5 3260
targetcli /iscsi/$T/tpg1/acls create iqn.2026-10.com.saatvedha:vm-init
targetcli saveconfig > /dev/null
targetcli ls /iscsiRun it on vm-target:
az vm run-command invoke --resource-group rg-saat-l57 --name vm-target --command-id RunShellScript --scripts '@C:\azure-lab\iscsi\target.sh' --query "value[0].message" -o tsvThe end of the output should look roughly like this:
o- iscsi ............................................ [Targets: 1]
o- iqn.2026-10.com.saatvedha:target1 ............... [TPGs: 1]
o- tpg1 .............................. [no-gen-acls, no-auth]
o- acls .......................................... [ACLs: 1]
| o- iqn.2026-10.com.saatvedha:vm-init .... [Mapped LUNs: 1]
o- luns .......................................... [LUNs: 1]
| o- lun0 ............. [block/disk1 (/dev/disk/azure/scsi1/lun0)]
o- portals .................................... [Portals: 2]
o- 10.57.1.4:3260 ................................... [OK]
o- 10.57.1.5:3260 ................................... [OK]3Connect the initiator over two paths
Save this as C:\azure-lab\iscsi\initiator.sh:
#!/bin/bash
# iSCSI initiator with multipath on vm-init
apt-get update -qq > /dev/null
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq open-iscsi multipath-tools > /dev/null
echo InitiatorName=iqn.2026-10.com.saatvedha:vm-init > /etc/iscsi/initiatorname.iscsi
sed -i 's/^node.session.timeo.replacement_timeout = .*/node.session.timeo.replacement_timeout = 5/' /etc/iscsi/iscsid.conf
cat > /etc/multipath.conf <<'EOF'
defaults {
user_friendly_names yes
find_multipaths yes
}
blacklist {
device {
vendor "Msft"
product "Virtual Disk"
}
}
EOF
systemctl restart iscsid multipathd
iscsiadm -m discovery -t sendtargets -p 10.57.1.4
iscsiadm -m node --login > /dev/null
sleep 5
iscsiadm -m session
multipath -llRun it on vm-init:
az vm run-command invoke --resource-group rg-saat-l57 --name vm-init --command-id RunShellScript --scripts '@C:\azure-lab\iscsi\initiator.sh' --query "value[0].message" -o tsvYou should see something like this:
10.57.1.4:3260,1 iqn.2026-10.com.saatvedha:target1
10.57.1.5:3260,1 iqn.2026-10.com.saatvedha:target1
tcp: [1] 10.57.1.4:3260,1 iqn.2026-10.com.saatvedha:target1 (non-flash)
tcp: [2] 10.57.1.5:3260,1 iqn.2026-10.com.saatvedha:target1 (non-flash)
mpatha (36001405d2f6e1a0c9b14b5f9a1c3e7d2) dm-0 LIO-ORG,disk1
size=4.0G features='0' hwhandler='1 alua' wp=rw
`-+- policy='service-time 0' prio=50 status=active
|- 2:0:0:0 sdc 8:32 active ready running
`- 3:0:0:0 sdd 8:48 active ready runningDiscovery found both portals, two sessions are up, and multipath has joined sdc and sdd into mpatha. Your device letters and WWID won’t match these.
4Format and mount the multipath device
Run this:
az vm run-command invoke --resource-group rg-saat-l57 --name vm-init --command-id RunShellScript --scripts 'mkfs.ext4 -q /dev/mapper/mpatha; mkdir -p /data; mount /dev/mapper/mpatha /data; echo hello from iscsi > /data/test.txt; df -h /data | tail -1' --query "value[0].message" -o tsvYou should see something like this:
[stdout]
/dev/mapper/mpatha 3.9G 24K 3.7G 1% /data

✅ Checkpoint: vm-init has two iSCSI sessions, one multipath device mpatha, and a file system mounted on /data.
Break It, Then Fix It
Leave both VMs running for the two breaks.
1Break it: a rebuilt initiator with a new name
Say vm-init gets rebuilt from an image that generates a fresh initiator name. You can simulate that like this:
az vm run-command invoke --resource-group rg-saat-l57 --name vm-init --command-id RunShellScript --scripts 'umount /data; iscsiadm -m node --logout > /dev/null; echo InitiatorName=iqn.2026-10.com.saatvedha:vm-init-new > /etc/iscsi/initiatorname.iscsi; systemctl restart iscsid; iscsiadm -m node --login 2>&1 | tail -3' --query "value[0].message" -o tsvYou should see something like this:
[stdout]
iscsiadm: Could not login to [iface: default, target: iqn.2026-10.com.saatvedha:target1, portal: 10.57.1.5,3260].
iscsiadm: initiator reported error (24 - iSCSI login failed due to authorization failure)
iscsiadm: Could not log into all portalsError 24 means the target is refusing an initiator it doesn’t recognise. The network and the portals are fine, but the ACL only lists vm-init and not vm-init-new.
To fix it, allow the new initiator name on the target, then log in and mount again:
az vm run-command invoke --resource-group rg-saat-l57 --name vm-target --command-id RunShellScript --scripts 'targetcli /iscsi/iqn.2026-10.com.saatvedha:target1/tpg1/acls create iqn.2026-10.com.saatvedha:vm-init-new; targetcli saveconfig > /dev/null' --query "value[0].message" -o tsv
az vm run-command invoke --resource-group rg-saat-l57 --name vm-init --command-id RunShellScript --scripts 'iscsiadm -m node --login > /dev/null; sleep 5; mount /dev/mapper/mpatha /data; cat /data/test.txt' --query "value[0].message" -o tsvYou should see hello from iscsi. In a real change you’d also clean up the old ACL entry.
2Break it: one path goes down
Remove the second portal IP on the target, as though a switch port or NIC had failed, and then write some data and check the paths:
az vm run-command invoke --resource-group rg-saat-l57 --name vm-target --command-id RunShellScript --scripts 'ip addr del 10.57.1.5/24 dev eth0' --query "value[0].message" -o tsv
az vm run-command invoke --resource-group rg-saat-l57 --name vm-init --command-id RunShellScript --scripts 'sleep 20; dd if=/dev/zero of=/data/big bs=1M count=50 oflag=direct 2>&1 | tail -1; multipath -ll | tail -2' --query "value[0].message" -o tsvYou should see something like this:
[stdout]
52428800 bytes (52 MB, 50 MiB) copied, 0.61 s, 86.0 MB/s
|- 2:0:0:0 sdc 8:32 active ready running
`- 3:0:0:0 sdd 8:48 failed faulty runningOne path shows as failed and the write still went through, which is MPIO doing what it’s there for. Had the file system been on /dev/sdd directly, it would have hung and then flipped to read-only.
To fix it, put the IP back and watch the path return:
az vm run-command invoke --resource-group rg-saat-l57 --name vm-target --command-id RunShellScript --scripts 'ip addr add 10.57.1.5/24 dev eth0' --query "value[0].message" -o tsv
az vm run-command invoke --resource-group rg-saat-l57 --name vm-init --command-id RunShellScript --scripts 'sleep 20; multipath -ll | tail -2' --query "value[0].message" -o tsvBoth paths go back to active ready running.

3Clean up
Delete the lab resource group when you’re done:
az group delete --name rg-saat-l57 --yes
az resource list --tag lesson=57 -o tableThe last command shouldn’t print anything.
✅ Checkpoint: You fixed an iSCSI authorization failure, watched multipath ride out a path failure, and removed the lab.
This happened at work
The SQL cluster that froze during a network upgrade
A hospital ran a SQL Server failover cluster on VMs, with shared iSCSI storage coming from a storage appliance. During a planned switch upgrade, one of the two storage networks dropped for a few seconds, and to everyone’s surprise the SQL databases froze for two full minutes before the cluster failed over, which cut off patient record lookups in the middle of the day.
When the team dug in, they found MPIO was installed but each server had only one iSCSI session, over one network, so the “second path” only existed on paper. On top of that the iSCSI timeout was left at default, which means even with two paths the I/O would have sat waiting a long time before switching.
What they changed: two sessions per volume across two networks, MPIO policy and timeouts set the way the storage vendor’s guide says, and a quarterly test where they switch off one storage network during business hours while someone keeps an eye on disk latency.
Common mistakes and troubleshooting
| Mistake | What you see | What to do |
|---|---|---|
| Formatting /dev/sdc instead of the multipath device | Hang or read-only file system when a path fails | Always use /dev/mapper/mpathX. |
| Initiator IQN not in the target ACL | Error 24, authorization failure | Add the IQN to the ACL, or correct the initiator name. |
| Only one session per volume | “MPIO” that doesn’t fail over | Log in through two or more portals or sessions. |
| Default long iSCSI timeouts with multipath | I/O freezes for minutes | Keep replacement_timeout low and follow the vendor’s guidance. |
| Secondary IP only in the OS or only in Azure | Second portal unreachable | Add it on the NIC and in the OS. |
| Port 3260 blocked by NSG or firewall | Discovery or login times out | Allow TCP 3260 between the initiator and the target. |
Interview questions
Click a question to open it. Each one is phrased the way an interviewer would ask it, and underneath you’ll find why they ask it and one way you could answer in your own words.
Fresher level
1. What is iSCSI?
Why they ask this: The basic concept.
How you might answer: It’s a protocol that carries SCSI disk commands over TCP/IP, so a server can use remote block storage like a local disk. It runs on port 3260.
2. What are target and initiator?
Why they ask this: Basic vocabulary.
How you might answer: The target is the side sharing the storage and the initiator is the client connecting to it. Both are identified by an IQN.
3. What does MPIO do?
Why they ask this: Basic HA.
How you might answer: It takes several paths to the same LUN and presents them as one device, so you get failover and, depending on the policy, some load balancing too.
2–5 years experience
4. Login fails with error 24. What does it mean?
Why they ask this: A real troubleshooting path.
How you might answer: It’s an authorization failure, meaning the target won’t allow this initiator. I’d check the initiator IQN, then the ACL or host group on the target, and CHAP settings if they’re in use.
5. How do you check multipath health on Linux?
Why they ask this: A daily ops check.
How you might answer: I’d run multipath -ll for path states and iscsiadm -m session for the sessions, look in journalctl for path failures, and confirm the file system is on the dm device in /dev/mapper.
6. Why lower iSCSI timeouts when using multipath?
Why they ask this: A tuning detail.
How you might answer: So a failed path gets reported fast and multipath can move I/O to a healthy one. Otherwise I/O just queues on the dead path for the default two minutes.
Senior level
7. When would you use Elastic SAN instead of managed disks?
Why they ask this: They want a design answer.
How you might answer: I’d pick it when I need pooled block storage shared by many VMs or AKS, when I’m consolidating SAN-style workloads, or when a cluster needs iSCSI, as long as the price per TiB works. For one disk per VM, managed disks are simpler.
8. How do you design iSCSI networking for production?
Why they ask this: Network depth.
How you might answer: I’d keep storage on separate subnets or NICs, have two paths per volume, use jumbo frames where they’re supported, avoid NAT, lock NSGs down to 3260 between known hosts, and monitor path state and latency.
9. How do you migrate a SAN-based cluster to Azure?
Why they ask this: Migration thinking.
How you might answer: First I’d check whether shared disks, Elastic SAN or ANF suit that cluster type, and test failover and latency. Then I’d plan the IQNs or network rules, sessions and MPIO settings, and rehearse the cutover on a copy of real data.
Quick quiz
Q1. Which device should you format and mount with multipath?
- /dev/sdc
- /dev/mapper/mpatha
- /dev/sdd
- /dev/sda
Show answer
B — The multipath device survives path loss.
Q2. Error 24 at login means?
- Port blocked
- Authorization failure
- Disk full
- Wrong LUN size
Show answer
B — The target refused the initiator.
Q3. What port does iSCSI use by default?
- 445
- 3260
- 2049
- 443
Show answer
B — 3260 is the iSCSI port.
Q4. Two portals, two logins: how many sessions?
- One
- Two
- Four
- None
Show answer
B — One session per portal login.
Q5. How does Elastic SAN usually control access?
- IQN ACLs only
- Network rules or private endpoints
- Shared keys
- SAS tokens
Show answer
B — Volume groups use network rules or private endpoints.
Quick recap
You’ve built SAN-style block storage from nothing and seen for yourself what multipath is for.
- iSCSI uses targets, initiators, IQNs and port 3260.
- Two portals mean two sessions, and multipath joins them.
- Mount /dev/mapper devices, not a single path.
- Error 24 means the ACL doesn’t allow the initiator.
- Elastic SAN brings iSCSI to Azure and uses network rules.
Next lesson
Lesson 58: Ultra Disk and Premium SSD v2 → You create Ultra Disk and Premium SSD v2, tune IOPS and throughput live, and find the VM limit that caps them.
Further reading: iSCSI MPIO Azure
Want to go deeper into iSCSI MPIO Azure? See Microsoft’s What is Azure Elastic SAN? and Connect to Elastic SAN volumes from Linux. You can also see the full plan for this course on the Azure Cloud Administration course page.
