Fix Disk Full Error Linux Server (Complete Guide for Beginners & Sysadmins)

One of the most frustrating issues on a Linux server is the dreaded “Disk Full” error. It can break websites, stop services, crash databases, and even lock you out of your own system.

If you’re running WordPress, Docker, or hosting multiple websites, this problem becomes even more common.

In this guide, you’ll learn:

  • What causes disk full errors
  • How to quickly identify the issue
  • Step-by-step fixes (safe and advanced)
  • Preventive strategies to avoid future downtime

What is the Disk Full Error?

The disk full error occurs when your server runs out of available storage space or inodes.

Common error messages:

  • No space left on device
  • Disk quota exceeded
  • write failed: No space left

Even if your disk looks empty, the problem might be hidden elsewhere.


Step 1: Check Disk Usage (Very Important)

Start with this command:

df -h

This shows:

  • Total disk space
  • Used space
  • Available space

Look for partitions that are 100% full.

Check Inodes (Often Missed)

df -i

If inode usage is 100%, your disk is effectively full even if space exists.


Step 2: Find Large Files

To locate large files:

du -ah / | sort -rh | head -20

Or focus on specific directories:

du -sh /var/*

Most common culprits:

  • Logs
  • Backups
  • Cache files
  • Docker images

Step 3: Clear Log Files

Log files grow silently and can consume huge space.

Safe cleanup:

truncate -s 0 /var/log/*.log

Or delete old logs:

rm -f /var/log/*.gz

If using journald:

journalctl --vacuum-time=7d

Step 4: Clean Package Cache

Ubuntu/Debian:

apt-get clean
apt-get autoremove -y

CentOS/AlmaLinux:

yum clean all

Step 5: Fix Docker Disk Usage (Very Common Issue)

If you're using Docker:

Check usage:

docker system df

Clean unused data:

docker system prune -a

⚠️ Warning: This removes unused containers/images.


Step 6: Delete Old Backups

Backup folders often fill disks quickly.

Check:

du -sh /backup

Delete old files:

find /backup -type f -mtime +7 -delete

Step 7: Check Deleted but Still Open Files

Sometimes files are deleted but still in use.

Run:

lsof | grep deleted

Restart the service holding the file:

systemctl restart nginx

Step 8: Check Hidden Space in /tmp

rm -rf /tmp/*

Also check:

rm -rf /var/tmp/*

Step 9: Resize Disk (If Needed)

If your disk is genuinely full, upgrade your server.

👉 Recommended hosting:

  • Cloudways (Best for managed cloud)
  • Bluehost (Budget-friendly)

🚀 Deploy Scalable Cloud Hosting

If you're tired of disk issues, move to managed cloud hosting:

👉 Cloudways (High Performance Cloud Hosting)

Load WordPress Sites in as fast as 37ms!

👉 Bluehost (Affordable Starter Hosting)


Step 10: Set Up Monitoring

Avoid future issues by monitoring disk usage.

Install:

apt install ncdu

Run:

ncdu /

Prevent Disk Full Errors (Best Practices)

1. Log Rotation

Enable log rotation:

nano /etc/logrotate.conf

2. Automate Cleanup

Add cron job:

crontab -e

Example:

0 2 * * * apt-get clean

3. Use Cloud Storage

Offload backups to:

  • AWS S3
  • Google Cloud Storage

4. Monitor Alerts

Use tools:

  • Netdata
  • Prometheus
  • Cloud monitoring

Bonus: Fix Disk Full Error in cPanel

Run:

/scripts/fixquotas

Also check:

repquota -a

Real-World Scenario

A WordPress server suddenly crashes.

Cause:

  • /var/log/mysql.log grew to 20GB

Fix:

  • Truncated log file
  • Enabled log rotation

Downtime: Reduced from hours to minutes.


When to Upgrade Hosting

Upgrade if:

  • Disk usage exceeds 80% regularly
  • Multiple sites hosted
  • Using Docker or heavy apps

👉 Best upgrade options:

The Ultimate Managed Hosting Platform

Conclusion

The Linux disk full error is common but easy to fix once you understand where to look.

Key takeaways:

  • Always check disk and inode usage
  • Clean logs and cache regularly
  • Monitor your server proactively
  • Upgrade when needed

If you're running production workloads, investing in reliable hosting like Cloudways or Bluehost can save hours of troubleshooting.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *