data and data-backup are hard links to one regular file with link count 2.
Run rm data.
What is true about data-backup?
rm removes one name from the inode. The remaining hard link still reaches the data and the link count becomes 1.
Detailed explanation
Incorrect. The inode remains while data-backup refers to it.
Correct. data-backup still reads the same data and the count is now 1.
Incorrect. A hard link does not become symbolic automatically.
Incorrect. The filesystem does not copy data to a new inode automatically.
Try it yourself
An example you can run in a temporary verification environment.
tmp=$(mktemp -d); printf payload >"$tmp/data"; ln "$tmp/data" "$tmp/data-backup"; rm "$tmp/data"; printf '%s %s\n' "$(cat "$tmp/data-backup")" "$(stat -c '%h' "$tmp/data-backup")"; rm -rf "$tmp"Expected result
payload 1Key points
- rm unlinks a name
- The remaining hard link preserves data
- The link count decreases
Notes
- Environment: Linux / GNU coreutils 9.x / 一時ファイル
- Use disposable files and directories for link experiments.
- Link behavior can differ for special filesystem objects and cross-filesystem operations.
Foundation review
Place the operation
Deleting one hard-link name leaves the content reachable through another name until the final reference is gone.
Check the side effect
Remove one name in a temporary directory and read the remaining name.