Paths, inodes and open files
medium 7 minA pathname resolves through directory entries to a filesystem object.
Video lesson · Chapter 1 of 4
A deleted log still uses disk space
Theory
Read or listen first. About 2 min.
What it is
A pathname resolves through directory entries to a filesystem object. A descriptor refers to an open file description, which keeps the underlying object alive. Removing a name changes the directory. Blocks become reclaimable only after the remaining links and open references are gone. A hard link and a symbolic link keep different relationships with their target.
Why it exists
After log rotation, the directory listing looks small but the filesystem still reports eight extra GiB allocated. Inspect open files on that filesystem and compare inode numbers before and after rotation. A long-running writer can retain the old inode and continue appending to it. Reopening the intended file lets the old storage be reclaimed once the final reference closes.
If no process retains deleted files, confirm the mount and account for snapshots, reservations or hidden mount points.
A deleted log still uses disk space
Inside this chapter
- The Virtual File System (VFS) layer
- VFS gives applications common operations over different filesystems. The underlying implementation still determines durability, locking and performance for a particular mount.
- Everything is a file philosophy
- A file descriptor can refer to a file, pipe, socket or other kernel object. Similar read and write calls do not imply identical seek, readiness or persistence semantics.
- Inodes and Superblocks
- An inode records object metadata and references to its data. A superblock describes a mounted filesystem instance. Exhausting inodes can prevent file creation despite available data blocks.
- The File Descriptor Table
- A process-local descriptor refers to an open file description. Duplicates may share offset and status flags. Track ownership to avoid descriptor leaks across retries or process execution.
- Hard links vs. Soft (Symbolic) links
- A hard link is another name for the same inode on the filesystem. A symlink stores a path and can become dangling when that path changes.
- Dentry Cache (dcache)
- The dentry cache accelerates mapping directory names to filesystem objects. A metadata-heavy workload can spend substantial time on path lookup even while reading little file data.
- File Locking: flock vs fcntl
- File locking is usually cooperative. Flock and fcntl record locks have differing ownership and range semantics. Verify the behavior of every participant and the mounted filesystem.
How it works
Step through the idea, or press Play.
Create a file. A directory name refers to inode 1234.
Understand it
Worked incident
A deleted log still uses disk space
| Observation | Allocated space for old log (GiB) | Interpretation |
|---|---|---|
| Baseline | 0 | The active log is the only large file. |
| Incident | 8 | Rotation removes its name but a worker still writes through its descriptor. |
| After intervention | 0 | Reopen the log using the service’s rotation mechanism. Confirm the worker writes to the new inode. |
Choose the next investigation
Summary
The whole topic in one minute.
Directory traversal misses an inode with no remaining name. Filesystem accounting includes its allocated blocks while a reference exists.
If no process retains deleted files, confirm the mount and account for snapshots, reservations or hidden mount points.