I'm aware that this article exists: Why are hard links only valid within the same filesystem? But it unfortunately didn't click with me.
https://www.kernel.org/doc/html/latest/filesystems/ext4/directory.html I'm reading operating system concepts by Galvin and found some great beneficial resources like linux kernel documentation.
There can be many directory entries across the filesystem that reference the same inode number--these are known as hard links, and that is why hard links cannot reference files on other filesystems.
In the very beginning the author says this. But I don't understand the reason behind it.
Information contained in an inode:
- Mode/permission (protection)
- Owner ID
- Group ID
- Size of file
- Number of hard links to the file
- Time last accessed
- Time last modified
- Time inode last modified
https://www.grymoire.com/Unix/Inodes.html
Now since the inode contains these information, what's the problem with letting hard links reference files on other filesystem?
What problem would occur if hard link reference on other filesystems?
About hard link:
The term "hard link" is misleading, and a better term is "directory entry".
A directory is a type of file that contains (at least) a pair considering of a file name and an inode. Every entry in a directory is a "hard link", including symbolic links. When you create a new "hard link", you're just adding a new entry to some directory that refers to the same inode as the existing directory entry.
This is how I visualize what a directory concept looks like in an operating system. Each entry is a hardlink according to the above quoted text. The only problem that I can see is that multiple filesystem could have same range of inode(But I don't think so as inode is limited in an operating system).
Also why would not it be nice to add new information about filesystem in inode itself? Would not that be really convenient?