PreReqs

  •     Expanding the SAN volume is outside the scope of this article.
    For the curious, this is an EMC LUN.
  •     The server is running RHEL5.9
  •     The partition is mounted / managed using RHEL’s multipathing software.
  •     The partition is larger than 2TB. Otherwise, you’ll probably use fdisk instead of parted.

——————————————

Steps

# df -h  /backup
Filesystem                              Size     Used  Avail   Use% Mounted on
/dev/mapper/mpath2      4.0T   3.0T  820G   79%    /backup

# parted  /dev/mapper/mpath2
(parted) print
Number Start End Size File system Flags
1   0.00kB   4935GB   4935GB     ext3
# multipath -ll /dev/mapper/mpath2

mpath2 (360060160df751d000cb0364c9dd6e111) dm-8 DGC,VRAID
[size=4.5T][features=0][hwhandler=1 alua][rw]
\_ round-robin 0 [prio=1][active]
\_ 3:0:1:2 sdg 8:96 [active][ready]
\_ 4:0:1:2 sdm 8:192 [active][ready]
\_ round-robin 0 [prio=0][enabled]
\_ 3:0:0:2 sdd 8:48 [active][ready]
\_ 4:0:0:2 sdj 8:144 [active][ready]

This shows me several things
a) my multipath device:  dm-8
b) the disks that make up dm-8 :  sdg, sdm, sdd, sdj

Now I will make each of them in turn take note of the newer, larger LUN.

for DEV in sdg sdm sdd sdj; do 
     echo “## DEVICE:  ${DEV} ” 
     cat /dev/sys/block/${DEV}/size
     echo 1 > /dev/sys/block/${DEV}/device/resize
     cat /dev/sys/block/${DEV}/size
     echo ” “

Sample sub-output
DEVICE: sdj
9638510592
10687086592

I don’t think that this is necessary for SAN devices,  just internal ones, but it doesn’t hurt:
# partprobe
This takes a minute to run,  don’t panic.

# multipathd -k
multipath> resize map mpath2
multipath> ^d   (control-d)

# cat /dev/sys/block/dm-8/size
/dev/sys/block/${DEV}/size

# parted  /dev/mapper/mpath2 
(parted) print
Number Start End Size File system Flags
1      0.00kB   5472GB    5472GB    ext3

Now that the partition table is updated,  we can finally resize the actual filesystem.
The default is to resize to use the full partition. That suits me just fine.
resize2fs -p /dev/mapper/mpath2       
Filesystem at /dev/mapper/mpath2 is mounted on /backup; on-line resizing required
(long pause)
Performing an on-line resize of /dev/mapper/mpath2 to 1335885824 (4k) blocks.
(even longer pause – about 30min in my case)
The filesystem on /dev/mapper/mpath2 is now 1335885824 blocks long.

# df -h /backup
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/mpath2 4.9T 3.0T 1.8T 64% /backup

That looks good. Users now have more diskspace and I get to keep my job for another day.

Advertisements