1

I have an Ubuntu (v20.04) VM in VMWare. I increased (2x from 20G to 40G) the hard disk size. How do I add that space to the file system?

From lsblk, I have the following: sda is 40G type disk which is correct (2x previous)

NAME                          SIZE  TYPE
sda                           40G   disk
sda1                          1M    part
sda2                          1G    part  /boot
sda3                          19G   part
   |   
   L -ubuntu--vg-ubuntu--lv    19G   lvm  /

Then I try to do sudo resize2fs /dev/sda3 and I get

Device or resource busy while trying to open /dev/sda3
Couldn't find filesystem superblock.

I was trying to follow some of the techniques in the question Resize dev/sda2 Ubuntu VMWare But I get to step 7 and do the resize and get this error.

Is there a better way to go about this or is more simply is there a way to get the extra space into my filesystem.

(I would love to use gparted but I can't seem to make room for it to install - if I figure out a working way to add the extra space, that will be one of the first utilities I'll add!)

1 Answer 1

7

You can't resize an extN filesystem on /dev/sda3 because it's not a filesystem partition. If you look at the lsblk output it's marked as a partition containing an LV, which means it's a partition containing Logical Volumes. The LV is what you want to resize, but you first need to resize the partition.

If any commands fail, or return unexpected output, STOP RIGHT THERE.

Resize the partition:

parted /dev/sda print                # Check you have exactly three partitions
parted /dev/sda resizepart 3 100%    # Extend the third
parted /dev/sda print                # Confirm the new partition size

Resize the PV (Physical Volume) that contains the Volume Group ("ubuntu-vg") containing Logical Volumes:

pvresize /dev/sda3
  Physical volume "/dev/sda3" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized

Now you can extend the LV ("ubuntu-lv"), adding 10GB to its size (for now):

lvextend --size +10g --resizefs /dev/ubuntu-vg/ubuntu-lv

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.