Multipath-IO

From Alpine Linux

Multipath storage I/O is not abled by default on Alpine Linux installation media. Multipath I/O on Linux depends on devicemapper and eudev.

Note: Booting from multipath I/O device is not supported, it would need changes in mkinitfs package..
# apk add lsscsi multipath sg3_utils
# modprobe dm_mod dm-multipath
# setup-udev

List your SCSI disks.

# lsscsi -isw | grep disk
[2:0:0:0x0000]              disk    600140547f7876a3412466aab5f0debf  /dev/sda   3600140547f7876a3412466aab5f0debf  1.07GB
[2:0:0:0x0001]              disk    600140547f7876a3412466aab5f0debf  /dev/sdb   3600140547f7876a3412466aab5f0debf  1.07GB

In most cases your LUNs would be blacklisted, thus following command would probably show no output.

# multipath -v2 -d # dry-run

If so then run more verbose check.

# multipath -v3 -d # dry-run
...skipped...
===== paths list =====
uuid                              hcil    dev dev_t pri dm_st chk_st vend/prod
3600140547f7876a3412466aab5f0debf 2:0:0:0 sda 8:0   50  undef undef  LIO-ORG,t
3600140547f7876a3412466aab5f0debf 2:0:0:1 sdb 8:16  50  undef undef  LIO-ORG,t
Mar 15 17:32:27 | libdevmapper version 1.02.170 (2020-03-24)
Mar 15 17:32:27 | DM multipath kernel driver v1.14.0
Mar 15 17:32:27 | sda: udev property ID_WWN whitelisted
Mar 15 17:32:27 | wwid 3600140547f7876a3412466aab5f0debf not in wwids file, skipping sda
Mar 15 17:32:27 | sda: orphan path, only one path
Mar 15 17:32:27 | sdb: udev property ID_WWN whitelisted
Mar 15 17:32:27 | wwid 3600140547f7876a3412466aab5f0debf not in wwids file, skipping sdb
Mar 15 17:32:27 | sdb: orphan path, only one path
Mar 15 17:32:27 | unloading alua prioritizer
Mar 15 17:32:27 | unloading const prioritizer
Mar 15 17:32:27 | unloading tur checker

Then check multipath defaults.

# multipath -t
...skipped...
blacklist {
       devnode "!^(sd[a-z]|dasd[a-z]|nvme[0-9])"
       device {
               vendor "SGI"
               product "Universal Xport"
       }
       ...skipped...
}
blacklist_exceptions {
       property "(SCSI_IDENT_|ID_WWN)"
}
...skipped...

Thus our /dev/sd[ab] are not blacklisted but ID_WWN is used to explicit require wwn for LUNs.

See where wwids file is located.

# multipath -t | grep wwids_file
       wwids_file "/etc/multipath/wwids"
# cat /etc/multipath/wwids
# Multipath wwids, Version : 1.0
# NOTE: This file is automatically maintained by multipath and multipathd.
# You should not need to edit this file in normal circumstances.
#
# Valid WWIDs:

Let's add our LUNs (ie. our wwn access via two LUNs) to /etc/multipath/wwids.

# multipath -a 3600140547f7876a3412466aab5f0debf
wwid '3600140547f7876a3412466aab5f0debf' added
# egrep -v '^(#|$)' /etc/multipath/wwids 
/3600140547f7876a3412466aab5f0debf/

See, wwn are bordered with /.

Let's scan again.

# multipath -v2 -d # dry-run
Mar 15 17:46:35 | 3600140547f7876a3412466aab5f0debf: setting dev_loss_tmo is unsupported for protocol scsi:unspec
: 3600140547f7876a3412466aab5f0debf undef LIO-ORG,test0
size=1.0G features='0' hwhandler='1 alua' wp=undef
|-+- policy='service-time 0' prio=50 status=undef
| `- 2:0:0:0 sda 8:0  undef ready running
`-+- policy='service-time 0' prio=50 status=undef
  `- 2:0:0:1 sdb 8:16 undef ready running

Let's go real, ie. omit dry-run.

# multipath -v2
Mar 15 17:48:06 | 3600140547f7876a3412466aab5f0debf: setting dev_loss_tmo is unsupported for protocol scsi:unspec
Mar 15 17:48:06 | 3600140547f7876a3412466aab5f0debf: addmap [0 2097152 multipath 0 1 alua 2 1 service-time 0 1 1 8:0 1 service-time 0 1 1 8:16 1]
create: 3600140547f7876a3412466aab5f0debf undef LIO-ORG,test0
size=1.0G features='0' hwhandler='1 alua' wp=undef
|-+- policy='service-time 0' prio=50 status=undef
| `- 2:0:0:0 sda 8:0  undef ready running
`-+- policy='service-time 0' prio=50 status=undef
  `- 2:0:0:1 sdb 8:16 undef ready running
# multipath -ll | sed 's/^/ /'
3600140547f7876a3412466aab5f0debf dm-2 LIO-ORG,test0
size=1.0G features='0' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| `- 2:0:0:0 sda 8:0  active ready running
`-+- policy='service-time 0' prio=50 status=enabled
  `- 2:0:0:1 sdb 8:16 active ready running

If we are happy with the configuration, let's add openrc daemons.

# apk add multipath-tools-openrc
# rc-update add multipath boot
# rc-update add multipathd boot