Systems study
Offline — showing the cached copy.
Home / Linux / 2. Filesystems and inodes

2. Filesystems and inodes

One-liner. Names live in directories; everything else lives in the inode.

Memorize

  • inode holds metadata + block pointers — not the filename; directory entries map names → inodes.
  • Hard link = another name for the same inode (same filesystem). Symlink = a separate inode containing a path.
  • Deleting a file removes the directory entry and decrements the link count; space returns when the count hits 0 and no process holds it open.
  • df reports filesystem blocks; du sums visible files — they disagree on deleted-but-open files and reserved blocks (~5% on ext4).
  • Mounts compose a single tree via the VFS; /etc/fstab with UUIDs survives device renames.
  • ext4 = journaled, mature; XFS = large files/parallel I/O; btrfs/ZFS = COW, snapshots, checksums.
  • stat, findmnt, lsblk -f, lsof +L1 (deleted open files) are the diagnostic set.
A PATH RESOLVES PATH /var/log/app.log DIRECTORY ENTRY name → inode nu… INODE mode owner size timestamps block pointers BLOCKS data extents on…
A path resolves

Trap. "I deleted 40 GB but df is unchanged" — a process still holds the file open. Do this. lsof +L1 and restart the writer, or truncate via /proc/<pid>/fd/<n>.

Check

What happens to disk space when you rm a file that a running process still has open?