That missing disk space? Here’s how to find it.
Disk & Filesystem Management (Du/Df/Lsblk/Fstrim)
That missing disk space? Here’s how to find it.
🧩 The Challenge
Ever cleaned up a ton of log files, ran df -h, and watched it barely budge? Seriously frustrating. Your du -sh /var/log comes back with 10GB, but df says the partition is still 98% full. And you’re left scratching your head, wondering where all that space went.
💡 The Fix
Turns out, the kernel won’t actually free up those blocks until every process holding that file open finally lets go. There’s a simple command to find exactly which processes are clinging to deleted files, letting you actually reclaim that space without rebooting.
lsof -nP | grep '(deleted)'
⚙️ Why It Works
When a process opens a file, it gets a file descriptor. Even if you rm that file, the descriptor keeps the underlying disk blocks allocated until the process closes it. This command shows you those stubborn file descriptors with the deleted file path.
🚀 Pro-Tip: Need to clean up quick? Look for processes with huge files open that have (deleted) next to them, then gently kill the PID (or restart the service) to force it to release the file.
Linux Tips & Tricks | © ngelinux.com | 11/24/2026
