link/symbolic link~ What is the differance?

David Mandala plug-discuss@lists.plug.phoenix.az.us
18 Dec 2002 14:04:20 -0700


A hard link can ONLY be used on the same file system. A soft link
(symlink) can span file systems. So if you want to make a link and you
are on a different file system you have to use a soft link( symlink).

For example here is a df table listing from my machine I'm working on:

/dev/sda3             16990844   5280900  10846852  33% /
/dev/sda1               124427     20112     97891  18% /boot
/dev/hda1             29561392   2463484  25596236   9% /usr/local
none                    322000         0    322000   0% /dev/shm

Now if I want to make a link from something in the root file system to
something in /usr I could use a hard link since they both are in the
same partition but if I wanted to make a link from a file in /usr/local
in /usr it would have to be a soft link (symlink) since they are
different file systems (in fact different drives). Hope that helps.

Cheers,

Davidm

On Wed, 2002-12-18 at 13:22, Michael Havens wrote:
> If this is the case, what is the bebefit of a sym link? 
> If it's size how much bigger is a hard one?
> (I am so BAD!)
> 
> On Wednesday 18 December 2002 11:36 am, David Mandala wrote:
> > Easiest way to explain the difference is: Hard links must exist on the
> > same file system (ie: partition) and soft links (symlinks) can exist
> > across partition boundaries. There are other differences but that is the
> > biggest that you might care about.
> >
> > As explained below a hard link is a pointer to data that is already on
> > the drive. The name can be the same or different. With a hard link if
> > the original link is deleted the data remains accessible via the other
> > hard links. With a soft link if the original link is deleted the data is
> > gone and you have what is known as a hanging sym link, that is a soft
> > link that is now pointing at nothing. There are tools to scan your
> > drives to locate and delete hanging links. You would be surprised how
> > many hanging soft links can accumulate over time!
> >
> > There are more differences but I'll leave that to you to discover.
> >
> > Cheers,
> >
> > Davidm
> >
> > On Wed, 2002-12-18 at 11:36, Mike Starke wrote:
> > > /_> From what I've interpreted from a combination of the info/man pages
> > > on ln, it /_> seems that without  the -s it is just another command for
> > > copy. /_>
> > > /_> Is this correct?
> > > /_
> > > /_With a hard link, you have pointers to the same data saved at some
> > > /_particular location on the disk.  So it's technically not a copy.
> > > /_~M
> > > /_
> > > I must admit, I too, never fully understood the differance between
> > > soft & hard links.
> > >
> > > -Mike
> > > ---------------------------------------------------
> > > PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
> > > To subscribe, unsubscribe, or to change  you mail settings:
> > > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
-- 
David IS Mandala
gpg fingerprint 8932 E7EF CCF5 1B8C 1B5C  A92E C678 795E 45B2 D952
Phoenix, AZ (480) 460-7546 HP, (602) 321-8277 CP
http://www.them.com/~davidm/