[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to hard link directories?



From my experience , I've always use soft or symbolic links over hard links (I believe that hard links cannot cross partitions )

We've used hard links in many installations when we want to say create the link : 
/opt/some_software  that is actually pointing to a larger partition like /data01/some_software . This lets the vendor keep their default path configuration, and let's us keep the standard mount config with the largest disk/partition being on /data01.

99% of the time, there is no problem with this, however, one word of caution, if you are running software or even processes from the symlinked path, it's path could actually change within the pid table. 

Some vendors WILL NOT support symlinks in this fashion. (i.e. IBM Webpshere, IBM Http server), even though the software may run fine with a symbolic link.

Also, you can run into problems trying to use an NFS export on a path that is actually a symbolic link .

The previous 2 posters mentioned bind mounts, and we've used those now in place of symlinks, and have had a lot less issues or problems. 

So I would also, recommend going over with the bind mount recipe, rather than a symbolic link . 

If the symbolic link file itself accidentally get deleted somehow, your path is basically completely broken...

...just my $ 0.02...

--
#!/usr/bin/rh stop

---- Tim Hart <codermsu@gmail.com> wrote: 

=============
cp -al /pub/fedora/linux/development/13 /pub/fedora/linux/updates/13

Then, keep it up to date with something like rsync -rvulH?

Just a thought.

Tim

On Wed, Mar 17, 2010 at 3:33 AM, Robert G. (Doc) Savage
<dsavage@peaknet.net> wrote:
> On Tue, 2010-03-16 at 23:09 -0500, Jason M. Schindler wrote:
>> > I'd like to create a hard link between
>> >
>> >         /pub/fedora/linux/development/13/
>> >          and
>> >         /pub/fedora/linux/updates/13/
>> >
>> > such that the contents of ./updates/13 exactly match those
>> > of ./development/13 without consuming any more disk space.
>> >
>> > I've been hammering away at various combinations and permutations of
>> > 'ln' without any luck. Is ln the correct utility to use? If so, what's
>> > the syntax I should use?
>> >
>> > --Doc
>>
>> Doc,
>>
>> I don't think you can hard link directories.  Why not use a soft link?
>>
>> -Jason
>
> Jason,
>
> If you look carefully, you'll find some real relics (fossils?) scattered
> throughout most Linux and UNIX distributions. The man page for the ln
> link utility is one of these. Except for recent insertions of copyright
> statements, I don't think it has been changed since it was originally
> written the '70s. Except for a veiled warning in the -d option, there's
> nothing that explicitly says you can't hard link directories. Would that
> be so inappropriate or hard to do?
>
> You ask "Why not use a soft link?" I'm glad you asked me that question.
> Aside from its obvious visual messiness in a directory display, a soft
> link is different from a hard link in subtle ways that I'd rather not
> have to deal with in scripts. For example, if I have two hard links to a
> file they're each a separate directory entry pointing to a set of inodes
> containing the data. If I delete one, the other remains intact. If
> instead I have a file and a soft link to that same file, the soft link
> points not to the inodes containing the data but to the original
> directory entry. If I delete the actual file a broken soft link is
> created.
>
> The mount method that Nathan has suggested has merits that lie somewhere
> between these two alternatives. It doesn't offer the file deletion
> protection afforded by hard links -- when I delete a file in either
> tree, it's removed from both. ("You want that cheeseburger to go? ...
> It's GONE!") On the other hand, there's no leftover broken soft link to
> clean up.
>
> --Doc
>
>
> -
> To unsubscribe, send email to majordomo@silug.org with
> "unsubscribe silug-discuss" in the body.
>


-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.


-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.