Most Linux users choose to utilize LVM for its many benefits. One key advantage is the ability to resize storage capacity as needed.
This article provides an example of how to increase the size of a file system using the command line.
Step 1: Use fdisk (or other utilities) to see the physical drives.
In this example, we use fdisk and look for all /dev/sd* devices.
In my case, /dev/sde is the unused (or possibly new) drive.
Step 2: Create a physical volume (PV) on /dev/sde
This example uses the entire device without creating a partition on /dev/sde first. You can create a partition on /dev/sde if you prefer, but it is not necessary.
Step 3: Add the PV (physical volume) to the existing VG (volume group)
The existing volume group is called VG00. You can use the ‘vgs’ command to see all existing volume group(s).
Step 4: Extend the existing LV (logical volume)
Now you can extend the logical volume.
The ‘-L+501G’ means to extend /dev/VG00/yum_store (the existing volume group) by 501G. This adds 501G to the existing volume. If you leave out the ‘+’ in the size parameter, then a specific size will be used instead.
Step 5: Extend the file system to the new LV size
The final step is to expand the file system using XFS. This will allow the file system to be extended without unmounting or experiencing any downtime.
In this case, /var/www/html is the mount point for /dev/VG00/yum_store.
Conclusion
LVM makes it extremely easy to add additional storage without downtime.