How to Reduce LVM Logical Volume size in Linux Easily

How to Reduce LVM Logical Volume size in Linux Easily

In this post, We explain you how to reduce the LVM partition size in Linux. We may come across in a situation to reduce the LVM Partition in Linux. Refer this link to create LVM Partition in Linux and also refer to reduce the partition in linux without LVM.
Assume that, we wanted to reduce the /data by 2GB. But make sure that you have free physical extents of 2Gb, Else we need to move the used extents from one PV to other PV. Refer this link to know how to remove physical volume in linux., Hope you have free physical extends of 2Gb to reduce the logical volume.

[[email protected] ~]# df -h /data
Filesystem                            Size       Used    Avail     Used%      Mounted on
/dev/mapper/vg01-lvol0         10G        5.0G    4.9G      50%        /data

Step1 : Umount the filesystem

[[email protected] ~]#  umount  /data

Step2 : Check the filesystem for errors using e2fsck command

[[email protected] ~]# e2fsck -f /dev/mapper/vg01-lvol0
e2fsck 1.41.12 (17-May-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/vg01-lvol0: 10/770640 files (0.0% non-contiguous), 2446686/3084288 blocks

Step3 : Reduce the volume size of /data

[[email protected] ~]# resize2fs /dev/mapper/vg01-lvol0 8G
resize2fs 1.41.12 (17-May-2013)
Resizing the filesystem on /dev/mapper/vg01-lvol0 to 2021440 (4k) blocks.
The filesystem on /dev/mapper/vg01-lvol0 is now 2021440 blocks long.

Step4 : Reduce the size in LVM using lvreduce command

[[email protected] ~]# lvreduce  -L 8G /dev/mapper/vg01-lvol0
WARNING: Reducing active logical volume to 8.00 GiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lvol0? [y/n]: y
Reducing logical volume Lvol0 to 8.00 GiB
Logical volume Lvol0 successfully resized

Step5 : Mount the file system and verify the size

[[email protected] ~]# mount /home
[[email protected] ~]# df -h /home
Filesystem                            Size       Used    Avail     Used%      Mounted on
/dev/mapper/vg01-lvol0          8G         5.0G    2.9G      70%        /data

Hope this post is helped you to know How to Reduce LVM Logical Volume size in Linux Easily.

Related Content on Linux might be useful to you to improve your Linux Skills.

Keep practicing and have fun. Leave your comments if any.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.