Grow multipath LVM FS
Off-line
I took this guide and boiled it down a bit...
1. Check what's mounted on the the VG/LV that you want to resize...
[root]# mount
[...snip...]
/dev/mapper/vg_data-lv_orahome on /u01 type ext3 (rw)
/dev/mapper/vg_data-lv_oraredo1 on /u02 type ext3 (rw)
/dev/mapper/vg_data-lv_oraredo2 on /u03 type ext3 (rw)
/dev/mapper/vg_data-lv_oradata on /u04 type ext3 (rw)
[root]# cat /etc/fstab
[...snip...]
/dev/vg_data/lv_orahome /u01 ext3 defaults 0 0
/dev/vg_data/lv_oraredo1 /u02 ext3 defaults 0 0
/dev/vg_data/lv_oraredo2 /u03 ext3 defaults 0 0
/dev/vg_data/lv_oradata /u04 ext3 defaults 0 0
[root]# /usr/sbin/vgdisplay vg_data
--- Volume group ---
VG Name vg_data
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 15
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 4
Open LV 4
Max PV 0
Cur PV 1
Act PV 1
VG Size 100.00 GB
PE Size 4.00 MB
Total PE 51199
Alloc PE / Size 51199 / 200.00 GB
Free PE / Size 0 / 0
VG UUID R0vsEk-6E72-wmOQ-0VAz-TflV-2W4v-T7B5yj
[root@]# /usr/sbin/lvdisplay vg_data
--- Logical volume ---
LV Name /dev/vg_data/lv_orahome
VG Name vg_data
LV UUID 7e36Fr-AiUK-UacN-ag5F-seEj-QDQh-J8rnxJ
LV Write Access read/write
LV Status available
# open 1
LV Size 10.00 GB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:8
--- Logical volume ---
LV Name /dev/vg_data/lv_oraredo1
VG Name vg_data
LV UUID GHGtKL-fSMA-KSbe-rmr3-UYOT-6N7d-6nyJwd
LV Write Access read/write
LV Status available
# open 1
LV Size 5.00 GB
Current LE 1280
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:9
--- Logical volume ---
LV Name /dev/vg_data/lv_oraredo2
VG Name vg_data
LV UUID es1Nco-AT44-Yrte-2r59-wQIB-xn3A-oNsNF0
LV Write Access read/write
LV Status available
# open 1
LV Size 5.00 GB
Current LE 1280
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:10
--- Logical volume ---
LV Name /dev/vg_data/lv_oradata
VG Name vg_data
LV UUID de60o2-FP0e-2H3d-6uAu-eGE7-ZPAP-lHAn0s
LV Write Access read/write
LV Status available
# open 1
LV Size 80.00 GB
Current LE 46079
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:11
[root]# umount /u01
[root]# umount /u02
[root]# umount /u03
[root]# umount /u04
2. Deactivate the volume group...
[root]# /usr/sbin/vgchange -an vg_data 0 logical volume(s) in volume group "vg_data" now active
3. Work out on what physical device the actual PV relates to...
[root]# /usr/sbin/pvdisplay --- Physical volume --- PV Name /dev/dm-7 VG Name vg_data PV Size 100.00 GB / not usable 3.81 MB Allocatable yes (but full) PE Size (KByte) 4096 Total PE 51199 Free PE 0 Allocated PE 51199 PV UUID fXYKfP-BlU7-NZ3Y-Silt-6wZr-uDNp-n8FcSh --- Physical volume --- PV Name /dev/dm-3 VG Name vg_root PV Size 9.99 GB / not usable 20.89 MB Allocatable yes (but full) PE Size (KByte) 32768 Total PE 319 Free PE 0 Allocated PE 319 PV UUID Asi9qk-0VCR-W01d-7lhG-mDr9-YBl1-dP5d68
4. ...and tell the multipath driver to rescan it, if you havn't deactivated the VG it'll hang the machine...
[root]# /sbin/multipath -ll
mpath1 (36005076308ffc0bd0000000000001102) dm-7 IBM,2107900
[size=200G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
\_ 1:0:0:1 sdd 8:48 [active][ready]
\_ 0:0:0:1 sdb 8:16 [active][ready]
mpath0 (36005076308ffc0bd0000000000001100) dm-0 IBM,2107900
[size=16G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
\_ 0:0:0:0 sda 8:0 [active][ready]
\_ 1:0:0:0 sdc 8:32 [active][ready]
[root]# for i in `/sbin/multipath -ll mpath1 | grep sd | awk '{print $3}'`; do /sbin/blockdev --rereadpt /dev/$i ; done
1:0:0:1
0:0:0:1
[root]# dmesg
5. Instruct multipath to expand the device...
[root]# /sbin/multipathd -k"resize multipath mpath1" ok
6. Resize the Physical Volume...
[root]# /usr/sbin/pvresize /dev/mapper/mpath1 Physical volume "/dev/mpath/mpath1" changed 1 physical volume(s) resized / 0 physical volume(s) not resized
7. Extend the Logical Volume and reactivate the VG...
[root]# /usr/sbin/lvextend -L +100G /dev/mapper/vg_data-lv_oradata Extending logical volume vg_data-lv_oradata to 180.00 GB Logical volume vg_data-lv_oradata successfully resized [root]# /usr/sbin/vgchange -ay vg_data
8. Fsck (no harm unless it's huge) and then resize the file system...
[root]# /sbin/e2fsck -f /dev/vg_data/lv_oradata [root]# /sbin/resize2fs /dev/mapper/vg_data-lv_oradata
9. Remount everything...
[root]# umount /u01 [root]# umount /u02 [root]# umount /u03 [root]# umount /u04
On-line
Technically this is unsupported on Linux because the multipath drivers can't handle the resizing however there is a guide here but I'm not sure I'd try it on a production system.
