[NTLUG:Discuss] symbolic links

Eric Schnoebelen eric at cirr.com
Wed Apr 16 11:46:12 CDT 2003


Fred James writes:
- My understanding of links - please correct me were I may stray - and a 
- question, please:
- (1) When creating a link, no new file is created.

	True, to a fashion.  When creating a file, a hard link is
	created, but when creating additional links to an existing
	file, no additional files are created.

-      (a) "hardlinkname" is only an alias for the same inode as the 
-          original file.

	Not really.  A hard link is another directory entry
	referencing the same inode as the original directory entry.
	The inode includes a count of the number of directory
	entries pointing at it.

-      (b) "symboliclinkname" (sometimes called "soft link") points to the 
-	   original inode, and has its own inode.

	No.  A symbolic link points to a file name.  In fact, a
	symbolic link is just a file type that is specialy recognized
	by the kernel.  Once the kernel recognizes by the kernel,
	the kernel uses the contents of that file to modify the
	original path name to try and find the file.

-      (c) The "space savings" of a hard link is that it has no inode of 
-          its own.

	Kindof.  The space savings comes from not having to allocate
	an inode, and any other filesystem blocks for the symbolic
	link data. Every symbolic link is going to have a size of
	1 file system block. (unless "fast symlinks" are implemented,
	where short paths are stuffed into the inode.  I don't know
	of any non-commercial OS implementing that.)

- (2) Soft links can remain after the original file is deleted, and 
-     therefore point to nothing
-      (b) Can hard links do the same?

	No.

--
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