LVM online shrinking

By | October 13, 2013

Many Linux system administrators have wrong assumption that LVM does not support online shrinking. Fact is reverse of that, Linux LVM fully support online device shrink. But yes we know that when we need to shrink LVM device we unmount the subjected device. The reason to bring device in unmounted state before shrink lies in limitation of FileSytem, most of the file system does not support online shrink, yes they support online extension. I know one file system that support online shrink, btrfs(http://en.wikipedia.org/wiki/Btrfs) is that file system.

To shrink a LVM device /dev/ds/lv_test (size: 10G B)

Step1: Unmount the device
umount /dev/ds/lv_test

Step2: Perform file system check
fsck -f /dev/ds/lv_test

Step3: Resize the file system
resize2fs /dev/ds/lv_test 9G

Step4: Reduce the LVM now
lvreduce -L -1G /dev/ds/lv_test

Now mount the device and find size of filesystem using df -h command

Share itShare on FacebookEmail this to someoneTweet about this on TwitterShare on Google+Share on LinkedInPrint this page

One thought on “LVM online shrinking

Leave a Reply

Your email address will not be published. Required fields are marked *

Current month ye@r day *