From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 2 15:08:26 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1CE9A16A401 for ; Fri, 2 Mar 2007 15:08:26 +0000 (UTC) (envelope-from mwm-keyword-freebsdhackers2.e313df@mired.org) Received: from mired.org (vpn.mired.org [66.92.153.74]) by mx1.freebsd.org (Postfix) with SMTP id A4CB713C471 for ; Fri, 2 Mar 2007 15:08:25 +0000 (UTC) (envelope-from mwm-keyword-freebsdhackers2.e313df@mired.org) Received: (qmail 18890 invoked by uid 1001); 2 Mar 2007 15:09:55 -0000 Received: by bhuda.mired.org (tmda-sendmail, from uid 1001); Fri, 02 Mar 2007 10:09:55 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17896.15939.9988.89695@bhuda.mired.org> Date: Fri, 2 Mar 2007 10:09:55 -0500 To: "Steven Hartland" In-Reply-To: <008101c75cd1$42a4df10$b3db87d4@multiplay.co.uk> References: <00cb01c75c5b$4205e390$b3db87d4@multiplay.co.uk> <45E82660.4030107@freebsd.org> <008101c75cd1$42a4df10$b3db87d4@multiplay.co.uk> X-Mailer: VM 7.17 under 21.4 (patch 20) "Double Solitaire" XEmacs Lucid X-Primary-Address: mwm@mired.org X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`; h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) From: Mike Meyer Cc: freebsd-hackers@freebsd.org, freebsd-stable@freebsd.org Subject: Mount on non-empty directories (Was: sysinstall creates corrupt filesystems after repartitioning) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Mar 2007 15:08:26 -0000 In <008101c75cd1$42a4df10$b3db87d4@multiplay.co.uk>, Steven Hartland typed: > Eric Anderson wrote: > > I don't know about the fs corruption, but the double mounts is > > something you asked it to do (maybe unknowingly). When you added > > that partition, one of the options is to mount it. > Clearly an easy work around in that case then but personally > I would expect a mount to a directory already in use by another > mount point to fail. Taking even further a mount to a directory > that is not actually empty should fail. IIRC this is how solaris > behaves but its been a while. Yeah, there are some system that have that annoying behavior. I've cursed at them before. Being able to create a skeleton for some mounted file system on the root is a useful thing, and I've done it in a number of cases. Mount has an option (union) specifically designed for such cases. Further, we have at least one file system (unionfs) that is explicitly designed to be mounted on top of non-empty directories that people are actively using and developing. > Either way allowing multiple mounts to the same location is bound to > cause all manor of confusion and should be prevented. This is just a special case of mounting on a non-empty directory. It should work right. The last mounted file system is the one you get (unless you're using a file system that's designed to behave another way). If you unmount the directory, the last mounted device is unmounted. As a general rule, deciding that something is "useless and dangerous" and removing it isn't the Unix way of doing things. Just because you can't see a use for something doesn't mean that no one else will. That's true even if you wrote the code. Someone doing something with your program you never thought of is a sign that you developed a generally useful tool. As for dangerous, Unix users - especially root, and mount is restricted to root by default - are assumed to know what they're doing. http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information.