LFCS · Question #792
An administrator is trying to make a hard link to an ordinary file but ln returns an error. Which of the following could cause this?
The correct answer is E. The source and the target are on different filesystems. Creating a hard link to an ordinary file will fail if the source file and the target link are located on different filesystems.
Question
Options
- AThe source file is hidden.
- BThe source file is read-only.
- CThe source file is a shell script.
- DThe administrator does not own the source file.
- EThe source and the target are on different filesystems.
How the community answered
(45 responses)- A2% (1)
- C2% (1)
- D4% (2)
- E91% (41)
Why each option
Creating a hard link to an ordinary file will fail if the source file and the target link are located on different filesystems.
The hidden status (indicated by a leading dot) of a file does not prevent the creation of a hard link.
A read-only source file does not prevent the creation of a hard link, as hard linking only creates a new directory entry pointing to the existing inode.
The type of file content, such as a shell script, has no bearing on whether a hard link can be created.
File ownership is not a strict requirement for creating a hard link, as long as the user has appropriate permissions (e.g., write permission in the target directory).
Hard links function by referencing the same inode number, which are unique only within a single filesystem. Therefore, a hard link cannot span across multiple distinct filesystems.
Concept tested: Hard link filesystem limitations
Source: https://www.gnu.org/software/coreutils/manual/html_node/ln-invocation.html
Topics
Community Discussion
No community discussion yet for this question.