[NCLUG] symbolic links

Matt Taggart taggart at carmen.fc.hp.com
Wed Nov 15 15:10:11 MST 2000


ken writes...

> I have 3 books on linux and none of them fully explains links.

That sucks.

> I am running out of space on /usr and need to install to another
> partition  say   /opt
> When I try
> ln -s /usr/local/moneydance /opt/local/moneydance
> the CDROM still trys to install to /usr/local/moneydance.

Which is the link so you should be fine. Do a 'ls -l' to make sure the link 
got created correctly. Use "du" and "df" to watch and see if it's putting 
things where you think it should be.

> Do I have to use a hard link...?
> Or is it not possible to link between partitions....?

Hard links have to be in the same filesystem. A hard link is just a pointer to 
a file already on the disk. For example,

-rw-r--r--    2 taggart  taggart         0 Nov 15 15:00 bar
-rw-r--r--    2 taggart  taggart         0 Nov 15 15:00 foo

First I created foo and then made the hard link bar, but the system sees them 
the same. Note the second column with the '2's. That the link count. What the 
'rm' command does is actually decrement the link count of the actual file. So 
I can 'rm' one of the above and the link count would go to 1 and the file 
would still exist. When the link count of a file actually reaches zero then 
the space it uses in the filesystem is marked as free. But the file is never 
actually "deleted". The only thing that would get rid of it is if it's 
overwritten.

HTH,

-- 
Matt Taggart
taggart at fc.hp.com





More information about the NCLUG mailing list