LFCS: Linux Foundation Certified System Administrator Exam - Hard Links and File Information Changes

Hard Links and File Information Changes

Question

Which of the following pieces of information of an existing file is changed when a hard link pointing to that file is created?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

C

When a hard link pointing to an existing file is created, only the link count is changed. The other pieces of information such as the file size, modify timestamp, inode number, and permissions remain the same.

A hard link is essentially a reference to an existing file. It points to the same inode number as the original file, meaning that both the original file and the hard link share the same set of attributes, including the same file size, modify timestamp, and permissions. In other words, a hard link is not a separate copy of the file, but rather another name for the same file.

The only difference between the original file and the hard link is the link count. The link count is a value stored in the inode that indicates how many hard links exist for the file. When a hard link is created, the link count is incremented by 1 for the file's inode. When a hard link is deleted, the link count is decremented by 1. When the link count reaches 0, the file is deleted from the file system.

Therefore, when a hard link is created, the file size, modify timestamp, inode number, and permissions remain unchanged because the hard link is just another name for the same file. The only thing that changes is the link count, which is incremented for the file's inode.