Can I resize a mounted LV?

Yes, you can resize a mounted Logical Volume (LV), but there are some considerations depending on whether you are increasing or decreasing its size:

  1. Increasing the size of a mounted LV:

    • You can safely increase the size of a mounted LV. After resizing the LV, you will also need to resize the filesystem on it.

    Example:

    lvresize -L +10G /dev/vg_name/lv_name
    resize2fs /dev/vg_name/lv_name  # For ext4
    
  2. Decreasing the size of a mounted LV:

    • You should unmount the filesystem before decreasing the size of the LV to avoid data corruption. If you cannot unmount it, you can use the resize2fs command to shrink the filesystem first, then resize the LV.

    Example:

    umount /dev/vg_name/lv_name
    lvresize -L -10G /dev/vg_name/lv_name
    resize2fs /dev/vg_name/lv_name  # For ext4
    

Always ensure you have backups before performing these operations, especially when decreasing the size.

0 Comments

no data
Be the first to share your comment!