Multipath

multipath – Device mapper target autoconfig

Tasks

list current multipath device maps

multipath -l
multipath -ll
multipath -l -v2
multipath -l -v2 /dev/mapper/mpathe

creates multipath nodes (drives must not be in use)

multipath -v2

flush all unused multipath device maps

multipath -F

flush a multipath device map specified as parameter, if unused

multipath -f mpathae

Add a path manually

You need to find out the WWID -> How to get the WWID of a device

$ sudo multipath -a 3600d02310009005d1d40b1687687dfe0
wwid '3600d02310009005d1d40b1687687dfe0' added

Then create the nodes:

multipath -v2

multipath -f <device name> says “map in use”

lsof /dev/mapper/<device name>
ls /sys/block/dm-<number>/holders/

Is Open count 0:

dmsetup info <device_name>
dmsetup remove <device_name>
grep <device_path> /proc/*/mounts

Unsorted

The device name is build using the wwid

# more "/sys/devices/pci0000:00/0000:00:03.0/0000:03:00.0/host11/rport-11:0-1/target11:0:1/11:0:1:0/wwid"
naa.600d023100000cf327305f764ed7467b
mpathaa (3600d023100000cf327305f764ed7467b) dm-17

Random problem:

After unmapping the LUN from the SAN storage we get the following output for multipath -ll command

mpathae (360050763008085830800000000000036) dm-38 IBM,2145
size=150G features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=30 status=active
  |- 11:0:0:25 sdaa 65:160 couldn't get target port group
  `- 12:0:0:25 sdbg 67:160 couldn't get target port group

In order to get rid of this drive, first, delete the multipath drive

[root@hostname ~]# multipath -f mpathae

Then, delete the block device

[root@hostname ~]# echo 1 > /sys/block/sdaa/device/delete
[root@hostname ~]# echo 1 > /sys/block/sdbg/device/delete