This post will show you How to Reduce LVM Logical Volume size in Linux Easily.
If you are interested in learning, Request you to go through the below recommended tutorial.
DevOps Full Course Tutorial for Beginners - DevOps Free Training Online
Docker Full Course Tutorial for Beginners - Docker Free Training Online
Kubernetes Full Course Tutorial for Beginners - Kubernetes Free Training Online
Ansible Full Course Tutorial for Beginners - Ansible Free Training Online
Openstack Full Course Tutorial for Beginners - Openstack Free Training Online
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.
[root@linux ~]# 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
[root@linux ~]# umount /data
Step2 : Check the filesystem for errors using e2fsck command
[root@linux ~]# 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
[root@linux ~]# 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
[root@linux ~]# 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
[root@linux ~]# mount /home
[root@linux ~]# 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.
How to Configure IP Address on Ubuntu using Netplan
How to Access Linux Server from Windows Remotely
Configure SSH Passwordless Login Authentication (SSH-keygen)
How to Create LVM Partition in Linux – LVM Tutorial
Install & Configure Samba Server on Linux (RHEL7 / CentOS7)
How to Access Linux Server from Windows Remotely
Configure SSH Passwordless Login Authentication (SSH-keygen)
How to Create LVM Partition in Linux – LVM Tutorial
Install & Configure Samba Server on Linux (RHEL7 / CentOS7)
Keep practicing and have fun. Leave your comments if any.
Stay connected with us on social networking sites, Thank you.
0 Comments