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
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.
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
-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.
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....
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();