From owner-freebsd-questions Tue Jun 27 09:57:27 1995 Return-Path: questions-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id JAA21663 for questions-outgoing; Tue, 27 Jun 1995 09:57:27 -0700 Received: from cs.weber.edu (cs.weber.edu [137.190.16.16]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id JAA21653 for ; Tue, 27 Jun 1995 09:57:17 -0700 Received: by cs.weber.edu (4.1/SMI-4.1.1) id AA03027; Tue, 27 Jun 95 10:49:04 MDT From: terry@cs.weber.edu (Terry Lambert) Message-Id: <9506271649.AA03027@cs.weber.edu> Subject: Re: Any way to get hard links to directories? To: wsantee@wsantee.oz.net (Wes Santee) Date: Tue, 27 Jun 95 10:49:03 MDT Cc: freebsd-questions@freebsd.org In-Reply-To: <199506270455.VAA05388@wsantee.oz.net> from "Wes Santee" at Jun 26, 95 09:55:31 pm X-Mailer: ELM [version 2.4dev PL52] Sender: questions-owner@freebsd.org Precedence: bulk > 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.