Hard Links
Cheat sheet · https://pcornel.dk/topic.php?topic=2675
Answer
A hard link is another directory entry for the same inode. All names are equal; the data is freed only when the last link is removed and no process has it open.
Remember
Hard links cannot cross filesystems or point to directories. ls -l shows the link count; find -samefile finds all names. Editing through any name changes the same data.
First checks
ls -li <file>— inode and link countfind <dir> -samefile <file>— every name of the same inodels -ld <path>— owner, permissions and typestat <path>— inode, links, size and timestampsdf -h <path>— filesystem and free spacefindmnt <path>— which mount the path is on
Verify in this order
file created (link count 1) → ln adds another name for the same inode → each rm removes a name → data freed at 0 links
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=2675