$ run as a normal user# run as root (or with sudo)
The quick answer
Step by step
- All files of one process (quick answer, line 1) — columns:
FD(file descriptor:cwd,txt,3w= number 3 open for writing),TYPE(REG file, IPv4 socket, FIFO pipe),NAME. - Who uses this file? (line 2) — the process that writes a log, or reads a config.
- **Disk full, but
dufinds nothing** — a deleted file is still open, so its space is not free:
Restart (or reload) that process, or empty the file through /proc without restarting: : > /proc/4711/fd/7.
- "umount: target is busy" — who uses the mount point:
Stop those processes, or cd away in your own shell.
- "Too many open files" — count and compare with the limit:
If the count grows forever, it is a leak (files or sockets not closed). If the app really needs more, raise the limit for the service: LimitNOFILE=65536 in a systemctl edit override, then restart.
- Network sockets (line 4) —
lsof -i :8080shows which process listens or is connected;-nPskips name lookups (faster).
Check that it worked
After the restart, lsof +L1 shows no big deleted files and df -h shows the space free again; umount works; the open-file count of the service stays below its limit (grep 'open files' /proc/PID/limits shows the new limit).
Common problems
| Problem | Cause | Fix |
|---|---|---|
lsof shows only your own processes | Not root. | Run with sudo. |
lsof hangs | A dead NFS mount, or slow name lookups. | lsof -b -nP; check the NFS mount. |
| Space still used after deleting a log | The writer keeps the file open. | Restart/reload it; use logrotate with copytruncate or a postrotate reload. |
New LimitNOFILE has no effect | Service not restarted, or limit set in the wrong place. | systemctl daemon-reload and restart; check /proc/PID/limits. |
lsof: command not found | Not installed. | Install lsof, or use ls -l /proc/PID/fd. |
| Container files not visible | Process runs in another mount namespace. | Run lsof inside the container or use nsenter. |
Go further
- Command pages: lsof, fuser, ss, df.
- Next how-tos: Check disk space and find what fills the disk, Find which process uses a port, Rotate log files with logrotate, Find a memory leak in a process.
- Learn it: RHCSA — Processes.
1Why can a disk stay full after you delete a big file?
A process still has the file open, so the space is only freed when that process closes it or ends.
2How do you find who blocks an umount?
lsof +f -- /mount/point or fuser -vm /mount/point lists the processes using the mount.