——————-
Reducing(Offline)::
——————-
Scenario:
-There is existing LVM partition 50GB in total and has been used up 5GB
-We will reduce the LVM partition from 50GB to 10GB
-We need to unmount the FS before we can proceed
-Please do proper backup before proceed as there might be chances that you would lose your data
Output from df -h /media/data:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgdata-lvdata 50G 5.0G 42G 11% /media/data
Example current usage taken from df -h is 5G and wanted to be shrunk to 10G
# umount /dev/vgdata/lvdata
# e2fsck -f /dev/vgdata/lvdata
# resize2fs /dev/vgdata/lvdata 8G
# e2fsck -f /dev/vgdata/lvdata
# lvreduce -L 10G /dev/vgdata/lvdata
# e2fsck -f /dev/vgdata/lvdata
# resize2fs /dev/vgdata/lvdata
# e2fsck -f /dev/vgdata/lvdata
# mount -a
——————-
Increasing(online)::
——————-
Scenario:
-We would like to increase /add in another 5GB to /dev/vgdata/lvdata
lvextend -L +5G /dev/vgdata/lvdata
resize2fs /dev/vgdata/lvdata