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, open the terminal as root:

 

This will rescan the disk

echo 1 > /sys/block/sda/device/rescan

(note sda as main disk)

 

cfdisk

 If cfdisk doesn’t show the new added storage, use this guide.

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 -l

 

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:

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *