Linux multipath resize script

This is a short post related to an older post Resizing Multipath LUNs In Linux OEL/RHEL. I just wanted to post a simple script that I wrote for doing the disk rescans and multipath resize. 


#!/bin/bash
# mp_rescan
multipath -ll $1 | grep running | awk '{print $3}' | while read i
do
echo 1 > /sys/block/$i/device/rescan
done
multipathd -k"resize map $1"

You just need to pass the script the name of the multipath device. For example, here is an excerpt from a mahcine running multipath:

  `- 2:0:3:10 sdcf 69:48  active ready running
gflwuata (350002acbd1a41340) dm-17 3PARdata,VV
size=3.1T features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
  |- 1:0:2:15 sdq  65:0   active ready running
  |- 2:0:1:15 sdbm 68:0   active ready running
  |- 1:0:3:15 sdao 66:128 active ready running
  `- 2:0:3:15 sdck 69:128 active ready running
backups (350002acadd4e1340) dm-6 3PARdata,VV
size=8.0T features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
  |- 1:0:2:4  sdf  8:80   active ready running
  |- 2:0:1:4  sdbb 67:80  active ready running
  |- 1:0:3:4  sdad 65:208 active ready running
  `- 2:0:3:4  sdbz 68:208 active ready running
To resize the LUNs and multipath device for backups, you simply do the following:

# mp_rescan backups

Comments