[NTLUG:Discuss] symbolic links

Eric Schnoebelen eric at cirr.com
Wed Apr 16 11:39:00 CDT 2003


Kenneth Loafman writes:
- Hard links cannot remain by themselves if the filesystem is operating 
- properly.  The hard link is literally another name for the file and 
- every operation on the hard link, remove included, is done to the file, 
- and to its original directory entry.

	?original directory entry?  Which one is that?

	You're correct, there is no such concept as a "dangling
hard link", because, by design, a hard link points to an inode,
which represents the file. (aside: the inode containes the file
information, and a list of pointers to blocks containing the
file data.  No inode, no file.)

	However, directory entries are just pointers to inodes.
You can have as may pointers to inode 5 as you like.  The kernel
keeps track of the number of directory entries pointing to an
inode in the inode, allowing it to discard the allocated blocks
when the count reaches zero.

	As someone else mentioned, hard links only work _within_
a file system.  You can not have a hard link across file system
mount points.

	Symbolic links are implemented as a file with a special
mode.  The kernel reads the file, and replaces the path it was
was using with a path as modified by the contents of the file
just read.

	You can have hard links to symbolic links...

--
Eric Schnoebelen		eric at cirr.com		http://www.cirr.com
      If you can spend a perfectly useless afternoon in a perfectly
      useless manner, you have learned how to live.  -- Lin Yutang



More information about the Discuss mailing list