Extending filesystem on RHEL with LVM

You need to extend a filesystem on a RedHat box? Check the filesystems with df -H. You might get something like

Filesystem             Size   Used  Avail Use% Mounted on
11G   8.0G   2.0G  81% /
/dev/cciss/c0d0p1      104M    18M    81M  19% /boot
tmpfs                  2.1G      0   2.1G   0% /dev/shm
4.2G   146M   3.9G   4% /tmp
4.2G   873M   3.1G  23% /var
11G   8.1G   1.8G  83% /var/lib/mysql
47G    16G    29G  35% /srv

You need to increase the volume capacity first, e.g. for /srv mount:

lvextend -L +15G /dev/system/srvlv

where +15G tells the command to extend the volume by another 15GB.

Last step is to adjust the filesystem to that volume’s new size:

resize2fs /dev/mapper/system-srvlv

That’s it 🙂