One minute
Ubuntu LVM Extend
Default Ubuntu 22 Disk Extension
I recently wanted to grow my MicroK8s nodes disks. The default install uses LVM which makes this so much harder.
The Adventure
When I added to the disks via Proxmox using the increment disk feature, I thought this would be the usual cakewalk.
The disk grew as expected using cfdisk.
Now lets just resize the filesystem, easy right!? Wrong.
Them I remembered, I think Ubuntu may default to LVM. Let’s verify that using lvdisplay.
Awesome, I love playing LVM system admin, I love spending an hour looking at man pages to use a syntax that doesn’t match any other conventions of any other systems I’ve used.
The Answer
Here is the distilled solution* to grow your lvm after resizing online with cfdisk for the googlers who found this.
pvresize /dev/vda3
lvresize -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
resize2fs /dev/ubuntu-vg/ubuntu-lv
*This only works when the data partition aligns at the end of the disk so it can expand, but this happens in the default install.