Ubuntu

A step-by-step guide to installing, configuring, and managing Ubuntu, covering system setup, user management, and basic administrative tasks.

Expanding a LVM on Ubuntu 22.04

Get Started

lvdisplay

This command will display the volume groups.

You should see something like this:

--- Logical volume ---
LV Path                /dev/ubuntu-vg/ubuntu-lv
LV Name                ubuntu-lv
VG Name                ubuntu-vg
LV UUID                eIxgxf-ABCD-EFGH-IJKL-MNOP-QRsT-UVWxYz
LV Write Access        read/write
LV Creation host, time ubuntu, 2023-06-27 08:00:00 +0000
LV Status              available
# open                 1
LV Size                50.00 GiB
Current LE             12800
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           253:0

You can find the volume we will be expanding by looking at the LV Path it should be something like /dev/ubuntu-vg/ubuntu-lv.

lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

This command will expand the volume to use all available space.

resize2fs /dev/ubuntu-vg/ubuntu-lv

This command will expand the filesystem to use all available space.

Finished

You now have a LVM that has been expanded to use all available space.