Disk & Filesystem Management (Du/Df/Lsblk/Fstrim)
Stop df from being a total liar on busy servers
đź§© The Challenge
You ever deleted a massive log file to free up space, ran df, and realized the partition is still reporting 100% full? It’s enough to make you want to throw your keyboard through the office window when you’re in the middle of an outage.
đź’ˇ The Fix
The file is still held open by a process, so you need to find that stubborn PID and kill it, or restart the service to force it to let go of the file descriptor.
lsof +L1 /var/log/myapp/error.log
or if you suspect any deleted files are hanging around taking up space:
lsof | grep deleted
⚙️ Why It Works
Linux doesn’t actually remove the data from the disk until the last process holding the file descriptor closes it. By hunting down the PID with lsof, you’re cutting the leash so the filesystem can finally reclaim those blocks.
🚀 Pro-Tip: If it’s a critical production app you can’t restart, try truncating the file to zero bytes with truncate -s 0 /path/to/file instead of deleting it.
Linux Tips & Tricks | © ngelinux.com | 7/25/2026
