sym link question...

Cameron Simpson cs at zip.com.au
Thu Mar 10 01:12:39 UTC 2005


On 09Mar2005 16:39, bruce <bedouglas at earthlink.net> wrote:
| i have a question regarding symlinks. i have my system partitioned
| 
| /dev/hda5    100 /
| /dev/hda1    10000 /home
| /dev/hda2    30000 /usr
| 
| is it possible to create a symlink that would allow '/' to point to
| /usr/root. i'm inclined to think you can't but i'm not knowledgeable about
| the concept of symlinks within linux....

You can't.
You could perhaps go the other way depending what you wanted to achieve
and why, and how hard you want to work.

A symlink is a normal filesystem object, like a file or a directory etc,
in that such an object must _be_ something. So you can't make a symlink
for / because / must be a directory.

| would you have to copy the dir structure under '/' to the symlink. and
| wouldn't this cause a recursive issue/situation??

A symlink just points somewhere. You'd move the directory contents to that somewhere. Example:

	mkdir foo
	echo 1 >foo/1
	echo 2 >foo/2

makes a directory "foo" with some stuff in it. Supposing you actually
wanted it at "bah" and wanted a symlink at foo (eg to support scripts
that might know the old "foo" name), you'd go:

	mv foo bah
	ln -s bah foo

That moved foo sideways to bah, and then makes a symlink named "foo" that
points at "bah".

/ is special - it's got to be a directory, being at the top of the
filesystem; there's nowhere to put the symlink; consider that the symlink
above for "foo" is in fact stored in the directory containing "foo" -
there is no directory "containing" "/".

Does this clarify things at all?
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

If I can make a dress out of a chicken feed sack, I can make a man out of
you.    - another great country music lyric




More information about the redhat-list mailing list