2
votes

I have been following tutorials from here and here to resize ec2 instance root partition size.

The tutorials said to resize the root partition by running command resize2fs after new attached volume instance started in order to claim the free size, but i can see the resized root partition without running resize2fs.

Before resizing

Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      7.9G  876M  6.7G  12% /
udev            819M  8.0K  819M   1% /dev
tmpfs           331M  164K  331M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            827M     0  827M   0% /run/shm

After resizing but without running resize2fs

Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      148G  888M  140G   1% /
udev            819M  8.0K  819M   1% /dev
tmpfs           331M  164K  331M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            827M     0  827M   0% /run/shm

So, is this step done automatically, or I am missing something here?

Thanks,

2
See the solution I posted, it can help you. stackoverflow.com/questions/30399068/…frekele

2 Answers

2
votes

This depends on the distribution you are running. If you are using the most recent Ubuntu images, this is done automatically on restart.

1
votes

I was using linux AMI and I created the size as 20GB when creating the instance. I run command below and it updated the size without restarting.

sudo resize2fs /dev/xvda1

After command invoked...

Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       20G  1.1G   19G   6% /
tmpfs           829M     0  829M   0% /dev/shm