How do I make Ubuntu's resize2fs command work after increasing Droplet size?

September 20, 2016 2.4k views
Storage Ubuntu

Earlier today I increased the drive space on my Ubuntu droplet from 30GB to 40GB. After restarting, the drive size has increased:

> fdisk -l
Disk /dev/vda: 40 GiB, 42949672960 bytes, 83886080 sectors

But naturally the filesystem itself is still 30GB:

> df -h
/dev/vda1        30G   16G   13G  55% /
> fdisk -l
/dev/vda1  *     2048 62910539 62908492  30G 83 Linux

The problem is that the resize2fs command doesn't behave as expected.

> sudo resize2fs /dev/vda1
resize2fs 1.42.12 (29-Aug-2014)
The filesystem is already 7863561 (4k) blocks long.  Nothing to do!

Have I missed a step here? As I understand it, I should be able to increase the size of the root filesystem without unmounting it. Is there something I need to do to the partition table to tell resize2fs that the additional 10GiB is there for the taking?

Any suggestions would be much appreciated!

1 Answer

Hi TokyoRob,

First unmount the /dev/vda1 using below command.

sudo umount /dev/vda1

Now run the sudo resize2fs /dev/vda1

Hope it will help...

  • Thank you for your quick reply!

    Since this is the root filesystem (mapped to /), it's not possible to unmount it.

    The man page for resize2fs says that unmounting is not required to increase file system size:

    If the filesystem is mounted, it can be used to expand the size of the mounted filesystem...

    I have a feeling that the missing step in the tutorials on DigitalOcean and elsewhere is an fdisk operation to increase the partition size, but I can't find confirmation of this anywhere.

Have another answer? Share your knowledge.