Resize root filesystem on Ubuntu 18.04 with LVM

Ubuntu 18.04 default lvm layout comes with only a 4 GB root partition. Here we will extend it to occupy the full free space in the volume group:

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

Sources:

https://www.digitalocean.com/community/ … untu-18-04
https://techienotes.blog/2018/12/24/res … -with-lvm/

FIX GPT PMBR Size Mismatch

sudo parted -l

create partition

sudo fdisk /dev/xvda

n,p,w,p

reboot

after reboot

pvcreate /dev/xvda4
vgdisplay
vgextend ubuntu-vg /dev/xvda4
sudo lvextend -L+14G /dev/ubuntu-vg/ubuntu-lv
resize2fs /dev/ubuntu-vg/ubuntu-lv
df -h