Categories
Linux

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
/dev/mapper/system-root
11G   8.0G   2.0G  81% /
/dev/cciss/c0d0p1      104M    18M    81M  19% /boot
tmpfs                  2.1G      0   2.1G   0% /dev/shm
/dev/mapper/system-tmp
4.2G   146M   3.9G   4% /tmp
/dev/mapper/system-var
4.2G   873M   3.1G  23% /var
/dev/mapper/system-mysqllv
11G   8.1G   1.8G  83% /var/lib/mysql
/dev/mapper/system-srvlv
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 🙂