Link Directory to directory (S.O.S)

Hello experts

We had a space problem in our SUN Box and decide to link a directory to avoid full space problem.

my current directory is /home/test/linktest and would like to link this directory to /user01/linktest.

When we try to use ln -s /home/test/linktest /usero1/linktest we got
a hard link on the target directory i.e.
ls -al
lrwxrwxrwx 1 oracle oracle 8 May 15 12:21 linktest -> linktest

Please help us.

That is not a hard link, that is a symbolic link. A hard link would not have the "-> linktest" in it.

For this to work the way you expect the "linktest" directory must not exist in /home/test. Howerver it might be better to automount this directory rather than linking it.

thank you for the reply.

It was a mistake, that should be a symbolic link.
By the way the problem the home/test/linktest is present and I would prefer to see
pwd
home/test/
ls -l
lrwxrwxrwx 1 oracle oracle 8 May 15 12:21 linktest -> /usero1/linktest

Please help me

By the way, how could I do automount.

Thank you

hi shamsul,

ln -h will help :wink:

cheers.

-h? Hmm... Never seen that before - the default behaviour of ln is to create a hard link. Anyway, you can't hard link directories - and the OP doesn't want that anyway.

Cheers,
ZB

Did you do this with the spelling mistake as indicated?

Who says you can't hardlink directories? I thought the only limitation was anything hardlinked had to be on the same volume. NTFS had some limitations like this....

ln, for one:

$ ln ldap foo
ln: `ldap': hard link not allowed for directory

Cheers
ZB

hi zazzybob,

$ ln ldap foo
ln: `ldap': hard link not allowed for directory

thats hardlink you created, try ln -s ldap foo - thats a softlink.
and i've got a ln --help actually :wink:

cheers :wink:

I'm aware of what I was creating, thanks. I was responding to porter, who said "Who says you can't hardlink directories" - I was proving this to be the case.

I must admit I'm surprised you can't, especially when a directory is nothing more than a file with a list of inodes and filenames. I checked Darwin, Linux, Solaris and AIX, all agree, you can't hard link directories. I presume this is because of the ".." entry which needs the inode of the parent, and technically and hard-linked directory would have two parents. But then also consider that "." and ".." actually are hard-links to directories.

Back to the original problem, is it due to the spelling mistake of substituting an "0" for an "o"?

You can in come cases hard link directories, but only by using the link system call. No version of the ln command that I know of will allow this to be done. Here is what the SPEC had to say about link();

Hi,

Your problem is resolved or no ,becs i am also suffering from the same ?????