Blog

Stay In Your Lane, iSCSI!

Up until now everything on my Proxmox host has been going down a single 1G copper link. Management, VM traffic and the iSCSI storage for my big Windows VM were all squeezed through the same little pipe, while the NAS on the other end had a dual-port 10G card with one port plugged in and the other sitting there doing nothing. So I dropped an Intel 10G SFP+ fibre card (with a 10GBase-SR optic) into the Proxmox box, kept the 1G link as the management network, and moved all the iSCSI traffic onto a 10G link of its own. Pretty straight forward on paper, and mostly straight forward in practice, with a couple of gotchas along the way that are worth writing down.

Where Things Started

A quick lay of the land first. The host is plain old prox (the NAS got the fancier name), running Proxmox VE 9.0.3, which is a fair jump from the 8.1 I started on back in To Proxmox, and Beyond!. It was sitting on 192.168.185.7 over the one 1G link (vmbr0), and that link was carrying everything.

The NAS is a Synology called coruscant, serving iSCSI through SAN Manager. Its 10G copper port, LAN 6, was on 192.168.185.10 and was its only live connection, with LAN 5 (the second port on the 10G card) unused. On it there’s an iSCSI target called BigStor with two thick provisioned LUNs, BigStor-Lun at 60.5 TB and Backups at 6 TB.

In Proxmox that target is a storage called Storbot, and both LUNs are passed straight through to VM 105 (StorBot, a Windows VM) as scsi3 and scsi4, so Windows sees them as real disks:

scsi3: Storbot:0.0.1.scsi-36001405…,backup=0,iothread=1,size=62000G
scsi4: Storbot:0.0.2.scsi-36001405…,backup=0,iothread=1,size=6145G

There was also an old Prox-Test iSCSI storage left over from my early testing, pointing at an empty target. We’ll get to that one at the end.

Can’t I Just Give It Another IP?

My first instinct was the lazy one: give the new card a spare address on the existing LAN (192.168.185.6), point iSCSI at it, done. That won’t fly, and the reasons are worth knowing:

  • Routing: with two interfaces on the same /24, Linux has two connected routes to that subnet and picks one of them, which is going to be vmbr0. So traffic to the NAS keeps going out the 1G link whatever IP the new card has.
  • ARP flux: by default Linux answers ARP for any of its IPs on any of its interfaces, so the switch and the NAS can learn the wrong MAC address for either IP.
  • The other end matters too: if the NAS’s only path is still the one port on the main LAN, a faster link on the Proxmox side gets you nothing.

The fix is a separate storage subnet, with no gateway on either end:

DeviceManagementStorage (10G)
prox192.168.185.7/24 (vmbr0, gateway)10.10.10.11/24 (fibre NIC, no bridge, no gateway)
coruscant192.168.185.10 (LAN 6, unchanged)10.10.10.10/24 (LAN 5, no gateway)

Using LAN 5 meant LAN 6 could stay exactly as it was, so every other client keeps its 10G access to the NAS, and iSCSI gets a link all to itself.

Before and after! Everything squeezed down one 1G link, then iSCSI moved onto its own 10G fibre lane between prox and coruscant
Before and after! Everything squeezed down one 1G link, then iSCSI moved onto its own 10G fibre lane between prox and coruscant

Side Quest: The IP That Wasn’t

Along the way I noticed that 192.168.185.4 answered ping, even though the only thing set up with that address was LAN 1 on the NAS, which wasn’t even plugged in. A quick look at ARP from my Mac sorted out what was going on:

arp -n 192.168.185.4    # 0:11:32:xx:xx:xx
arp -n 192.168.185.10   # 0:11:32:xx:xx:xx  <- same MAC

00:11:32 is Synology’s MAC prefix, and both IPs came back with the same MAC, so the NAS was answering ARP for its unplugged port’s IP through LAN 6. That’s the same Linux ARP behaviour as above (DSM is Linux underneath), just seen from the other side! I set LAN 1 to DHCP so it would stop claiming the address.

Card In, Now What?

With the card fitted, a couple of quick checks before touching any config. VM 105 also has a PCI device passed through (hostpci0: 0000:01:00), and adding a PCIe card can shuffle bus addresses around, so I made sure 01:00 was still the device it was meant to be and not the new NIC:

lspci -nn | grep -iE 'ethernet|network|sas|raid'
lspci -s 01:00 -nnk

Then grab the new interface’s name with ip -br link.

Setting Up the Storage NIC

On prox this goes in /etc/network/interfaces (or in the GUI under the node, System, Network, with no bridge and no gateway):

auto <fibre-nic>
iface <fibre-nic> inet static
        address 10.10.10.11/24
        mtu 9000

Then ifreload -a applies it without a reboot. Why each choice:

  • No bridge: VMs don’t need to be on this network, it’s only there for the host’s iSCSI initiator.
  • No gateway: it’s a point-to-point storage network, and a second default gateway would only confuse routing.
  • MTU 9000: jumbo frames cut the per-packet overhead for big sequential storage I/O. The NAS port was already at 9000, but every hop in between has to support it too.

Then check the routing and jumbo frames end to end:

ip route get 10.10.10.10              # should go out the fibre NIC, src 10.10.10.11
ping -M do -s 8972 -c3 10.10.10.10    # 8972 + 28 bytes of headers = 9000, don't-fragment set

The -M do flag forbids fragmentation, so if anything in the path is still at 1500 the ping fails rather than quietly splitting the packet. A normal ping can work while the jumbo one fails, and of course that’s exactly what happened to me the first time round! Once the path was sorted I got 9000-byte replies at about 0.2 ms.

Over on the Synology

Two things to set on the NAS:

  1. LAN 5: Control Panel → Network → Network Interface → LAN 5, static 10.10.10.10 / 255.255.255.0, no gateway, jumbo frames at 9000.
  2. Network binding on the target: SAN Manager → iSCSI → BigStor → Edit → Network Binding → Only selected interfaces → LAN 5 only.

The binding is the important one. By default Synology advertises a target on every interface, and Proxmox’s iSCSI plugin logs in to every portal that discovery hands back. My target also had Multiple Sessions disabled, so without the binding prox would discover BigStor on both 10.10.10.10 and 192.168.185.10, and which path actually got the session would come down to chance. Binding it to LAN 5 means discovery only ever returns the storage IP. (A firewall rule denying TCP 3260 from 192.168.185.7 on LAN 6 would also do the job, but the binding is cleaner.)

One thing on timing though: saving the binding cuts off any existing session on the other interface straight away, so do it after logging out on the Proxmox side, not before.

The Big Switchover

First up, shut down VM 105. You really don’t want Windows writing to a 60 TB NTFS volume while its disk vanishes out from under it!

T=iqn.2000-01.com.synology:coruscant.Target-1.xxxxxxxxxx

pvesm set Storbot --disable 1          # stop Proxmox managing/re-logging into this storage
iscsiadm -m session                     # see what's currently logged in
iscsiadm -m node -T $T --logout         # close the session on the old portal
iscsiadm -m node -T $T -o delete        # delete the cached node record for the old portal
iscsiadm -m session                     # confirm BigStor is gone

This is where I tripped up. The first time, I ran the logout in a fresh shell without setting $T, and with -T empty iscsiadm just said “No records found” and did nothing, so the session was still up the whole time. Always check with iscsiadm -m session, and don’t take silence as success.

Deleting the node record matters too. open-iscsi caches every portal it has discovered under /etc/iscsi/nodes/, and if the old portal’s record is left lying around the initiator can log back into it later.

With prox logged out, I saved the LAN 5 binding on the Synology.

Next, the portal. The Proxmox GUI won’t let you edit the portal on an existing iSCSI storage, so it’s straight into /etc/pve/storage.cfg:

iscsi: Storbot
        portal 10.10.10.10
        target iqn.2000-01.com.synology:coruscant.Target-1.xxxxxxxxxx
        content images

Then bring it back and check:

pvesm set Storbot --disable 0
iscsiadm -m session -P 3 | grep -E 'Target:|Current Portal|Iface Netdev|Attached scsi disk'
pvesm status | grep Storbot
ls -l /dev/disk/by-id/ | grep scsi-36001405
pvesm list Storbot

The session came back with Current Portal: 10.10.10.10:3260, and both LUNs attached as sda and sdb. The first pvesm status did show Storbot as inactive, and the by-id listing came back empty, but that was just a race: the commands ran before the login had finished and before udev had made the links. A few seconds later Storbot showed active and both scsi-3600… links were there, and pvesm list Storbot showed the same volume IDs as before.

Best bit, the VM config didn’t need touching at all. Proxmox names a passed-through LUN by storage ID, LUN number and WWN, not by portal IP, and the WWN belongs to the LUN itself, so moving to a different IP doesn’t change the name. VM 105 started up like nothing had happened. (If you’re wondering about “Iface Netdev: default” in the session output, that just means the initiator leaves the choice of interface to the kernel’s routing table, and since ip route get already showed 10.10.10.10 going out the fibre NIC, that’s fine.)

Last bit of housekeeping was that old Prox-Test storage and its session:

pvesm remove Prox-Test
iscsiadm -m node -T iqn.2000-01.com.synology:coruscant.prox.xxxxxxxxxxx --logout
iscsiadm -m node -T iqn.2000-01.com.synology:coruscant.prox.xxxxxxxxxxx -o delete
iscsiadm -m session    # only BigStor on 10.10.10.10 left

Then delete the empty target in SAN Manager. If you only log out and leave the storage defined, Proxmox just keeps trying to log back in.

So, Is It Faster?

Reads inside the Windows VM (NAS LUN to C:) now run at about 250 MB/s. That’s well past what a 1G link can carry (around 115 MB/s), so the 10G path is definitely being used. Writes (C: to the NAS LUN) are another story, at 50 to 70 MB/s with the odd spike up to about 150 MB/s, but in fairness writes have never been great on this box.

The network isn’t the bottleneck any more, the storage behind it is:

  • Drives: 8 HDDs of mixed sizes (4× Seagate Exos 16 TB, 1× Toshiba N300 14 TB and 3× Toshiba N300 12 TB). All CMR at least, so no SMR write cliff.
  • SHR-2 on mixed sizes: SHR-2 is Synology’s two-drive redundancy (the RAID 6 equivalent), and on mixed drives it builds a stack of RAID 6 arrays across slices of the drives, an 8-disk array across the 12 TB-sized portion and then smaller arrays on the leftover space of the bigger drives. Any write smaller than a full stripe means reading, recalculating parity and writing again, and the smaller sub-arrays have fewer spindles behind them.
  • No SSD cache: all 8 bays are full, and adding NVMe would mean swapping the dual 10G card for a combo card with one 10G port and M.2 slots, which would undo this whole project.
  • Volume 1 is about 96% full: Btrfs slows down sharply as free space runs out. The LUNs are thick provisioned (space reserved up front, no snapshots), so they’re less exposed to this than the NFS share on the same volume, but it’s still not healthy.
  • Explorer copies are single-threaded with a low queue depth: so every bit of latency on the storage side shows up in the transfer rate.

So the network side is sorted, and the slow writes are a problem for another day. Next on the list is a robocopy /MT:16 run, or a CrystalDiskMark Q8T1 against Q1T1 test, to see how much of it is latency, and clearing some space off Volume 1 is well overdue. Still, iSCSI has its own lane now, and the 1G link is back to just being the management network!

Starting From Scratch?

If you’re setting this up fresh rather than moving it, here’s the short version, hopefully it saves someone a bit of digging.

On the Synology (SAN Manager)

  1. Create a LUN. Thick reserves the space up front and gives better write performance, but no snapshots. Thin gets you snapshots and space reclamation, but slower writes on Btrfs, and the LUN can go offline if the volume fills up.
  2. Create a target and map the LUN to it.
  3. Network binding: restrict the target to your storage interface(s).
  4. Security: optionally restrict access to the Proxmox initiator’s IQN (find it on the host with cat /etc/iscsi/initiatorname.iscsi), and optionally turn on CHAP.
  5. Multiple sessions: leave it disabled for a single host. You need it enabled for multipath, or for several cluster nodes sharing the target.

On Proxmox

In the GUI it’s Datacenter → Storage → Add → iSCSI:

  • ID: a name for the storage (mine’s Storbot)
  • Portal: the NAS’s storage IP
  • Target: pick it from the discovered list
  • Use LUNs directly: tick it to pass raw LUNs to VMs, untick it to use the target only as a base for LVM (more on that below)

Or from the shell:

pvesm add iscsi Storbot --portal 10.10.10.10 \
  --target iqn.2000-01.com.synology:coruscant.Target-1.xxxxxxxxxx \
  --content images        # 'images' = use LUNs directly; 'none' = base for LVM only
pvesm list Storbot        # shows the LUN volume IDs

Then attach a LUN to a VM as a raw disk, using the full volume ID from pvesm list:

qm set 105 --scsi3 Storbot:0.0.1.scsi-36001405…,iothread=1,backup=0
  • backup=0 so vzdump won’t try to back up a 60 TB raw LUN.
  • iothread=1, together with the VirtIO SCSI single controller, gives each disk its own I/O thread.

There are two ways to use an iSCSI target in Proxmox:

  1. LUNs directly (what I do): one LUN is one VM disk and the guest owns the filesystem. Simple, and well suited to huge data disks.
  2. LVM on top of iSCSI: add the iSCSI storage with content none, then create an LVM storage on top of the LUN, and Proxmox carves VM disks out of it as logical volumes. With “shared” ticked, this is the classic way to give a cluster shared block storage for live migration.

The Short Checklist

  • Put storage on its own subnet or VLAN, with no gateway and no bridge.
  • Only use jumbo frames if every hop supports them, and prove it with ping -M do -s 8972.
  • Bind targets to the storage interface so discovery doesn’t hand back management IPs.
  • Use the by-id/WWN-based volume names. They don’t change when IPs do.
  • Shut the VM down before touching its iSCSI sessions.
  • iscsiadm -m session -P 3 is your friend: it shows the current portal, the interface and the attached disks.

Cheat Sheet

CommandWhat it’s for
ip -br linkList interfaces, to find the new NIC’s name
lspci -s 01:00 -nnkCheck what’s at a PCI address (passthrough sanity check)
ifreload -aApply /etc/network/interfaces changes without a reboot
ip route get <ip>Show which interface and source IP the kernel will use
ping -M do -s 8972 <ip>Test 9000 MTU end to end without fragmentation
pvesm set <id> --disable 1/0Take a storage out of service / bring it back
pvesm status / pvesm list <id>Storage state / volumes on a storage
pvesm add iscsi … / pvesm remove <id>Add / remove storage definitions
iscsiadm -m session [-P 3]Show active iSCSI sessions (and the detail)
iscsiadm -m node -T <iqn> --logoutLog out of a target
iscsiadm -m node -T <iqn> -o deleteDelete cached node records (stops re-logins to old portals)
cat /etc/iscsi/initiatorname.iscsiShow this host’s initiator IQN
qm set <vmid> --scsiN <storage>:<lun>Attach a LUN to a VM
arp -n <ip> (macOS)See which MAC address answers for an IP

No Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Light My Fire!Frame 52 of the final Karma render over the plate, with fireballs blowing out of the tower and the asteroid trails crossing the sky