Track hard link counts and their effect on inode reference counting and deletion.
A hard link is a second directory entry (dentry) pointing to the same inode — not a copy. The inode's st_nlink field (visible via stat or ls -l) counts how many directory entries reference it. Deleting (unlinking) a filename only decrements nlink; the kernel frees the inode and its data blocks only when nlink reaches 0 and no process still holds the file open. This is why `rm` on a file with nlink > 1 doesn't free any disk space — the data is still reachable through the other names.
New link count
new_nlink = current_nlink ± delta (data freed only when new_nlink reaches 0)
Because the file's data lives in the inode, not in the directory entry you deleted. As long as st_nlink stays above 0 — meaning at least one other name still points to that inode — the data blocks remain allocated and accessible through the remaining name(s).
No. Hard links must reference an inode on the same filesystem/mount point, since inode numbers are only unique within a single filesystem. To 'link' across filesystems, use a symbolic link instead, which stores a path rather than an inode reference.
A directory's own entry counts as one link, and its `.` self-reference counts as a second. Each subdirectory inside it adds another link via its `..` entry pointing back — so nlink on a directory reflects 2 plus its number of subdirectories, not files.