Expand Logical volume in Linux LVM
LVM makes it easy to resize volumes in Linux. This can be done without unmounting drives or requiring a restart.
First determine the free space of the group volume.
vgdisplay
Determine the path to the volume group and extend it using vgextend ubuntu-vg /dev/sda3
where ubuntu-vg
is the group name and /dev/sda3
is a partition created using fdisk
.
lvdisplay
Expand the logical volume into the group volume. You can specify a size (M for Megabytes, G for Gigabytes, T for Terabytes) …
lvextend -L+19G /dev/ubuntu-vg/ubuntu-lv
or you can expand the logical volume into the remaining free space.
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
You will get a success message similar to the screenshot below after the task is completed.
Resize the partition to use the newly expanded logical volume
resize2fs /dev/ubuntu-vg/ubuntu-lv