Pawan Sharma | May 16, 2012 | Be the first to comment!

Reducing Size of Logical Volume

In this post we will learn how to reduce size of a Logical Volume. It is not suggested to reduce a Logical Volume, as it may lead to data loss, but sometimes it is required to reduce a LV. If there is Logical Volume which is not using all the space an you have to take some space from it and give it to other mount point, in such situation we require to reduce a LV.

In this example we will reduce Logical Volume lvdata1 from 1Gb to 300Mb.

1. To reduce a Logical Volume first we have to unmount the LV using umount command.
2. Then run command e2fsck to verify the file system. This command will run a file system check on the Logical Volume:
e2fsck -f <full_path_of_Logical_Volume>
Reducing Logical Volume.
3. Then run command resize2fs to resize the file system to 300Mb.
resize2fs /dev/DATAVG/lvdata1 300M.
 
Then reduce LV using lvreduce command:
lvreduce –L 300M /dev/DATAVG/lvdata1.
Reducing Mount Point Size in RHEL

After resizing mount point, mount the mount point using mount -a command.

Be very careful when reducing the Logical Volume as it may cause data loss. In the next post we will see how to remove LV, VG and PV.
If you have any questions please feel free to comment.





No comments:

Post a Comment