Why Does Disk Space Appear Full After Deleting Files? Understanding Linux VFS
This article explains why a Linux system can report a full disk even after files are deleted, covering the role of open file handles, the lsof command, and the virtual file system architecture that manages inodes, dentries, and link counts.
Background
Sometimes disk space appears full even though large free space remains when inspecting individual directories.
Problem reproduction
Running df shows the root filesystem at 100% usage. du -h --max-depth=1 /home reveals only about 10 GB used, leaving a discrepancy.
Root cause
Deleted files may still be held open by running processes, so their space is not released. The lsof command lists such deleted but still‑open files; restarting the offending processes frees the space.
Linux Virtual File System (VFS)
The VFS is the entry point for all file operations, providing an abstraction layer between user‑space libraries and specific file‑system implementations (ext4, NFS, etc.).
Common file model
Superblock object – stores filesystem metadata in memory and on disk.
Inode object – represents a file’s metadata; exists in memory ( inode structure) and on disk.
File object – created when a file is opened; holds the interaction state between a process and the inode.
Dentry object – represents a directory entry; links a name to an inode.
Directory tree construction
Root filesystem is mounted first; other filesystems are mounted as sub‑directories, forming a unified tree.
Soft link vs hard link
A soft link is a regular file containing a pathname; a hard link points directly to the same inode, increasing the inode’s i_nlink count.
File & process management
Each process that opens a file gets its own file object, while the underlying inode may be shared. The kernel uses open() and close() to adjust the inode’s reference count ( i_count) via iget and iput. When i_count reaches zero, the inode can be released.
File & disk management
Deletion is performed via the unlink system call, which removes a directory entry and decrements the inode’s link count. If the link count drops to zero, the disk blocks are freed.
# dtruss rm tmp
...
unlink("tmp\0", 0x0, 0x0) = 0 0Summary
The key to understanding why disk space may not be reclaimed lies in the separation of file data and its index structures; only when no process holds an open reference can the space be released, and the write‑back caching policy means memory must be flushed before disk blocks are freed.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
