If the plan is to make the LV smaller, you first have to resize the filesystem and then use the lvreduce command to decrease the size of the LV. This is because if you reduced the LV first, the system would not be able to access the filesystem beyond the new LV size.
To shrink the size of an LV, there are five important steps, and they must be executed in order or the procedure will fail and potentially cause filesystem damage:
1. Unmount the mount point or logical volume with the umount command.
# umount /mount/point
2. Force fsck to check the filesystem.
# fsck -f /dev/mapper/VG0-lv0
3. Use resize2fs to reduce the filesystem.
# resize2fs /dev/mapper/VG0-lv0 24M
4. Use lvreduce to reduce the size of the logical volume.
# lvreduce -L -40M /dev/mapper/VG0-lv0
5. Mount the filesystem with the mount command.
# mount /dev/mapper/VG0-lv0 /mount/point
# df -hP /mount/point
lvreduce command examples
1. To reduce the logical volume:
# lvreduce -l [-]LogicalExtentsNumber[%{VG|LV|FREE|ORIGIN}]
2. To disable udev synchronization:
# lvreduce --noudevsync
3. To reduce or set the logical volume size in units of logical extents:
# lvreduce -l [-]LogicalExtentsNumber[%{VG|LV|FREE|ORIGIN}] # lvreduce --extents [-]LogicalExtentsNumber[%{VG|LV|FREE|ORIGIN}]
4. To reduce or set the logical volume size in units of megabytes:
# lvreduce -L [-]LogicalVolumeSize[bBsSkKmMgGtTpPeE] # lvreduce --size [-]LogicalVolumeSize[bBsSkKmMgGtTpPeE]
5. To do not perform fsck before resizing filesystem when filesystem requires it:
# lvreduce -n # lvreduce --nofsck
6. To resize underlying filesystem together with the logical volume using fsadm:
# lvreduce -r # lvreduce --resizefs