Extend default LVM Volume

After the disk has been extended, then rescan for changes.

This guide is based on the SDA disk and the 3 partition. Change the device and partition to match your needs

Rescan for changes in the sda disk

echo 1 | sudo tee /sys/class/block/sda/device/rescan

Extend the partition and disk

  • Extend the partition with all free space placed after it self.
  • Extend the physical volume to its max
  • Extend the logical volume group to its max
  • Resize the filesystem
  • list the result with a df

EXT4

sudo growpart /dev/sda 3
sudo pvresize /dev/sda3
sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
sudo df -h | grep /dev/mapper/ubuntu--vg-ubuntu--lv

XFS

sudo growpart /dev/sda 3
sudo pvresize /dev/sda3
sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
sudo xfs_growfs /data/sda3
sudo df -h | grep /dev/mapper/ubuntu--vg-ubuntu--lv