Shrink an LVM partition

Gentoo’s Documentation says it is easier to increase the size of an LVM partition than to shrink it, so they recommend starting with smaller partitions and then increase them as needed.

Of course they are not saying shrinking is impossible, but only less easy. The most important thing is the FS must be reduced BEFORE the volume, or the FS will get damaged.

Example: Shrink partiton /dev/vg/home with ext3 filesystem from 30G to 12G:
e2fsck /dev/vg/home (resize2fs requires a check before resizing)
resize2fs /dev/vg/home 10G
(resize FS to 10G)
lvreduce -L12G /dev/vg/home
(reduce partition)
resize2fs /dev/vg/home (extend FS to the whole partition)

Someone (I’m not sure who..) recommended doing two resizes like this claiming it is safer.

No comments:

Post a Comment