Multipath commands

  • Install multipath:

RHEL 6

yum install device-mapper-multipath
chkconfig multipathd on
/etc/init.d/multipathd start 

RHEL 7

yum install device-mapper-multipath
systemctl enable multipathd
systemctl start multipathd
  • Enables the multipath configuration file and starts the multipathd daemon: mpathconf --enable --with_multipathd y

Commands

  • Flush all unused multipath device maps: multipath -F
  • Print all paths and multipaths: multipath -v2
  • Print mode information: multipath -v4 -ll
  • List SCSI devices and their attributes: lssci
  • Enter multipathd interactive console: multipathd -k
  • Get the running config for dm-multipath: multipathd -k'show config'

  • Rescan a disk: echo 1 > /sys/block/sdX/device/rescan

  • Resize a multipath LUN:
multipath -ll mpathd

echo 1 > /sys/block/sdh/device/rescan
echo 1 > /sys/block/sdq/device/rescan
echo 1 > /sys/block/sdd/device/rescan
echo 1 > /sys/block/sdm/device/rescan

multipathd -k"resize map mpathd"

pvresize /dev/mapper/mpathd
  • Removing a path to a storage device:
echo offline > /sys/block/sdX/device/state
echo 1 > /sys/block/sdX/device/delete
  • Removing a storage device:
umount /path/to/volume

vgreduce <vg> </dev/disk>
pvremove </dev/disk>

multipath -ll mpathd

lsof /dev/sdh
lsof /dev/sdm
lsof /dev/sdd
lsof /dev/sdq

multipath -f mpath8 or multipath -f <WWID>

blockdev –flushbufs <device>               # for each path, especially for ASM devices (not had a forced IO flush via things like vgreduce)         

echo 1 > /sys/block/sdh/device/delete
echo 1 > /sys/block/sdm/device/delete
echo 1 > /sys/block/sdd/device/delete            
echo 1 > /sys/block/sdq/device/delete
  • Unable to remove multipath device with "mpathX in use"

Logical volumes were not removed before removing the paths

dmsetup remove volumegroup-lvname
dmsetup remove /dev/mapper/mpathX
multipath -f mpathX

When devices are brought under the control of device-mapper-multipath the new multipathed devices can be seen in three different places under the /dev directory: /dev/dm-N, /dev/mapper/mpathN and /dev/mpath/mpathN.

  • The /dev/dm-N devices are internal to device mapper and should never be used. These devices are not persistent. Starting with Red Hat Enterprise Linux 5,these devices are no longer created by udev.
  • The /dev/mpath/mpathN devices are provided so that all the multipathed devices can be seen in one place. However, these device nodes may not be created on bootbefore the system needs to access them. Therefore they should not beused for creating Physical Volumes for Volume Groups or partitions with filesystems.
  • The /dev/mapper/mpathN devices are persistent and they are created early in the boot process. Therefore these are the device names that should be used to access the multipathed devices.

Files

  • The bindings file: /etc/multipath/bindings (RHEL 6) or /var/lib/multipath/bindings (RHEL 4-5)
  • Complete list of the default configuration values: /usr/share/doc/device-mapper-multipath-<version>/multipath.conf.defaults
  • A list of configuration options with descriptions: /usr/share/doc/device-mapper-multipath-<version>/multipath.conf.annotated

Links