Pcornel
Linux · Filesystem

Inodes

Cheat sheet · https://pcornel.dk/topic.php?topic=2674

Back to the Topic

Answer

An inode is the on-disk record of a file: type, owner, permissions, size, timestamps and where the data blocks are. Directory entries map names to inode numbers; the name is not stored in the inode.

Remember

A filesystem has a fixed number of inodes on ext4; millions of small files can exhaust them while space remains — df -i shows it. Deleted files still held open by a process keep their inode and space until the process closes them (lsof +L1).

First checks

  • df -i — inode usage per filesystem
  • ls -i <file> — inode number
  • lsof +L1 — deleted files still open
  • ls -ld <path> — owner, permissions and type
  • stat <path> — inode, links, size and timestamps
  • df -h <path> — filesystem and free space
  • findmnt <path> — which mount the path is on

Commands

df -h
df -i

Verify in this order

name in a directory → inode number → inode (metadata, block map) → data blocks

Where it usually breaks

First mismatch in hardware/block device → kernel driver/mapper/RAID/LVM → filesystem → mount namespace/options → path permissions/MAC → consumer I/O; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2674

Confirmation

Confirm action

Continue?