使用multipath实用程序 配置 DM-Multipath

multipath实用程序是设备映射器目标自动配置器,用于检测和配置设备的多条路径。
使用以下命令显示使用情况:

# multipath -h
multipath-tools v0.4.9 (05/33, 2016)
Usage:
  multipath [-a|-A|-c|-w|-W] [-d] [-T tm:val] [-r] [-i] [-v lvl] [-p pol] [-b fil] [-q] [dev]
  multipath -l|-ll|-f [-v lvl] [-b fil] [dev]
  multipath -F [-v lvl]
  multipath -t
  multipath -h
Where:
  -h      print this usage text
  -l      show multipath topology (sysfs and DM info)
  -ll     show multipath topology (maximum info)
  -f      flush a multipath device map
  -F      flush all multipath device maps
  -a      add a device wwid to the wwids file
  -A      add devices from kernel command line mpath.wwids
          parameters to wwids file
  -c      check if a device should be a path in a multipath device
  -T tm:val
          check if tm matches the multipathd timestamp. If so val is
          whether or not the device is a path in a multipath device
  -q      allow queue_if_no_path when multipathd is not running
  -d      dry run, do not create or update devmaps
  -t      dump internal hardware table
  -r      force devmap reload
  -i      ignore wwids file
  -B      treat the bindings file as read only
  -b fil  bindings file location
  -w      remove a device from the wwids file
  -W      reset the wwids file include only the current devices
  -p pol  force all maps to specified path grouping policy :
          . failover            one path per priority group
          . multibus            all paths in one priority group
          . group_by_serial     one priority group per serial
          . group_by_prio       one priority group per priority lvl
          . group_by_node_name  one priority group per target node
  -v lvl  verbosity level
          . 0 no output
          . 1 print created devmap names only
          . 2 default verbosity
          . 3 print debug information
  dev     action limited to:
          . multipath named 'dev' (ex: mpath0) or
          . multipath whose wwid is 'dev' (ex: 60051..)
          . multipath including the path named 'dev' (ex: /dev/sda)
          . multipath including the path with maj:min 'dev' (ex: 8:0)

一些可用选项描述如下:

  • -v [verbosity] - 显示路径和多路径时指定详细级别。
  • -l - 列出多路径拓扑。
  • -ll - 列出最大多路径拓扑信息。
  • -f - 刷新多路径设备映射。使用 -F 刷新所有多路径设备映射。
  • -c - 检查设备是否应该是多路径设备中的路径。
  • -p 故障转移 |多总线| group_by_serial | group_by_prio |group_by_node_name - 强制所有映射到指定的路径分组策略。
  • -r - 强制重新加载设备映射。

我们可以选择指定设备名称以仅更新包含指定设备的设备映射。
使用 /dev/sd# 格式、major:minor 格式、多路径映射名称(例如 mpathN)或者 WWID 来指定设备。

multipath -ll 命令的示例输出如下:

# multipath -ll
...
mpathb(36001405346939038cc9480caf0dd9a9d) dm-3 LIO-ORG ,IBLOCK size=10g features=‘0’ hwhandler=‘0’ wp=rw
‘-+- policy=‘service-time 0’ prio=1 status=active
‘- 2:0:0:2 sdb 8:16 active ready running 
mpatha(36001405a7c28190541f4d61880050090) dm-2 LIO-ORG ,IBLOCK size=10g features=‘0’ hwhandler=‘0’ wp=rw
‘-+- policy=‘service-time 0’ prio=1 status=active
      ‘- 2:0:0:1 sda 8:0     active ready running
...

mpathb 的输出描述如下:

  • mpathb - 用户友好的设备名称
  • 36001405346939038cc9480caf0dd9a9d - 唯一的 WWID
  • dm-3 - sysfs 文件名
  • LIO-ORG - 供应商名称
  • IBLOCK - Linux 块设备
  • size=10g - DM 设备的大小
  • features='0' - 支持 DM 功能
  • hwhandler='0' - 硬件处理程序
  • wp=rw - 写权限,设置为读写
  • policy='service-time 0' - 路径选择器算法
  • prio=1 - 路径组优先级
  • status=active - 路径组状态
  • 2:0:0:2 - SCSI 信息:主机、通道、scsi_id 和 LUN
  • sdb - Linux 设备名称
  • 8:16 - 主要和次要号码
  • active ready running - DM 路径和物理路径状态
日期:2020-09-17 00:14:45 来源:oir作者:oir