Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jun 95 10:49:03 MDT
From:      terry@cs.weber.edu (Terry Lambert)
To:        wsantee@wsantee.oz.net (Wes Santee)
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Any way to get hard links to directories?
Message-ID:  <9506271649.AA03027@cs.weber.edu>
In-Reply-To: <199506270455.VAA05388@wsantee.oz.net> from "Wes Santee" at Jun 26, 95 09:55:31 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> Okay, I know that you aren't supposed to be able to create a hard
> link to a directory.  In the ln(1) man page, however, it states that
> "Hard links may not normally refer to directories and may not span
> filesystems."
> 
> Does that mean there is some way to create hard links to directories
> in a 'non-normal' way?  If so, are there consequences?

Root is allowed to hard link directories.

In general, this was the pre-"rename" mechanism for renaming directories:
you had root do it.  That's because pre-"rename", the way to rename
things was to make a link to them and then unlink the original.

In general, hard links on directories are strongly discouraged by
everyone and spit upon by me.

They are discouraged because they cause fits for fsck.  If you in fact
get a cyclical graph set up, you are pretty much screwed.  This would
be done by linking a directory into itself or to an inferior heirarchy.

They are spit upon by me for several reasons.  The first is that in
a normal UNIX files system implementation, there is not a single
parent inode.  This plays hell with permissions mechanisms that depend
on inheritances (Access Control Lists and NetWare Trustees are two).

POSIX is also not very clear on implementation demands.  In point of
fact, it is perfectly legal to implement "." and ".." as manufactured
name space intrusions that have no physical presence in the file system
at all.  In reality, there are several significant benefits to this
approach (as NTFS can attest).  The least of which is the ability to
embed logical names and have multiple seperate root volumes, which can
have significant impact on implementing nomadic computing, package
location independence, ann server fail-over and less obvious software
fault tolerance mechanisms.

Suffice it to say, I would *strongly* urge you to reexamine why you
want a hard linked directory and to choose another soloution to
your problem.


					Terry Lambert
					terry@cs.weber.edu
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9506271649.AA03027>