Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
The quick answer
Step by step
- Which file system is full?
df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/rhel-root xfs 20G 19G 1.0G 95% /
/dev/sda1 xfs 960M 310M 651M 33% /boot
df -idf -i shows inodes (number of files). A disk can be "full" with free space when millions of tiny files used all inodes.
- Walk down to the big folder —
-xstays on this file system:
du -xh --max-depth=1 / | sort -h | tail
du -xh --max-depth=1 /var | sort -h | tail
du -xh --max-depth=1 /var/log | sort -h | tail(ncdu is an interactive version: dnf install ncdu from EPEL / apt install ncdu.)
- Clean the usual suspects (check before you delete):
| What | Check | Safe clean-up |
|---|---|---|
| systemd journal | journalctl --disk-usage | journalctl --vacuum-size=500M |
| Old rotated logs | ls -lh /var/log/*.gz | let logrotate handle it; delete old .gz files |
| Docker images, containers, build cache | docker system df | docker system prune (add -a for unused images) |
| Package cache | du -sh /var/cache/dnf /var/cache/apt | dnf clean all / apt-get clean |
| Old kernels (RHEL) | rpm -q kernel | dnf remove --oldinstallonly |
| Core dumps | coredumpctl list | remove old ones in /var/lib/systemd/coredump |
lsof +L1 2>/dev/null | head
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NLINK NODE NAME
java 2241 app 1w REG 253,0 8.2G 0 1310 /var/log/app/app.log (deleted)
systemctl restart appThe process still writes into the deleted file; restarting it (or truncating via /proc/PID/fd/N) frees the space.
- Fix the cause, not only the symptom: log rotation and size limits (
SystemMaxUse=in journald, Docker logmax-size), retention for backups, and a monitoring alert (for example at 85 %).
Check that it worked
df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 20G 11G 9.0G 55% /Common problems
| Problem | Cause | Fix |
|---|---|---|
df says full, du finds much less | Deleted files still open. | lsof +L1; restart that process. |
| Free space but "No space left on device" | Inodes are full. | df -i; delete many small files (caches, sessions, mail queues). |
| Root can not free space even after deleting | The deleted file is still open, or a snapshot keeps it. | lsof +L1; check LVM/VM/file-system snapshots. |
/boot is full | Too many old kernels. | dnf remove --oldinstallonly / apt autoremove. |
| The disk fills again quickly | A runaway log or a job. | Find the growing folder (du twice, 10 minutes apart); fix rotation/limits. |
| Need more space permanently | The disk is too small. | Grow the disk and the LVM volume ("Extend an LVM volume"). |
Go further
- Command pages: df, du, find, lsof, journalctl.
- Docker clean-up and log limits: Install and set up Docker Engine. Alerts before the disk is full: Node Exporter.
- Next how-tos: Find files by name, size, date or content, Free disk space used by Docker, Check memory and CPU usage, Extend an LVM volume, See which files a process has open, Find big files and folders fast.
- Learn storage for RHCSA: RHCSA — Storage, RHCSA — LVM.
1df shows 100 % but du only finds half of it. What is the most likely cause?
Deleted files still held open by a process — find them with lsof +L1 and restart the process.
2What does df -i show?
The inode use — how many files the file system can still hold.