how to extend SAN storage in CentOS 7


Step 1: Try rescanning the storage devices to tell the kernel that the size has changed. I am not sure if this has to be done for all the four components of the multipath, but it shouldn't hurt. You rescan storage devices by writing anything into their rescan file:

echo > /sys/class/block/sdl/device/rescan
echo > /sys/class/block/sdm/device/rescan
echo > /sys/class/block/sdn/device/rescan
echo > /sys/class/block/sdo/device/rescan

Scanning the HBAs should also work. SCSI HBAs have a scan file; you write three decimal numbers controller, target and LUN into it to scan that LUN. Or use wildcard "-" instead of a number. The following scans all devices on controller 0 on the two HBAs:

echo "0 - -" > /sys/class/scsi_host/host1/scan
echo "0 - -" > /sys/class/scsi_host/host4/scan

Step 2: At this point, the kernel knows that /dev/mapper/mpathc is 27TB. You will now have to increase the size of partition 1. The parted command can be used for resizing partitions, but I believe the Centos 7 version of parted doesn't have that feature. I would therefore unmount the filesystem, remove the partition (scary, I know), then create the partition again, this time with the correct size. Check that its parameters are correct.

umount /dev/mapper/mpathc1
parted /dev/mapper/mpathc1 rm 1 mkpart primary 0% 100% print

You may want to test that first on a disk that doesn't contain valuable data.

I don't know if it's possible to install a parted version that does have the resizepart command. It would make the second step easier.

The RHEL 7 storage manual contains a similar procedure with fdisk, but it assumes LVM, and no multipathing. After the fdisk procedure, you will probably have to use kpartx to inform the kernel about the changes on the disk. Thus, the parted approach seems easier, therefore safer to me.

Step 3: Increase the filesystem. First, mount it again. If it's XFS, you must mount it, then run xfs_growfs.

mount /dev/mapper/mpathc1 /Splunk-Storage/COLD
xfs_growfs /Splunk-Storage/COLD

If it's ext[234], run resize2fs. It can be mounted or unmounted.

resize2fs /dev/mapper/mpathc1
mount /dev/mapper/mpathc1 /Splunk-Storage/COLD

You are done.