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: … untu-18-04 … -with-lvm/

FIX GPT PMBR Size Mismatch

sudo parted -l

create partition

sudo fdisk /dev/xvda



after reboot

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