How to Safely Increase EC2 Volume Size in Real-Time Without Downtime

As your application grows, so does the need for storage. On AWS EC2 instances, running out of disk space can lead to app crashes, failed deployments, or a frozen system. But the good news? You can increase an EC2 volume in real-time without stopping the instance.

In this article, I’ll walk you through a real-world example, breaking it down into simple, actionable steps you can apply right away.


📸 The Scenario

Let’s say you SSH into your EC2 instance and run:

df -h

And you see something like this:

Filesystem      Size  Used Avail Use% Mounted on
/dev/root       6.8G  6.1G  682M  91% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
/dev/xvda16    881M   76M  744M  10% /boot
/dev/xvda15    105M  6.1M   99M   6% /boot/efi

/dev/root → This is your main Linux root filesystem.

⚠️ Problem: You’re at 91% usage — dangerously low on space.

If you don’t fix this, you may face:

  • Failed deployments

  • Database crashes

  • Frozen processes

  • Unreachable servers


⚙️ Step 1: Check which volume to resize

Log in to the AWS Console → EC2 → Volumes.

Find the volume attached to your EC2 instance. You’ll probably see it’s around 7–8 GB.


🚀 Step 2: Increase the volume size in AWS

  • Select the volume → Actions → Modify volume.

  • Change the size from, say, 7 GB → 20 GB.

  • Confirm and apply.

AWS will handle the resize behind the scenes. This usually takes a few seconds to a couple of minutes.

✅ Good news: Your EC2 instance keeps running — no downtime.


🖥️ Step 3: Verify the new disk size on EC2

SSH into your EC2 instance and run:

lsblk

You should now see the increased size at the block device level (e.g., /dev/xvda or /dev/root showing 20 GB).


🔧 Step 4: Expand the Linux filesystem

The Linux filesystem still thinks it’s using the old 7 GB. You need to tell it to use the full 20 GB.

First, check which filesystem you have:

df -T /

If you see:

  • ext4 → use resize2fs

  • xfs → use xfs_growfs

Run the right command:

For ext4:

sudo resize2fs /dev/root

For xfs:

sudo xfs_growfs /

✅ Step 5: Verify everything

df -h

Expected result:

Filesystem      Size  Used Avail Use% Mounted on
/dev/root       20G   6.1G  14G  31% /

🎉 Congratulations! Your disk space is expanded, and your server stays online.


💡 Bonus Tips

  • Always take an EBS snapshot before resizing, just in case.

  • Monitor disk space proactively using CloudWatch alarms.

  • Clean up old logs and temp files regularly to reduce unnecessary space usage.


📦 Final Takeaway

Increasing an EC2 volume is:
✅ Safe
✅ Zero downtime
✅ Easy to do with the right steps

The key part people miss? Expanding the Linux filesystem after resizing in AWS. Don’t skip that step!


0
Subscribe to my newsletter

Read articles from Srishti Srivastava directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Srishti Srivastava
Srishti Srivastava