Resizing LVM

resize the logical volumes using LVM

To allocate more space to your root partition (/dev/mapper/cobanov--casa--vg-root) at the expense of the home partition (/dev/mapper/cobanov--casa--vg-home).

Need to resize the logical volumes using LVM (Logical Volume Manager).

  1. Backup Your Data: Before making any changes to disk partitions, it's essential to back up important data. This reduces the risk of data loss.

  2. Check Filesystem Health: Ensure that the filesystems on the logical volumes are healthy by running a filesystem check. You can do this with:

    sudo fsck -f /dev/mapper/cobanov--casa--vg-root
    sudo fsck -f /dev/mapper/cobanov--casa--vg-home

Resizing the Logical Volumes

  1. Reduce the Home Logical Volume: First, unmount the home partition (if it's mounted):

    sudo umount /home

    Then, resize the filesystem on the home logical volume to a smaller size, ensuring there is enough space freed for the root logical volume. Suppose you want to free up 10 GiB for the root partition:

    sudo resize2fs /dev/mapper/cobanov--casa--vg-home 914G

    Next, reduce the size of the logical volume:

    sudo lvreduce -L -10G /dev/mapper/cobanov--casa--vg-home
  2. Extend the Root Logical Volume: Now, extend the root logical volume with the newly freed space (10 GiB in this example):

    sudo lvextend -L +10G /dev/mapper/cobanov--casa--vg-root

    Then, resize the filesystem on the root logical volume to use the additional space:

    sudo resize2fs /dev/mapper/cobanov--casa--vg-root
  3. Verify the Changes: Check the new sizes of your logical volumes by running:

    sudo lvdisplay

    This will show the updated sizes of your logical volumes.

  4. Remount and Check: Remount any volumes you had to unmount:

    sudo mount /home

Last updated