Resizing an Ubuntu LVM Host!

I spent hours trying to find instructions on how to resize my Ubuntu virtual hosts after one of my cluster workers seemingly ran out of space (randomly). After working out the basics, I was able to resize my drives correctly after assigning them the correct disk size in ProxMox.

root@server:~# fdisk -l

GPT PMBR size mismatch (104857599 != 209715199) will be corrected by write.
The backup GPT table is not on the end of the device. This problem will be corrected by write.
Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Disk model: QEMU HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 396A0315-7944-49AC-BBFF-7AD2F7747AC9

Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 2101247 2097152 1G Linux filesystem
/dev/sda3 2101248 104857566 102756319 49G Linux filesystem

Disk /dev/mapper/ubuntu–vg-ubuntu–lv: 48.102 GiB, 52609155072 bytes, 102752256 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
root@server:~# parted
GNU Parted 3.3
Using /dev/sda
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) resizepart
Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an
extra 104857600 blocks) or continue with the current setting?
Fix/Ignore? Fix
Partition number? 3
End? [53.7GB]? 100%
(parted) quit
Information: You may need to update /etc/fstab.

root@server:~# pvresize /dev/sda3
Physical volume “/dev/sda3” changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized

root@server:~# lvextend -l +100%FREE /dev/mapper/ubuntu–vg-ubuntu–lv
Size of logical volume ubuntu-vg/ubuntu-lv changed from <49.00 GiB (12543 extents) to <99.00 GiB (25343 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.

root@server:~# resize2fs /dev/mapper/ubuntu–vg-ubuntu–lv
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/mapper/ubuntu–vg-ubuntu–lv is mounted on /; on-line resizing required
old_desc_blocks = 7, new_desc_blocks = 13
The filesystem on /dev/mapper/ubuntu–vg-ubuntu–lv is now 25951232 (4k) blocks long.

root@server:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 2.9G 0 2.9G 0% /dev
tmpfs 595M 1.2M 594M 1% /run
/dev/mapper/ubuntu–vg-ubuntu–lv 98G 32G 62G 34% /
tmpfs 3.0G 0 3.0G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.0G 0 3.0G 0% /sys/fs/cgroup
/dev/sda2 976M 198M 712M 22% /boot
/dev/loop1 56M 56M 0 100% /snap/core18/1932
/dev/loop2 72M 72M 0 100% /snap/lxd/16099
/dev/loop0 56M 56M 0 100% /snap/core18/1944
/dev/loop3 68M 68M 0 100% /snap/lxd/18150
/dev/loop4 32M 32M 0 100% /snap/snapd/10492
/dev/loop5 32M 32M 0 100% /snap/snapd/10707
tmpfs 595M 0 595M 0% /run/user/1000