Extend a GFS2 LUN

The changes should seen by the OS after the LUN has been extended on the storage side.

dmesg

sd 0:0:1:3: Warning! Received an indication that the operating parameters on this target have changed. The Linux SCSI layer does not automatically adjust these parameters.
sd 3:0:0:3: Warning! Received an indication that the operating parameters on this target have changed. The Linux SCSI layer does not automatically adjust these parameters.
sd 3:0:1:3: Warning! Received an indication that the operating parameters on this target have changed. The Linux SCSI layer does not automatically adjust these parameters.
sd 0:0:0:3: Warning! Received an indication that the operating parameters on this target have changed. The Linux SCSI layer does not automatically adjust these parameters.

Commands on both nodes


1. Find out LUN's paths

[root@localhost ~]# multipath -l /dev/mapper/mpathd 
mpathd (3600601600a20330030f0ff07f8dce211) dm-4 DGC,RAID 10
size=400G features='1 retain_attached_hw_handler' hwhandler='1 alua' wp=rw
|-+- policy='round-robin 0' prio=0 status=active
| |- 0:0:1:3 sdh 8:112 active undef running
| `- 3:0:1:3 sdq 65:0  active undef running
`-+- policy='round-robin 0' prio=0 status=enabled
  |- 0:0:0:3 sdd 8:48  active undef running
  `- 3:0:0:3 sdm 8:192 active undef running

2. Rescan SCSI paths for the LUN

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
less /var/log/messages

Jan 16 03:09:50 localhost kernel: sd 0:0:1:3: [sdh] 1384120320 512-byte logical blocks: (708 GB/660 GiB)
Jan 16 03:09:50 localhost kernel: sdh: detected capacity change from 429496729600 to 708669603840
Jan 16 03:09:57 localhost kernel: sd 3:0:1:3: [sdq] 1384120320 512-byte logical blocks: (708 GB/660 GiB)
Jan 16 03:09:57 localhost kernel: sdq: detected capacity change from 429496729600 to 708669603840
Jan 16 03:10:06 localhost kernel: sd 0:0:0:3: [sdd] 1384120320 512-byte logical blocks: (708 GB/660 GiB)
Jan 16 03:10:06 localhost kernel: sdd: detected capacity change from 429496729600 to 708669603840
Jan 16 03:10:13 localhost kernel: sd 3:0:0:3: [sdm] 1384120320 512-byte logical blocks: (708 GB/660 GiB)
Jan 16 03:10:13 localhost kernel: sdm: detected capacity change from 429496729600 to 708669603840

3. Resize multipath device

The mpath device might be different on the second node of the cluster so make sure you resize the right device.

multipathd -k"resize map mpathd"
multipathd -k"resize map mpathb"
less /var/log/messages

Jan 16 03:13:35 localhost multipathd: mpathd: resize map (operator)
Jan 16 03:13:35 localhost multipathd: mpathd: load table [0 1384120320 multipath 1 retain_attached_hw_handler 1 a lua 2 1 round-robin 0 2 1 8:112 100 65:0 100 round-robin 0 2 1 8:48 100 8:192 100]
Jan 16 03:13:35 localhost kernel: sd 0:0:1:3: alua: port group 02 state A preferred supports tolUsNA
Jan 16 03:13:35 localhost kernel: sd 3:0:1:3: alua: port group 02 state A preferred supports tolUsNA

Commands only on the first node


1. Resize physical volume

pvresize /dev/mapper/mpathd

2. Extend logical volume with all available space

lvextend -l +100%FREE /dev/<vg>/<lv>

3. Grow GFS2 file system

[root@localhost ~]# gfs2_grow /apps
FS: Mount Point: /apps
FS: Device:      /dev/dm-11
FS: Size:        104854775 (0x63ff4f7)
FS: RG size:     65533 (0xfffd)
DEV: Size:       173014016 (0xa4ffc00)
The file system grew by 266247MB.
gfs2_grow complete.
less /var/log/messages

Jan 16 03:16:12 localhost kernel: GFS2: fsid=gfs2cls:gfs2pv.1: File system extended by 65528 blocks.
Jan 16 03:16:12 localhost kernel: GFS2: fsid=gfs2cls:gfs2pv.1: File system extended by 1310560 blocks.
Jan 16 03:16:12 localhost kernel: GFS2: fsid=gfs2cls:gfs2pv.1: File system extended by 2817704 blocks.
Jan 16 03:16:12 localhost kernel: GFS2: fsid=gfs2cls:gfs2pv.1: File system extended by 2752176 blocks.
Jan 16 03:16:12 localhost kernel: GFS2: fsid=gfs2cls:gfs2pv.1: File system extended by 2817704 blocks.
Jan 16 03:16:12 localhost kernel: GFS2: fsid=gfs2cls:gfs2pv.1: File system extended by 2817704 blocks.
Jan 16 03:16:12 localhost kernel: GFS2: fsid=gfs2cls:gfs2pv.1: File system extended by 2752176 blocks.
Jan 16 03:16:12 localhost kernel: GFS2: fsid=gfs2cls:gfs2pv.1: File system extended by 2817704 blocks.

4. Check the new size of the file system

df -h /apps