A full disk breaks things in strange ways: databases stop writing, mail queues grow, services refuse to start. Here is a reliable routine to find out what is eating the space and free it safely.
Step 1: Which filesystem is full?
df -h
Look at the Use% column. Note the mount point of the full filesystem, for example / or /var. Everything below walks down from there.
Also check inodes. A disk can be “full” because it holds millions of tiny files even when there is free space:
df -i
Step 2: Find the biggest folders
Run this from the full mount point. -x stops du from crossing into other filesystems:
sudo du -xh / --max-depth=1 2>/dev/null | sort -rh | head -10
Pick the largest folder and repeat inside it:
sudo du -xh /var --max-depth=1 2>/dev/null | sort -rh | head -10
Two or three rounds usually lead you to the culprit.
Step 3: Use ncdu for an interactive view
ncdu does the same job with a navigable interface, which is far faster when you are exploring:
# Debian / Ubuntu
sudo apt install ncdu
# AlmaLinux / Rocky / RHEL
sudo dnf install ncdu
sudo ncdu -x /
Use the arrow keys to move, Enter to open a folder and d to delete (be careful).
Step 4: Find individual huge files
sudo find / -xdev -type f -size +500M -exec ls -lh {} + 2>/dev/null
Step 5: The classic trap, deleted files that are still open
You deleted a huge log, but df still shows the disk full. A running process still holds the file open, so the space is not released until it closes. List them:
sudo lsof +L1
Restart the service that owns the file (or truncate the file instead of deleting it next time, with : > /path/to/file.log).
Common space hogs and how to clean them
| Where | Check | Clean |
|---|---|---|
| systemd journal | journalctl --disk-usage |
sudo journalctl --vacuum-size=200M |
| Package cache | du -sh /var/cache |
sudo dnf clean all or sudo apt clean |
| Docker | docker system df |
docker system prune |
| Old logs | du -sh /var/log/* |
Configure logrotate |
Prevent it from happening again
- Make sure
logrotatecovers your application logs. - Set a monitoring alert at 80% disk usage, not at 100%.
- Put
/varor your data directory on its own volume so one runaway process cannot take down the whole system.
More tutorials like this
Linux Permission Denied Error: Causes and How to Fix It (chmod, namei, id)
Fix the Linux Permission denied error: read ls -l, namei -l and id, then add only the permission letter you need with chmod. Real…
systemd Basics: Manage Services and Read Logs with systemctl and journalctl
Start, stop and enable services with systemctl, read logs with journalctl, write your own service and timer, and troubleshoot a service that will not…
Bash Scripting for Beginners: Variables, Loops, Functions and Exit Codes
Learn Bash scripting from your first script to a safe backup script: variables, quoting, loops, functions, exit codes and set -euo pipefail, with real…


