Ubuntu Disk Expansion Steps
How to expand disks from the command line in Ubuntu.
This is something I do fairly frequently, and I can never remember the steps. So I decided to write them down.
Table of Contents
1. Rescan for disk size changes
echo 1 | sudo tee /sys/class/block/sda/device/rescan
2. Extend the physical partition (if needed)
sudo growpart /dev/sda 3
3. Resize the physical volume
sudo pvresize /dev/sda3
4. Extend the logical volume to use all available space
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
5. Resize the filesystem
sudo resize2fs /dev/mapper/ubuntu–vg-ubuntu–lv
6. Verify the new size
df -h