in reply to Identical Files to Symbolic Links

If possible, you should try to hardlink rather than symlink. It uses even less space, because the two directory entries merely have the same inode number, instead of wasting a block to contain the symlink direction. Also, if you elect to delete or rename one of the files, you might be deleting one that is pointed at by others. And, it's also faster to access, because the OS doesn't have to do a new name lookup with the symlink pointer.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^2: Identical Files to Symbolic Links
by thor (Priest) on Nov 09, 2005 at 12:19 UTC
    Not to pour Kool-aid in the swimming pool, but aside from being technically correct, are there situations where such things matter? That is, have you found systems where someone said "hmm...things would be 200% faster if we used hard links instead of symlinks"? If so, that must've been on helluva tight spec!

    thor

    Feel the white light, the light within
    Be your own disciple, fan the sparks of will
    For all of us waiting, your kingdom will come

      Not sure why you focussed on the speed. I just included that for completeness. More important is the space and delete/rename problems. But over NFS, long symlinks are very expensive, if you're curious and unaware.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

        I focused on the speed because I (for the most part) agree with you on the other points. Discourse would become very verbose around here if everyone said "yup...I agree with you on these three points, but not these two". Because I'm curious, what are your definitions of "long" and "very expensive"?

        thor

        Feel the white light, the light within
        Be your own disciple, fan the sparks of will
        For all of us waiting, your kingdom will come

Re^2: Identical Files to Symbolic Links
by bill_mcgonigle (Acolyte) on Nov 09, 2005 at 17:12 UTC
    Bill Stearns's freedups works well for when you want hard links: http://www.stearns.org/freedups/freedups.pl
Re^2: Identical Files to Symbolic Links
by PetaMem (Priest) on Nov 09, 2005 at 21:37 UTC
    The only reason why there are symbolic and not hard links, is that I assume(!), that hardlinks make problems when you tar the fileset.

    In our application, a lot of files is generated, then this dupe-eliminator rushes over it, then the result is tarballed and moved to production server. I would not want to untar copies instead of references there.

    Bye
     PetaMem
        All Perl:   MT, NLP, NLU