[cs615asa] Symbolic links

Joseph McKinney jmckinne at stevens.edu
Wed Mar 4 15:10:53 EST 2009


It seems to have to deal more with inodes.

Hard link:

fileA ---> inode: 9998
fileB ---> inode: 9998

fileA and fileB are just names that point to the inode 9998

symlink:

fileA ---> inode: 9998
fileB ---> symlink to fileA  (means point to whatever inode filaA is
currently pointing to)


so here is an example where hard and softlinks make a difference

/path/filea_hardlink         inode: 9999
/path/2nd_hardlink           inode: 9999
/path/fileb_symlink -> /path/filea_hardlink

So there are 2 hardlinks to inode 9999 and 1 softlink to the file
/path/filea_hardlink.

Rename /path/filea_hardlink to /path/other and we get

/path/other                inode:9999
/path/2nd_hardlink         inode:9999
/path/fileb_symlink -> /path/filea_hardlink

Now both /path/other and /path/2nd_hardlink still go to the same inode.
However, the symbolic link /path/fileb_symlink  points to the inode with a
hardlink at /path/filea_hardlink which does not exist anymore.

Now create a new file at /path/filea_hardlink and we get

/path/filea_hardlink     inode:10027
/path/other                inode:9999
/path/2nd_hardlink         inode:9999
/path/fileb_symlink -> /path/filea_hardlink

Both /path/other and /path/2nd_hardlink still point to inode 9999 and now
/path/filea_hardlink points to inode:10027 and /path/fileb_symlink goes to
whatever /path/filea_hardlink points to which is now 10027.

Please someone correct me if I'm wrong.



> -----Original Message-----
> From: cs615asa-bounces at lists.stevens.edu [mailto:cs615asa-
> bounces at lists.stevens.edu] On Behalf Of Chih-Yuan Lee
> Sent: Wednesday, March 04, 2009 2:18 PM
> To: "CS615A - Aspects of System Administration"
> Subject: Re: [cs615asa] Symbolic links
> 
> Dear professor,
> 
> So can we siad the difference between hard link and soft link is ...
> 
> Hard link:
> 
> fileA --------->fileB    Both fileA and fileB contain the same content.
> If one of them is changed, both of them will be changed.
> 
> 
> Soft link:
> 
> fileA ---------->fileB  Only fileB contains the content. And as we
> click the fileA, the system will open the fileB.
> 
> Is it correct??
> 
> Lee
> 
> 
> 
> 
> Jan Schaumann wrote:
> 
> 
> >                Name: attached
>                Type: multipart/signed
>                Encoding:
> 
> 
> ------------------------------------------------------------------------
> 
> 
> _______________________________________________
> >Cs615asa mailing list
> >Cs615asa at lists.stevens.edu
> >https://lists.stevens.edu/cgi-bin/mailman/listinfo/cs615asa
> >
> _______________________________________________
> Cs615asa mailing list
> Cs615asa at lists.stevens.edu
> https://lists.stevens.edu/cgi-bin/mailman/listinfo/cs615asa



More information about the Cs615asa mailing list