Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Mar 2007 10:09:55 -0500
From:      Mike Meyer <mwm-keyword-freebsdhackers2.e313df@mired.org>
To:        "Steven Hartland" <killing@multiplay.co.uk>
Cc:        freebsd-hackers@freebsd.org, freebsd-stable@freebsd.org
Subject:   Mount on non-empty directories (Was: sysinstall creates corrupt filesystems after repartitioning)
Message-ID:  <17896.15939.9988.89695@bhuda.mired.org>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
In <008101c75cd1$42a4df10$b3db87d4@multiplay.co.uk>, Steven Hartland <killing@multiplay.co.uk> 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.

	<mike
-- 
Mike Meyer <mwm@mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.



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