How to extend a partition to fit the free space in Ubuntu/Debian

  Uncategorized

Using gparted, we see that 829 GB is unused, and we’re only using 100GB of that space.

df -h shows the same, only 82 GB available, it’s a 100GB volume:

root@lr4:~# df -h /home
Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-ubuntu--lv   98G   12G   82G  13% /

To expand it to fit 100%:

# first, extend it:
root@lr4:~# sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

  Size of logical volume ubuntu-vg/ubuntu-lv changed from 100.00 GiB (25600 extents) to <929.51 GiB (237954 extents).
  Logical volume ubuntu-vg/ubuntu-lv successfully resized.

# second, resize it
root@lr4:~# sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
resize2fs 1.46.5 (30-Dec-2021)
Filesystem at /dev/ubuntu-vg/ubuntu-lv is mounted on /; on-line resizing required
old_desc_blocks = 13, new_desc_blocks = 117
The filesystem on /dev/ubuntu-vg/ubuntu-lv is now 243664896 (4k) blocks long.

There it is.