After successfully creating a hard link called bar to the ordinary file foo, foo is deleted from the filesystem. Which of the following describes the resulting situation?
After successfully creating a hard link called bar to the ordinary file foo, foo is deleted from the filesystem. Which of the following describes the resulting situation?
When a hard link is created to a file, it creates another directory entry that points to the same underlying data. Deleting the original file (foo) only removes the directory entry for foo, but the data remains on the filesystem as long as there is at least one other hard link (bar) pointing to it. Hence, bar will remain accessible with the same content that was in foo.
The correct answer is B. foo would be removed while bar would remain accessible. Here's why: Hard links are multiple directory entries (names) that point to the same underlying data on the filesystem. Deleting one of the hard links (in this case, foo) only removes that specific name, not the underlying data. As long as at least one hard link exists (bar in this case), the data remains accessible. Therefore, even after deleting foo, the content is still accessible through the hard link bar.