Notes on how to extend LVM partitions. I do this so infrequently that I forget how and have to look up the steps all the time. These are my own notes so that next time I will at least follow the same steps.
Assess Current Partition Space
Nagios just gave me warning notification my /usr partition has less than 20% free space. To check if that is accurate, I use the ‘df’ command with the file system in question. Unsurprisingly the alert seems accurate, and since this is a repeat alert, only temporarily addressed by freeing up space by hand, it is time to extend the partition on the volume.
Is There Unused Space Available?
Now it is time to display the volume group details, and see what I have yet to use. To do this I use the ‘vgdisplay’ command with the volume name. In this case it looks like I have in excess of 500GiB of unallocated space.
Increase Partition Size with LVMExtend
I think I will add 10GiB to the partition, leaving free space closer to 40% and silencing the Nagios complaint. This is done using the lvmextend command as seen below.
Resize the File System
The file system needs to be resized to take advantage of the additional partition space. The ‘resize2fs’ command is ideal for this purpose.
Run the ‘df’ command again to make sure change is as expected.
All is well, and until next time, peace out.