How to Increase AWS EBS Volume Size

2020/12/112 min read
bookmark this
Responsive image

Table of Contents

  1. Introduction
  2. Update the EBS Volume Size
  3. Verify and Apply the Size Change
  4. Conclusion

Introduction

This quick note shows how to increase AWS EC2 Linux's EBS volume size.

Update the EBS Volume Size

First, log in to AWS and select the target EBS. Update the size. The volume size will update right away, but you'll need to do the following steps.

Verify and Apply the Size Change

Next, SSH into the EC2 Linux instance to check the current Linux disk size.

After SSHing into the EC2, type the following command to check whether the increased volume has been applied or not.

lsblk

The following is a sample result when you type lsblk. Here we can see that the disk has a size of 16G but the current EBS partition only has 8G.

nvme1n1 30G
nvme0n1 16G
|-----nvme0n1p1 8G

Now, the following command will change the partition size to use the maximum size based on the above sample result. After you run the command, your EBS partition should be 16G now.

sudo growpart /dev/nvme0n1 1

Another command that might be useful is to check the folder size:

sudo du -sh /var/www/my-folder-size

Conclusion

Increasing an EBS volume size in AWS is straightforward. After updating the volume size in the AWS console, SSH into your EC2 instance and use growpart to expand the partition to use the new available space.