Recovering Space from Deleted Open Files
Disk & Filesystem Management (Du/Df/Lsblk/Fstrim)
Recovering Space from Deleted Open Files
🧩 The Challenge
Disk space often remains occupied by large log files or deleted data even after the files have been removed from the directory structure. This happens because a running process still holds an open file descriptor to the deleted file.
💡 The Fix
Use the lsof utility to identify processes that have deleted files open, then signal those processes to release the file handles or restart the associated service.
sudo lsof +L1
⚙️ Why It Works
The +L1 flag instructs lsof to list all open files that have a link count of less than 1, effectively surfacing “invisible” space hogs that are no longer accessible via standard directory listings.
🚀 Pro-Tip: Pipe the output to awk ‘{print $2}’ | xargs kill -HUP to automatically reload processes holding deleted files without a full service restart.
Linux Tips & Tricks | © ngelinux.com | 7/9/2026
