هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
$ مستخدم عادي# بصلاحية root (أو مع sudo)
The quick answer
Step by step
- Which file system? —
df -hshows which mount point is full. Work only inside that one:-x(du) and-xdev(find) stay on one file system, so other disks and network mounts are skipped. - Walk down (lines 1–2) — the biggest folder at each level, then go one level deeper into it. Usually 3–4 steps reach the culprit.
- Biggest single files (line 3) — logs, dumps, ISO images, forgotten backups.
- Interactive —
ncdu -x /(installncdu) lets you browse sizes with the arrow keys and delete withd. - Usual suspects:
journalctl --disk-usage
docker system df
dnf clean all
find /var/log -name '*.gz' -mtime +30 -size +10MJournal too big → journalctl --vacuum-size=500M; Docker → docker system prune (read what it removes first).
- **Space used but
dufinds nothing** — deleted files still open by a process:lsof +L1. Restart that process. - Space hidden under a mount point — files written to
/datawhile the disk was not mounted are hidden under it later. Check with a bind mount:mount --bind / /mnt && du -sh /mnt/data && umount /mnt. - Inodes full —
df -i: millions of tiny files (sessions, mail queue, cache) can fill a disk that still has free bytes. Find folders with many files:find / -xdev -type f | cut -d/ -f2-3 | sort | uniq -c | sort -n | tail.
Check that it worked
Common problems
| Problem | Cause | Fix |
|---|---|---|
du takes very long | It scans network mounts or other disks. | Use -x / -xdev; start in the full mount point. |
df and du differ a lot | Deleted open files, or files hidden under a mount point. | lsof +L1; bind-mount check. |
Disk full but many GB free in df -h | Inodes used up. | df -i; remove many small files; fix the app. |
| Space not freed after deleting a log | The writer still has the file open. | Restart/reload it; truncate instead (: > file). |
| Deleted something important | Cleaned in a hurry. | Restore from backup; read before rm, prefer moving first. |
| Root reserve on ext4 | 5 % reserved for root. | Normal; tune2fs -m 1 on pure data disks if needed. |
Go further
- Command pages: du, df, find, sort.
- Next how-tos: Check disk space and find what fills the disk, See which files a process has open, Free disk space used by Docker, Keep the journal after reboot and limit its size.
- Learn it: RHCSA — find, TLCL — Searching for files.
1Why use du -x and find -xdev?
They stay on one file system, so other disks and network mounts do not slow the search or confuse the result.
2Why can df show a full disk while du finds little?
Deleted files may still be open by a process, or files may be hidden under a mount point.