Today i was researching howto increase diskspace on an linuxbox that was running LVM. I have done this before but lost the commands. So here is a quick guide for my own remindings.
First of all, run the command vgs to get information about your volume groups (VGs)
VG #PV #LV #SN Attr VSize VFree
srv01 1 6 0 wz--n- 29.76g 3.88g
Then run lvdisplay to show your current lv-volumes.
--- Logical volume ---
LV Name /dev/srv01/tmp
VG Name srv01
LV UUID xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx
LV Write Access read/write
LV Status available
# open 1
LV Size 680.00 MiB
Current LE 170
Read ahead sectors auto
- currently set to 256
Block device 254:4
Now we know our lv’s name in this case /dev/srv01/tmp. now its time to increase the space. the command below increases the volume by 300mb. Check your VGs to that you have enough space left.
lvresize -L+300M /dev/srv01/tmp
When this is done, you can run the command
df -h to check your diskspace, as you can see the space has not increased on the mounted filesystem. You will have to run resize2fs in order to change the filesystem space. my /tmp folder has its filesystem under /dev/dm-4 as shown in the df -h command. resize the ext3 volume to the same size as your lvm.
resize2fs /dev/dm-4 680M