Reducing an LVM Pool

1 Check sizes and unmount the file system for reducing

Make a noteof the existing size, and carefully record the used space.

df -h
        
/dev/mapper/centos-home  xfs       110G   20G   80G    25%  /mnt/offline_home #we will reduce this down by 60gb to leave 30gb free, 50gb total
umount /mnt/offline_home

2 Check the file system after unmount

This is very important! Failure to check your filesystem can permanantly damage your data

e2fsck -ff /dev/centos/home 
#IMPORTANT, ensure all 5 test pass!

3 Reduce the Logical Volume size than Current size

PAY ATTENTION TO THE VALUES HERE OR LOSE YOUR DATA
resize2fs -p /dev/centos/home 45GB #The value here is the 90% of the new size!!
lvreduce -L -60G /dev/centos/home #The 60G here is the amount to remove!!

3a Alternative method

This VG uses a 32Mb value.

In a 50gb partition, there would be 50GB / 32MB or 50,000 / 32 = 1,563 (round up)

resize2fs -p /dev/centos/home 45GB #The value here is the 90% of the new size!!
lvreduce -l -1875 /dev/centos/home #the value is the extents to become!!

4 Recheck the file system for errors.

It is best to do this just in case.

e2fsck -ff /dev/centos/home #quick check for safety

5 Resize from 90% to 100% of the new volume

resize2fs -p /dev/centos/home #Resize the filesystem up again to the full 50gb

6 Remount the file-system.

mount /dev/centos/home /mnt/offline_home

df -h
/dev/mapper/centos-home  xfs       50G   20G   30G    40% /mnt/offline_home

DONE!