Stop being lied to by du when files are still open

Disk & Filesystem Management (Du/Df/Lsblk/Fstrim)

Stop being lied to by du when files are still open

🧩 The Challenge

You’ve finally tracked down a runaway log file that’s eating your disk, deleted it, and checked df again, but the space is still missing. It’s enough to make you want to toss the server out the window because the filesystem is clearly keeping the blocks hostage for a process that refuses to let go.

💡 The Fix

Use lsof to hunt down the zombie file descriptor holding that space open so you can actually kill the process instead of just guessing which service is responsible.

lsof +L1

⚙️ Why It Works

Since the file was unlinked but the process still has a reference, it won’t show up in a standard directory listing or du scan. This command specifically flags files with a link count of less than one, showing you exactly which PID is refusing to give back your storage.

🚀 Pro-Tip: If you can’t restart the process, truncating the file to zero bytes with > /proc/<pid>/fd/<fd> will reclaim the space immediately.

Linux Tips & Tricks | © ngelinux.com | 11/11/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted