Expanding disk on Ubuntu 20.04

on

Not using Ubuntu often, I found recently that the way of expanding disks has changed or I forgot how it was.

After adding storage to your disk, I had to reboot my VM. Open the terminal as root:

cfdisk

This will list the partitions:

Highlighted, the partition we want to expand.

Hit right and select Resize.

Accept the new disk value.  Then select Write, and accept the changes.

Type fdisk to check if the disk has its new size:

Execute parted

Resize the partition:

pvresize /dev/sda3

Extend the partition:

lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv

Resize to finish the expansion:

resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

Now, doing a df -h will show the new extra space:

 

 

Was this helpful?

Leave a Reply

Your email address will not be published.