First of all, make sure you have a backup or another recovery plan.
Just in case I or you have overseen something.
As this is a special case, I could not create a "testing environment" and
play it through. All is free from my mind.
First reduce "/var" to (example) 200GB using resize2fs
, see man resize2fs
.
I am not sure if this can be done while the device is mounted.
sudo resize2fs /dev/mapper/vg0-var 200G
Next resize the logical volume to 205G (for security give 5G extra), see man lvresize
sudo lvresize -L 205G /dev/mapper/vg0-var
Now there should be around 50G free in volume group "vg0", check with:
sudo vgdisplay vg0
As there is now still a difference between the filesystemsize and the logical volume size (200G vs 205G),
you can resize the filesystem again, to fit the logical volume:
sudo resize2fs /dev/mapper/vg0-var
Summary: the filesystem must fit in the volume and the volume can not be smaller than the filesystem inside.
I thing you got the overall workflow and you can adept the numbers to your needs.
lvresize
has an option --resizefs
(see man lvresize
) which might do all the steps in one, but I never tried this, therefore I go the long way. Maybe you can try and tell us.
Reminder: be careful, any mistake might lead to data loss.