Find the answer to your Linux question:
Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 22
It's not disparage, but quite everything is well documented and if people would read the manual pages and not ask others to summarize the manual pages for them, I would ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773

    It's not disparage, but quite everything is well documented and if people would read the manual pages and not ask others to summarize the manual pages for them, I would not say it. Anyway, I apologize that I sometimes tend to sound rude. Enough of that Off-Topic stuff.

    my difficulty is that the Linux file systems I know do not support hard linked directories
    To start with this, have you read the wiki summary about limitations of hard links I posted earlier? If not, read it. The most important drawback is written down right the first sentence. You then will understand why the guys that wrote this stuff decided that hardlinks of directories should be hard to set up.

  2. #12
    Just Joined!
    Join Date
    Sep 2010
    Posts
    13
    I guess you refer to the following sentence:
    Quote Originally Posted by Wikipedia;Hard_link#Limitations_of_hard_links
    Most modern operating systems don't allow hard links on directories to prevent endless recursion
    Yes, I read the whole Wikipedia page and many other pages before starting this thread.
    Yes, some software may get into infinite recursion which can cause difficulties.
    For me it's a bigger difficulty that I need to use an extra symlink for each directory to work this restriction around.

    Quote Originally Posted by Kloschüssel View Post
    decided that hardlinks of directories should be hard to set up.
    You suggest that hard linking directories is not impossible, but difficult. Can you tell me how it can be done? I understand there are risks. I did search the www for an answer and I couldn't find it.

  3. #13
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,530
    From the ln manpage:
    Code:
           -d, -F, --directory
                  allow the superuser to attempt to hard link directories (note: will probably fail  due
                  to system restrictions, even for the superuser)
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. #14
    Just Joined!
    Join Date
    Sep 2010
    Posts
    13
    Thanks, Rubberman, I did try
    Code:
    mkdir A
    sudo ln --directory A B
    for ext2, ext3 and reiserfs under SuSE and Ubuntu, all of these have failed.

    But even the manpage suggests that there are conditions under which the above do not fail. I would like to know what those conditions are and I couldn't find the answer.

  5. #15
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    What is the error? Something like "Invalid cross-device link"?

  6. #16
    Just Joined!
    Join Date
    Sep 2010
    Posts
    13
    Quote Originally Posted by Kloschüssel View Post
    What is the error? Something like "Invalid cross-device link"?
    No. As I said I have hard linked regular files (everything is on the same file system), it's the directories only I can't hard link.

    Code:
    $ touch a_file
    $ ln a_file hard_linked_file
    $ mkdir A
    $ sudo ln --directory A B
    [sudo] password for xxxxx: 
    ln: creating hard link `B' => `A': Operation not permitted
    $ ls -l
    drwxr-xr-x 2 xxxxx xxxxx     48 2010-09-08 10:01 A
    -rw-r--r-- 2 xxxxx xxxxx      0 2010-09-08 10:00 a_file
    -rw-r--r-- 2 xxxxx xxxxx      0 2010-09-08 10:00 hard_linked_file
    These are under Kubuntu Lucid, reiserfs.
    Do you know how to enable hard linked directories?

  7. #17
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    I would forget about directory hard links. They are just too much pain andthere are too much things that can turn really bad. So, you have two options as far I can tell:

    * use softlinks for directories
    * use the "mount -bind" (or the fstab entry) if you need a directory to be somewhere else too

  8. #18
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,530
    In any case, hard links can only be to files/directories on the same device/partition/filesystem. You cannot hard link under any circumstances to a file/directory that is on another drive or partition. This is one major reason why symbolic links are generally preferred for directory links at the least since it is quite likely that they are pointing to an entity that is not on the local file system.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  9. #19
    Just Joined!
    Join Date
    Sep 2010
    Posts
    13

    Thumbs up I forget hard links for this purpose, symlinks and NTFS directory junctions remain

    Thanks Kloschüssel and Rubberman, you have convinced me that I shouldn't use hard links for this purpose. I could probably solve continuing keeping everything on the same file system, but although we don't know how to enable hard linked directories, enabling them would make me using a setup I could hardly get any troubleshooting help for.

    As I see my options are the following:
    • using symlinks in general and the workaround of an extra symlink for each directory
    • using NTFS directory junctions - if they are suitable


    We have discussed the first option.

    I know little about the second. The NTFS#Directory_junctions section of Wikipedia suggests I may achieve what I want with NTFS (without an extra symlink for each directory) and
    tuxera.com/community/ntfs-3g-advanced/junction-points-and-symbolic-links
    suggests that the NTFS-3G driver supports this.
    Could anybody confirm this?

  10. #20
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    Sorry, I can't. I hardly distrust ntfs and would not run it on a linux server machine.

Page 2 of 3 FirstFirst 1 2 3 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •