A hard link is an additional directory entry referencing the same inode as the original file, and inode numbers are only valid within the boundaries of a single filesystem. Consequently, the ln command cannot create a hard link when the source file and the target link location reside on different filesystems (e.g., different partitions or mounted devices) — it fails with an "Invalid cross-device link" error. In such cases, a symbolic link (ln -s) must be used instead. Attributes such as the file being hidden, read-only, a shell script, or already having existing hard links do not prevent hard link creation.
Community Discussion