Multipath-IO

来自 Alpine Linux

多路径存储 I/O 在 Alpine Linux 安装介质上默认未启用。Linux 上的多路径 I/O 依赖于 devicemappereudev

注意: 不支持从多路径 I/O 设备启动,这需要在 mkinitfs 软件包中进行更改。
# apk add lsscsi multipath sg3_utils
# modprobe dm_mod dm-multipath
# setup-udev

列出您的 SCSI 磁盘。

# 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

在大多数情况下,您的 LUN 将被列入黑名单,因此以下命令可能不会显示任何输出。

# multipath -v2 -d # dry-run

如果是这样,则运行更详细的检查。

# 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

然后检查 multipath 默认值。

# 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...

因此,我们的 /dev/sd[ab] 未被列入黑名单,但 ID_WWN 用于显式要求 LUN 的 wwn。

查看 wwids 文件位于何处。

# 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:

让我们将您的 LUN(即通过两个 LUN 访问您的 wwn)添加到 /etc/multipath/wwids

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

参见,wwn 用 / 括起来。

让我们再次扫描。

# 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

让我们来真的,即省略 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

如果我们对配置感到满意,让我们添加 openrc 守护程序。

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