How to Increase FileSystem Online Linux

OK, so you need to increase the size of a file system that’s running out of space on a server. Here’s how…

Have a look at the volume group, to see if there’s any free space…

# vgs

  VG       #PV #LV #SN Attr   VSize  VFree

  rootvg   3   8   0 wz–n- 97.00g 16.99g

Yes, there is, 16.99g. Great.

In this instance i want to increase /var

# df /var

Filesystem           1K-blocks    Used Available Use% Mounted on

/dev/mapper/rootvg-lv_var

                      10255672 1975424   7756052  21% /var

# lvextend -l +100%FREE/dev/rootvg-lv_var

This allocates the available space i.e. 16.99g to/dev/rootvg-lv_var

# resize2fs /dev/rootvg-lv_var

This will resize the file system on top of the /dev/rootvg-lv_var logcial volume.