[UFO Chicago] hard links vs soft links

Jesse Becker jesse_becker at yahoo.com
Fri Aug 13 09:09:25 PDT 2010


saving space (multiple files using the same blocks on disk)
Keeping "backup" copies when deleting files (like "trash can" type use:  instead 
of deleting a file, you make a hardlink in ~/Trash, and then remove the 
original).

They can be very useful, in specific cases.

The main difference between hard and soft links is that if you remove the target 
of a soft link, the soft link becomes "dangling," and is probably useless.  With 
a hard link, you have to remove *all* of the hard links before the data is 
removed.

Files in unix filesystems are (and I'm simplifying a *lot* here) made of two 
parts: the inode and the data.
The inode keeps track of things like permissions, ownership, mtime, and all the 
other metadata you get from a stat() call.  It also includes a pointer to the 
data blocks[1].  Thus, a file can be shown like this:

  inode -> data

A symlink is something like this:

symlink --->   inode -> data

A hard link, on the other hand, is more like this:

  inode --\
               >--> data
  inode --/




[1] No, I'm not going to go into extents and data block pointers.

-- 
Jesse Becker



----- Original Message ----
> From: Brian Sobolak <brian at planetshwoop.com>
> To: ufo at ufo.chicago.il.us
> Sent: Fri, August 13, 2010 11:45:46 AM
> Subject: [UFO Chicago] hard links vs soft links
> 
> 
> I was linking something the other day and realized I only every  utilize
> soft links.  I thought about it for a second and then I thought  "Umm, why
> would I use hard links?"
> 
> So I ask you -- what good are hard  links for?
> 
> brian
> 
> -- 
> _______________________________________________
> UFO Chicago -- Users of  Free Operating Systems
> Free Software Rules -- Proprietary Drools!
> http://ufo.chicago.il.us/cgi-bin/mailman/listinfo/ufo
> 


      


More information about the ufo mailing list