Configuring a Linux initiator for StorPool iSCSI

1. iSCSI target checks

A tool is available to check if the presently connected targets are properly configured, however it does not parse/check the /etc/iscsi/iscsid.conf or /etc/multipath.conf for proper settings, only suggests setting up recommended values by printing commands for fixing them for the best known performance and reliability.

To download the tool use:

wget -O /usr/local/bin/iscsi_target_checks
chmod +x /usr/local/bin/iscsi_target_checks

An example output suggesting proper settings after changing the ``/etc/iscsi/iscsid.conf`` and/or the ``/etc/multipath.conf`` files for an example target:

[root@test ~]# iscsi_target_checks
# Target: property node.session.timeo.replacement_timeout expected -1, found 120
# command to fix to -1:
iscsiadm -m node -T -p,1 -o update -n node.session.timeo.replacement_timeout -v -1
# /sys/class/iscsi_session/session50/recovery_tmo value is different than expected, required off, got 120
# Please restart the iscsid service:
systemctl restart iscsid.service

Usually piping its output to sh (or sh -x for visibility) would be enough to fix the required values (or stop if something fails). Example:

[root@test ~]# iscsi_target_checks  | sh -x
+ iscsiadm -m node -T -p,1 -o update -n node.session.timeo.replacement_timeout -v -1
+ systemctl restart iscsid.service

Provided everything was correctly configured, there should be no subsequent output for this target even after a connection reset or a rediscover:

[root@test ~]# iscsi_target_checks

2. Multipath

Install multipath:

yum -y install device-mapper-multipath

2.1. Configure multipath

Add in /etc/multipath.conf :

defaults {
        prio                    "alua"
        failback                "manual"
        no_path_retry           "queue"
        queue_without_daemon    "yes"


devices {
    device {
        vendor                  "StorPool"
        product                 ".*"
        path_grouping_policy    multibus
        path_selector           "round-robin 0"
        features                "1 queue_if_no_path"
        fast_io_fail_tmo        "0"

Restart multipathd:

systemctl restart mutipathd

3. iSCSI Initiator

Install iscsi initiator tools:

yum -y install iscsi-initiator-utils

Set Initiator IQN in /etc/iscsi/initiatorname.iscsi :

Set the following values in /etc/iscsi/iscsid.conf:

  • multipath:

    node.session.timeo.replacement_timeout = 0
    node.conn[0].timeo.noop_out_interval = 1
    node.conn[0].timeo.noop_out_timeout = 1
  • non-multipath:

    node.session.timeo.replacement_timeout = -1
    node.conn[0].timeo.noop_out_interval = 1
    node.conn[0].timeo.noop_out_timeout = 1

Restart iscsid:

systemctl restart iscsid


This is a crucial step, especially if the iscsiadm tool was used for updating values for live connections/sessions, without an explicit restart some of the updated settings will not get applied to the live connection or will be reverted on an event that causes the TCP connection to re-establish. Restarting the iscsid service would re-connect all TCP connections with the updated settings. The re-connect is not known to be service affecting.

3.1. Set block device timeout

Add a rule: /etc/udev/rules.d/99-storpool.rules:

# Set the HBA timeout to 3600 seconds
ACTION=="add", SUBSYSTEMS=="scsi", ATTRS{vendor}=="StorPool", RUN+="/bin/sh -c 'echo 3600 > /sys/$DEVPATH/device/timeout'"

3.2. Discover and connect to target

iscsiadm --mode discoverydb --type sendtargets --portal ${portal_ip} --discover
iscsiadm --mode node --targetname ${target} --login

Check iscsi session:

iscsiadm -m session -P 3

3.3. Check multipath

# multipath -ll
3300000000a1b0b9c dm-2 StorPool,iSCSI DISK
size=100G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 10:0:0:0 sdp 8:240 active ready running
  `- 11:0:0:0 sdq 65:0  active ready running

Make sure the block devices are in the same group (under the same ‘policy=’ line).

3.4. Verify timeouts

# egrep -H . /sys/block/sdb/device/timeout
# egrep -H . /sys/class/iscsi_session/*/device/*/iscsi_connection/*/{ping,recv}_tmo
# egrep -H . /sys/class/iscsi_session/*/recovery_tmo
# shall be 'off' if iscsi is used without multipath

4. Failover and recovery

With multipath configuration and the settings above network interface failover is about 2 seconds.

iSCSI target failover (service storpool_iscsi stop) is about 13 seconds.