Brain Dump

Hard Link

Tags
comp-arch

Is a directory entry that points to an inode that's already pointed to by another directory entry. Essentially a hard-link allows multiple file-names in the file system to direct to the same data stored on a disk.

You can create a hard-link using the link system-call. A hard-link can be created anywhere in the file-system however you can't create directory hard-links, only files.

The integrity of the file system assumes the directory structure is an acyclic tree that is reachable from the root directory. It becomes expensive to enforce or verify this constraint if directory linking is allowed. Breaking these assumptions can leave file integrity tools unable to repair the file system. Recursive searches potentially never terminate and directories can have more than one parent but “..” can only refer to a single parent. All in all, a bad idea. Soft links are merely ignored, which is why we can use them to reference directories.

Links to this note