Stop panicking when df and du show different numbers

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

Stop panicking when df and du show different numbers

🧩 The Challenge

You finally found the directory taking up all that space, deleted the massive log files, but df still says the disk is full. I’ve spent an entire afternoon rebooting servers thinking the filesystem was corrupted before realizing a process was still holding onto the file handle.

💡 The Fix

Use lsof to identify the ghost process holding those deleted files open and restart the associated service to actually free up the space on the disk.

lsof +L1

⚙️ Why It Works

Since the kernel doesn’t reclaim the blocks as long as a process has the file descriptor open, the file stays invisible in ls but continues to occupy space. The +L1 flag specifically filters for files with a link count of less than one, which is exactly what you’re hunting for after an accidental delete.

🚀 Pro-Tip: If you can’t restart the service, try truncating the file to zero size by echoing nothing into /proc/<pid>/fd/<fd_number> instead of killing the process.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted