unix

How do I resize LVM logical volumes with on my Linux server using an ext4 filesystem?

Below is the procedure for resizing LVM volumes using ext4:

1. Unmount the filesystem and check its LV
# umount /mnt/test

2. Run fsck on the appropriate filesystem
# e2fsck -f /dev/mapper/vg_-test

3. Shrink the ext4 filesystem and then the LV to the desired size.
# resize2fs -p /dev/mapper/vg0-test 25G
# lvreduce -L 25G /dev/mapper/vg0-test

4. Before continuing, run e2fsck. If it fails because the partition is too small, don’t panic as the LV can still be extended with lvextend until e2fsck succeeds.

5. Resize the filesystem to match the LVs size.
# resize2fs -p /dev/mapper/vg0-test

6. Check the filesystem and mount it.
# e2fsck -f /dev/mapper/vg0-test
# mount /mnt/test

And now you have successfully resized your test partition.

Click to comment

Leave a Reply

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

To Top