Skip to main content
📝 Cloud & DevOps (AWS)

Fix CentOS Disk Space Issues Instantly by Expanding AWS EBS Volume (Live Case Study)

Fix CentOS disk space issues instantly by expanding your AWS EBS volume. Live case study with exact commands — zero downtime, no data loss.

6 min

Read time

1,045

Words

Jul 03, 2025

Published

Engr Mejba Ahmed

Written by

Engr Mejba Ahmed

Share Article

Fix CentOS Disk Space Issues Instantly by Expanding AWS EBS Volume (Live Case Study)

CentOS Disk Full Expand EBS: The Instant Fix

Running out of disk space on a CentOS server hosted on AWS can crash your services, slow down performance, and trigger security risks. In this guide, we’ll show you how we fixed a critical CentOS server disk issue by expanding the attached EBS volume—without any downtime.

Whether you're running blogs, APIs, newsletters, or any Linux-powered service, this post is for you. Let’s dive in with real steps and commands.

🔐 Step 1: Connect to Your CentOS Server via SSH

First, you need to SSH into your CentOS server hosted on AWS.

Requirements:

  • .pem key file (downloaded when you launched the instance)
  • Public IP or DNS of your EC2 instance
  • Default CentOS username: centos

Example Command:

ssh -i "your-key.pem" [email protected]

Make sure your .pem file has the right permissions:

chmod 400 your-key.pem

📊 Step 2: Check Current Disk Usage

Once logged in, run:

df -h

You’ll see something like this:

Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p1   50G   48G  1.2G  97% /

If your usage is over 85–90%, your server is at high risk of crashing.

🔍 Step 3: Identify What’s Taking Up Space

To explore top-level disk usage:

sudo du -sh /* 2>/dev/null | sort -hr | head -n 10

Check inside /var, which usually holds logs, databases, and cache:

sudo du -sh /var/* | sort -hr | head -n 10

Tip: If /var/lib/mysql is huge, be careful — that’s your database.

📈 Step 4: Resize the EBS Volume from AWS Console

Go to your EC2 instance on the AWS Management Console:

  1. Click Volumes under Elastic Block Store
  2. Find the volume attached to your instance (e.g., vol-0a1b2c3d4e5f6g7h8)
  3. Click Actions > Modify Volume
  4. Change size from 50 GiB to 70 GiB
  5. Click Modify and confirm

✅ No reboot or downtime required. Wait until the volume state says "available".

🖥️ Step 5: Log Back In and Resize the Partition

Run the following command to confirm your disk now shows 70G:

lsblk

Expected output:

NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
nvme0n1       259:0    0   70G  0 disk
└─nvme0n1p1   259:1    0   50G  0 part /

Notice the partition is still 50G. We’ll expand it now.

Run:

sudo growpart /dev/nvme0n1 1

Then resize the XFS filesystem:

sudo xfs_growfs -d /

✅ Step 6: Verify the New Size

df -h

Now you should see:

Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p1   70G   48G   22G  69% /

🎉 Your CentOS server now has more room and better performance.

To avoid this in future:

Install UptimeRobot or Similar:

Monitor Disk Space via CLI:

Add this to your crontab:

*/30 * * * * df -h | mail -s "Disk usage alert" [email protected]

Or use CloudWatch metrics in AWS for full automation.

Final Thoughts

Expanding your EBS volume is the safest, most scalable way to fix disk space issues on a live CentOS server—without disrupting service.

This guide works for:

  • EC2 Linux instances (CentOS, Amazon Linux, Ubuntu)
  • LAMP/LEMP servers
  • Blog platforms (WordPress, Ghost)
  • Custom apps with growing data

By following these steps, we resolved caching problems, server restarts, and SEO-affecting downtime — all in less than 15 minutes.

Got stuck at any step? Drop a comment or reach out. We’re here to help.

Why This Works With Zero Downtime

The reason this fix feels like magic is that every layer involved was built to grow live. EBS volumes resize under load, the partition table updates with growpart while the filesystem is mounted, and both XFS and ext4 expand online. Nothing needs unmounting and nothing restarts — the kernel simply sees more blocks and the filesystem claims them. Understanding that chain matters because it tells you what this procedure can't do: it grows, never shrinks, and it can't fix a disk that's full because something is actively writing garbage. Check du for runaway logs before assuming you need more gigabytes, or you'll be back here next month.

The Checks Before and After

Before touching anything, snapshot the volume — the modify operation is safe in practice, but a sixty-second snapshot converts "safe in practice" into "safe, period." After expanding, confirm three things: df -h shows the new size, the application writes successfully, and the volume state in the console has returned from optimizing to in-use. The optimizing phase can run for hours on large volumes; performance is slightly reduced during it, which is worth knowing so you don't misread it as a new problem. Keep the snapshot until the first successful backup after the change, then let your retention policy reclaim it.

Sizing So You Stop Doing This

Each expansion is quick, but doing them reactively means each one arrives as an emergency. Size volumes for eighteen months of growth, alarm at eighty percent through CloudWatch, and automate log rotation so growth is data, not detritus. EBS pricing makes modest overprovisioning cheap insurance — the difference between thirty and fifty gigabytes is pocket change against one outage caused by a full disk. The best version of this procedure is the one you schedule calmly for Tuesday morning because an alarm emailed you three weeks of warning.

What This Costs

The arithmetic favors action: expanding thirty to fifty gigabytes of gp3 adds roughly a dollar and change per month, while the outage it prevents costs an evening plus whatever your downtime is worth. Storage is the cheapest insurance in the AWS catalog — buy headroom, set the alarm, and spend your worry budget on something that deserves it.

The Command You'll Forget

Bookmark this one line, because you'll need it in a year and forget it exists: sudo growpart /dev/xvda 1 && sudo xfs_growfs -d / — partition first, filesystem second, done live. Sixty seconds from console resize to usable space.

Done in Five Minutes, Remembered for Years

That's the whole procedure — snapshot, resize in console, grow the partition, grow the filesystem, verify. No downtime, no detachment, no drama. File it next to your other five-minute superpowers.

Growing Disks Before They Scream

The CentOS disk full expand EBS procedure works live, but the better version happens a month earlier — a disk alarm at eighty percent turns an outage into a calendar item. My the WordPress disk rescue and (this fix) go deeper.

If you want your servers monitored before they fill, that's something I do through Ramlit.

Advertisement
Coffee cup

Enjoyed this article?

Your support helps me create more in-depth technical content, open-source tools, and free resources for the developer community.

Related Topics

Engr Mejba Ahmed

About the Author

Engr Mejba Ahmed

Engr. Mejba Ahmed builds AI-powered applications and secure cloud systems for businesses worldwide. With 10+ years shipping production software in Laravel, Python, and AWS, he's helped companies automate workflows, reduce infrastructure costs, and scale without security headaches. He writes about practical AI integration, cloud architecture, and developer productivity.

Discussion

Comments

0

No comments yet

Be the first to share your thoughts

Leave a Comment

Your email won't be published

11  -  8  =  ?

Continue Learning

Related Articles

Browse All

Comments

Leave a Comment

Comments are moderated before appearing.

Learning Resources

Expand Your Knowledge

Accelerate your growth with structured courses, verified certificates, interactive flashcards, and production-ready AI agent skills.

Sample Certificate of Completion

Sample certificate — complete any course to earn yours

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support