What happens when you delete a file that a process still has open?
IntermediateConceptFilesystem Hierarchy, Inodes & Links
Answer
rm removes the directory entry (link count drops to 0), but the inode and blocks stay allocated until the last file descriptor is closed. df keeps showing the space as used while du does not.
sudo lsof +L1 # open files with link count 0
: > /proc/<pid>/fd/<fd> # truncate without restarting
Restarting or signalling the process to reopen its logs releases the space.
More on Filesystem Hierarchy, Inodes & Links
Explain the purpose of the main top-level directories in the FHS.BeginnerWhat is the "/usr merge"?IntermediateWhat are /proc and /sys?BeginnerWhat is an inode? What does it store and what does it NOT store?BeginnerA disk shows free space but you get "No space left on device". Why?IntermediateWhat is a hard link?Beginner