Hard link
A hard link is a directory entry naming an existing file's inode, so multiple hard links refer to the same file rather than to separate copies.
On Linux, link() creates another name without overwriting an existing destination and cannot cross mounted-filesystem boundaries. In-place writes through either name modify the shared file; replacing one name with rename() instead rebinds that name and leaves the other hard links attached to their original inode. Removing one link does not remove the other names. Separate open() calls through these names still create separate open file descriptions.
Backup boundary: permission bits also belong to the shared file. In eight local rsync 3.2.7 schedules, rerunning archive mode into an existing hard-linked destination changed the older copy's mode from 0600 to 0644 without --inplace, including with --checksum. Copying into an empty destination isolated this mode change; skipping existing files left their permissions stale. These observations do not establish crash durability. [5]
GNU tar --hard-dereference stores each hard-linked name as a regular payload entry. With normalized metadata, a controlled archive from shared source files was byte-identical to one from independent equal-content files. Full extraction restored correct bytes but lost the original sharing relation. Per-path hashes cannot establish that relationship; recovery acceptance must specify whether it matters. [6] [7]
Restore topology: rsync 3.2.7/3.4.1 controls retained extra aliases with -aHc and imported them with --link-dest. Selecting a could pass hashes, sizes, modes, mtimes, counts and selected groups with the wrong external peer; selecting a and b repaired their pair but retained that alias. Later writes exposed coupling. [8] [9] [10]
Relations
- related
- O_TMPFILE, Inode, Atomic rename, Unlink, Open file description, Directory fsync, Archive member, Backup manifest, Symbolic link, Path resolution, Link count, Extended attribute
Advantages
- Provides another name for the same file without copying its contents.
Limitations
- Shared file contents mean a hard link is not an independent backup.
- Linux link() rejects directories and links across mounted filesystems.
Citations
- Hesela: measured rsync selection and hard-link backup boundaries
- GNU tar 1.35: Hard Links
- Hesela: selected TAR hard-link restore, complete observations and reproduction
- Rsync pinned upstream manual: hard-link transfer-set and destination-pattern limits
- Hesela: restoring names is not restoring file relationships
- Hesela: selected rsync restores, retained observations and reproduction
Further reading
- Linux man-pages 6.19: link(2)
- Linux man-pages 6.19: rename(2)
- Linux man-pages 6.19: open(2)
- Hesela: The name changes; existing readers do not
Sources & caveats
- Rsync evidence uses constructed files and complete byte/mode comparisons on one Linux host; it is not a production failure-rate estimate.
- Five synthetic USTAR fixtures, eleven operations per fixture, CPython 3.12.3 and 3.12.15 with one GNU tar 1.35 binary. Exact payload and live device/inode comparisons; not independent reliability samples. https://hesela.dev/research/tar-hardlink-selection/observation-system.json
- Topology and selected-restore studies retain separate sets of 320 invocations: synthetic quiescent files on one Linux/ext4 host and two rsync builds, not failure-rate samples.
- Size, mode and mtime only; no concurrent, open-handle, bind-mount, media-independence, crash or application-recovery claim.
- Immutable evidence and historical candidate-status context: https://hesela.dev/research/rsync-topology-20261023/PUBLICATION.md