QuestionQ14

Storage

When a hard link is created that points to an already-existing file, which one of the following pieces of information about that file gets changed?

  • A File size
  • B Modify timestamp
  • C Link count
  • D Inode number
  • E Permissions
Explanation

A hard link is simply an additional directory entry that references the same underlying inode as the original file. Because the inode itself (which stores size, permissions, and the inode number) is shared and unchanged, those attributes remain identical for every hard-linked name. What does change is the inode's link count (the st_nlink value), which is incremented by one for every additional hard link created and decremented when a link is removed; the file is only truly deleted from disk once this count reaches zero. This behavior is documented in standard Linux filesystem and ln command references.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!