Resize LVM partition

Assume we have 2 partitions: /dev/fedora/root and /dev/fedora/home, want to reduce the size of root and give it for home.

Boot to live boot USB.

Ensure that partitions are not mounted.

Check if partitions are clean

$ sudo e2fsck /dev/fedora/root
$ sudo e2fsck /dev/fedora/home

Reduce file system size in root partition

$ sudo resize2fs /dev/fedora/root <desired size>

# Example
$ sudo resize2fs /dev/fedora/root 30G

Reduce size of logical volume /dev/fedora/root (this must be larger or equal than the file system size)

$ sudo lvreduce -L <desired size> /dev/fedora/root

# Example
$ sudo lvreduce -L 30G /dev/fedora/root

Check /dev/fedora/root again to ensure that it’s ok

$ sudo e2fsck /dev/fedora/root

If root partition is clean, then extend the home partition

$ sudo lvextend -l +100%FREE /dev/fedora/home

Resize home file system

$ sudo e2fsck -f /dev/fedora/home
$ sudo resize2fs /dev/fedora/home

Try mounting root and home to check their size and data. If everything’s ok, reboot.

comments powered by Disqus