Follow this reference

I recently expanded my disk space and jumped around multiple places to consolidate those instructions. Hopefully, this is helpful to those looking to do so.

Take a look at your disk usage

df -H

This will show you the disk space available to you

In my case, the /dev/mapper/ubuntu--vg-ubuntu--lv was at 100% use. That was what I had to expand

Check for the list of available hard disks

sudo fdisk -l

This will typically render something like this

List of available disks

In my case, sdb was the newest disk added

Inventory the volume group and logical volume you want to extend

sudo vgdisplay
sudo lvdisplay

In my case, my volume group was called ubuntu-vg, and my logical volume was called ubuntu-lv with a path of /dev/ubuntu-vg/ubuntu-lv

If you built your server with Ubuntu through the wizard, this would be the normal setup for it

Create Physical Volume (PV) on the New Disk

sudo pvcreate /dev/sdb

This will create the physical volume in LVM

Add the New Physical Volume to the Existing Volume Group

sudo vgextend ubuntu-vg /dev/sdb

Extend the logical volume group

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

In this case, I wanted to add all the free disk space available to the logical volume. Alternatively, you could also specify the size you want to add. For instance, you could have done +10G to add 10 GB of space.

Resize the filesystem

Last but not least, you'll want to resize the actual filesystem.

sudo resize2fs -p /dev/mapper/ubuntu--vg-ubuntu--lv

If you check your file system, you should see that the space is finally expanded

Expanding your disk space leveraging LVM