Re: Creating hardlinks for directories.

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

 



> Hi,
> 
> I wanted to create hardlinks for directories on the same file system.
> I know it's not allowed. But the man page for ln says one may. Now I
> want to know how may one switch it on.
> 
> Also what could be the pitfalls.

Many years ago, with no previous experience with multiuser, general
purpose computer systems designated as the system administrator for a
shiny new DEC VAX running 4.1c (or was it 4.1a) BSD UNIX.  I decided
that I needed to know about UNIX so I started learning-by-doing the
various commands available at the command line while the actual users
plowed ahead on the design of a network of early supercomputers and
supporting devices.  Eventually I stumbled (tripped?) over the link
command (ln).  I went into /usr/src/ and created the following:

/usr/src/a - a real directory
/usr/src/b - a hard link to a
/usr/src/c - a hard link to b
/usr/src/d - a hard link to c
/usr/src/e - a hard link to d
/usr/src/f - a hard link to e

I thought, "This is pretty interesting."  I moved around this structure
for a while, creating files, removing them using pathnames different
from the one I used to create them.  Then I tried to remove the
directories /usr/src/[abcdef].  No joy.  No matter what command or in
what order the various forms of rmdir or "rm -r" I tried worked.  The OS
reported that the target directory was not empty and so could not be
removed in every case.

So looking around I discovered the clear inode command, and it seemed a
perfect solution to my problem, after all I couldn't leave this bogus
structure handing around in the file system, could I?  I cleared a few
inodes then tried to verify the non-existence of the linked directories.
The system crashed like a rock.  Oh, oh!  I was going to be exposed as
an ignorant fool of a system administrator.  I had just thrown the other
15-20 users off.

So I lept to my feet, and shouted, "OK, who did that?" [The best defense
being a good offense.]  When no one answered, I went about the task of
overseeing the reboot.

I think this qualifies to illustrate a pitfall.

It was not long after my foolishness that hard links between directories
was no longer possible with out extraordinary action, which I do not
recall or even know if is still possible.

It is not clear to me why symbolic links would not work as well for you.
After my little adventure I can think of very few occasions when I used
hard as opposed to symbolic links, and symbolic links exclusively for
directories. ;-)

dlg

> Thanks!
> -- 
> vikram...
>          ||||||||
>          ||||||||
> ^^'''''^^||root||^^^'''''''^^
>         // \\   ))
>        //(( \\// \\
>       // /\\ ||   \\
>      || / )) ((    \\
> -- 
> Faster, faster, you fool, you fool!
> 		-- Bill Cosby
> -- 
>  O
> ~|~
>  =
> Registered Linux User #285795
> 
> -- 
> fedora-list mailing list
> fedora-list@xxxxxxxxxx
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux