16 May 2006

Resizing an LVM2 partition with a ReiserFS file system on it

I use the following to safely resize my LVM2-partitions containing Reiser file systems. Safely means I don't need to be afraid of cutting pieces of my filesystem when shrinking the partitions. The trick is to use resize_reiserfs without argument to let it fill all of the available partition. The following assumes you want to move some space from /home to /var, which correspond to the logical volumes home and var, respectively; both in the volume group vg0. Of course it's best to do this in single user mode. If you use a filesystem that allows online resizing, you don't need to do that, I guess.

umount /home /var
resize_reiserfs -s -11G /dev/mapper/vg0-home
lvreduce -L -10G vg0/home
resize_reiserfs /dev/mapper/vg0-home
vgdisplay vg0 | grep Free
# Note number of free PEs:
# Free PE / size: 2816 / 10.00 GB
# You can also just say lvresize -L +10GB
lvresize -l +2816 vg0/var
resize_reiserfs /dev/mapper/vg0-var
mount /home
mount /var


Post a Comment

Links to this post:

Create a Link

<< Home