Increase AWS EC2 Root Volume

Abhilash Indulkar
3 min readJun 15, 2020

So, People might have come across the situation where they were just outta disk memory. They wanted more EBS Volume.

There is an alternative to this, We can create an AMI from the EC2 and Launch through MyAMI, where we would be able to configure the Root Volume according to our need. But this is not we wanted right now.

For better understanding, I have launched the EC2 Instance with minimal config i.e 1GB RAM 8GB of disk storage.

After going through all the steps of creating an instance, here it something looks like

We know that we had provisioned 8GB Storage to the our instance. Traverse to EBS Volume section on the left pane.

Select the attached instance’s volume and click on Actions followed by Modify Volume

Dialog box would appear prompting for these details. Here, I have updated the size from 8GB to 15GB and clicked on modify.

It will take some time to take effect.

Now, SSH into the instance through private key/putty/ec2-instance connect(Amazon Linux2)

  1. Switch into root user.

sudo -i

2. Run the below command to list the information about specified block devices.

lsblk

We can see that xvda1 is 8GB whereas xvda is 15GB.

3. In order to extend the partitioned disk, we have to run the command as

growpart /dev/xvda 1

List all the block devices again by running lsblk

Here we can see the block device size has become 15GB.

4. But, when we see for disk free, it still shows 8GB.

df -h

Here, we can see /dev/xvda1 is around 8GB.

5. We need to resize the disk space to the block device. Command is

resize2fs /dev/xvda1 For Ubuntu/Debian

xfs_growfs / For RHEL/CENTOS

6. The final step, verify the disk free. It says from the below image that we are able to increase the volume successfully. Disk available is 14GB.

df -h

Happy Learning.

--

--