Quick how-to extend a LVM volume. This was a done using a Netapp LUN, using their powermt software.
Not that it should matter, but I spoofed the UUID’s.
First lets double check the settings of the current Volume Group.
# pvdisplay
PV Name /dev/emcpowerb
VG Name datavg
PV Size 1000.00 GB / not usable 4.00 MB
Allocatable yes (but full)
PE Size (KByte) 4096
Total PE 255999
Free PE 0
Allocated PE 255999
PV UUID j3lfld-sDxn-eqdG-nx0A-heVF-2Lzh-wxOqld
# lvdisplay
— Logical volume —
LV Name /dev/datavg/odata
VG Name datavg
LV UUID fe5hpd-f79U-x8DF-DOc9-N5Jc-HFTz-SuBGL4
LV Write Access read/write
LV Status available
# open 1
LV Size 1000.00 GB
Current LE 255999
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:6
Let’s also double check that the new LUN is properly connected.
# powermt display dev=all
Pseudo name=emcpowerc
CLARiiON ID=APM00101010101 [server1]
Logical device ID=01010101010101010101010101010101 [LUN 95]
state=alive; policy=CLAROpt; priority=0; queued-IOs=0
Owner: default=SP B, current=SP B Array failover mode: 1
============================================================
———- Host ——— – Stor – — I/O Path – – Stats —
### HW Path I/O Paths Interf. Mode State Q-IOs Errors
============================================================
0 lpfc sdb SP B0 active alive 0 0
0 lpfc sdd SP A0 active alive 0 0
1 lpfc sdf SP B1 active alive 0 0
1 lpfc sdh SP A1 active alive 0 0
So our new LUN in emcpowerc. So using all this info above we can extend the Logical volume.
Start by creating a new Physical Volume:
# pvcreate /dev/emcpowerc
Physical volume “/dev/emcpowerc” successfully created
Now that that LUN in in LVM, we can add it to our existing Volume Group. As seen above that VG name is datagv.
# vgextend datavg /dev/emcpowerc
Volume group “odatavg” successfully extended
We now have have two physical devices in our Volume Group. Now to extend the size of the Logical Volume.
In this case it will be 100% of the disk available in the VG to the LV
# lvextend -l +100%FREE /dev/datavg/data
Extending logical volume odata to 1.10 TB
Logical volume odata successfully resized
So at this point the Logical Volume has been extended. However to use it, you will need to resize the file system to take advantage of this space. I’m using ext3 which allows this to be done online.
I was able to do this while an oracle database was running on this file system.
# resize2fs /dev/datavg/data
resize2fs 1.39 (29-May-2006)Filesystem at /dev/datavg/data is mounted on /data; on-line resizing required
Performing an on-line resize of /dev/datavg/data to 294385664 (4k) blocks.
The filesystem on /dev/datavg/data is now 294385664 blocks long.