Resizing Ubuntu's main partition

For some reason ubuntu, by default, does not use the entire disk anymore. This is annoying when you install it on a VM with low diskspace.

neurotechnics.com has a great blog post about this topic. Here is the very short version:

1. Check the size of the current volume:
df -hT /dev/mapper/ubuntu--vg-ubuntu--lv

2. Check that a resize is possible (-t parameter):
sudo lvresize -tvl +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv

3. Resize:
sudo lvresize -vl +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv

4. Resize the filesystem:
sudo resize2fs -p /dev/mapper/ubuntu--vg-ubuntu--lv

5. Check the size of the volume:
df -hT /dev/mapper/ubuntu--vg-ubuntu--lv

Back to the overview