Fix Linux that runs out of disk
We'll find large files with du, clear logs and temp, remove old packages, and check inodes—or tell you when to escalate.
What you'll need
- SSH or console access with sudo
Step-by-step diagnostic
Quick triage — pick your path
Get started
Choose the option that matches what you see. You can jump straight to that section.
Show full guide
Steps
Goal: Find what uses space, clear logs and cache, and free disk space.
- Run
df -hto confirm which filesystem is full. Rundf -ito check inodes. - Good: You know which mount is full. Proceed to Find large dirs.
- Bad: If inodes are full, see fix-linux-server-has-full-inode.
Find large dirs
Goal: Identify what is using space.
- Run
du -sh /* 2>/dev/null. Drill into large dirs. Often /var/log, /var/cache, /tmp. - Good: Large dirs identified. Proceed to Clear logs and cache.
- Bad: Run du on specific mounts.
Clear logs and cache
Goal: Free space from logs and package cache.
journalctl --vacuum-size=100M. Truncate large logs.apt cleanordnf clean all.apt autoremoveordnf autoremove.- Good: Space freed. You are done.
- Bad: Clear /tmp and find large files.
When to escalate
Escalate if:
- You cannot safely free space.
- The full partition is critical (e.g. root).
- You need to expand the filesystem or add storage.
Provide df -h, df -i, and du output.
Verification
df -hshows increased free space on the affected filesystem.df -ishows inodes available if that was the issue.- Applications and services run without “disk full” errors.
Escalation ladder
Work from the device outward. Stop when the problem is fixed.
- Find large dirs Run du to identify what uses space.
- Clear logs and journal journalctl --vacuum-size; truncate large logs.
- Package cache and autoremove apt clean / dnf clean; apt autoremove / dnf autoremove.
- Temp and large files Clear /tmp; find and remove or archive large files.
- Escalate Provide df -h, df -i, du output; consider expand or add storage.
What to capture if you need help
Before calling support or posting for help, have these ready. It speeds everything up.
- df -h output
- df -i output
- du output for large dirs
- Steps already tried
Which filesystem is full?
Run df -h and df -i to identify the full mount.
Run `df -h` and `df -i`. Space full: find large dirs with du. Inodes full: see fix-linux-server-has-full-inode. Both OK but writes fail: check permissions.
You can change your answer later.
Inodes full
See fix-linux-server-has-full-inode for inode exhaustion. Run `df -i` to confirm.
Find large directories
Run `du -sh /* 2>/dev/null`. Drill into large dirs (often /var/log, /var/cache, /tmp). Clear logs (journalctl --vacuum-size=100M, truncate logs), run apt/dnf clean and autoremove, clear /tmp.
You can change your answer later.
Done
Disk has free space. Monitor with df -h.
Archive or escalate
Find large files: `find / -type f -size +100M 2>/dev/null`. Archive or remove. If critical partition or cannot free safely, escalate with df -h, df -i, du output.
Reviewed by Blackbox Atlas
Frequently asked questions
- Why does a Linux disk fill up?
- Logs, temp files, package cache, large application data, or many small files (inode exhaustion). Check du output and logs first.
- Can I fix a full disk myself?
- Yes. Find large dirs with du, clear logs and temp, run autoremove. If inodes are full, find directories with many small files and clean or archive.
- When should I escalate a full disk?
- If you cannot identify what is using space, the disk is a critical system partition and cleanup is risky, or you need to expand the filesystem.
Rate this guide
Was this helpful?
Thanks for your feedback.