Shrink Multipath Block Device

From Linux User Group at WUR
Jump to: navigation, search

Before you start - be advised that currently it is not possible to shrink an XFS filesystem. You will have to add a new device, copy the files onto it, then remove the larger one.

However, it is possible to shrink an LVM PV formatted device, or an ext4 filesystem. Please see the LVM shrinking page for methods for how to do this. Be aware there are still potential risks, so it's a good idea to have a backup of the data in case of issues.

Long story short - this will only ever happen if your block devices are being transmitted over a SAN. Once you've cleaned up the last blocks on a device as depicted in the above link, then allow the block device to be reduced at the originator. Rescan the devices as per the instructions for growing:

# echo 1 > /sys/class/scsi_device/X\:X\:X\:X/device/rescan

Resize the path in multipathd with:

# multipathd -k"resize multipath san4_Data"

Once that's done, multipath should now report the new size:

# multipath -ll san4_Data

san4_Data (360002ac00000000000000dfa00004ca6) dm-3 3PARdata,VV             
size=250G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 0:0:1:2 sdb 8:16  active ready running
  `- 1:0:1:2 sdg 8:96  active ready running