Mounting multiple NFS shares to the same point
tillman at seekingfire.com
Mon Feb 12 19:42:05 UTC 2007
On Mon, Feb 12, 2007 at 02:04:38PM -0500, Bob Johnson wrote:
> On 2/12/07, Tillman Hodgson <tillman at seekingfire.com> wrote:
> >Is this normal behaviour? Are there any problems with (performance,
> >perhaps) that might occur if an NFS share is mounted twice? What if my
> >backup job is still running, would it be interrupted by the second mount
> >75 minutes later (according to the `periodic` entires in crontab) or
> >will it be fine?
> This is normal behavior. There may be exceptions, but in general you
> can mount one filesystem over another (it isn't unique to NFS). Only
> the most recently mounted filesystem will be visible. Unmount it, and
> the one below it will become visible again. It does not reduce
> performance, it's just the way it works. For example, when you mount
> an NFS volume, you are mounting it over a directory on your local UFS
> volume, which is then no longer visible. In some cases this is useful:
> for example, you can populate the UFS directory with files that
> provide default values for something when the NFS mount is not there,
> or that can tell a script that the NFS mount is not present.
I can understand what you're describing, and it makes sense in the case
of mounting an NFS share onto a node in another filesystem. It still
seems like a bad default operation (especially from a POLA point of
view) for the case where you mount the same device or NFS export twice
on the same mount point. My expectation was that it would either error
or else recognize the duplication and realize that it didn't need to do
How do other Unix variants handle the same situation? I checked into
Linux, and it appears to let you do the same thing (which surprised me),
though in one case it will complain (mounting the *same* device/share
over top of itself). A friend tested that case and reported that it
gives this kind of error for both real devices and NFS shares:
mount: /dev/hda1 already mounted or /mnt busy
mount: according to mtab, /dev/hda1 is already mounted on /mnt
That error is actually what I was expecting to see for the case of
doubled-up NFS mounts :-) If it refused to mount in that case it would
be obvious to the administrator what the actual results would be.
> I'm not sure whether you are backup up TO or FROM the NFS mount, but
> either way, you aren't going to get the results you want if the second
> mount occurs while the backup is in progress.
... they could end up in a situation like this :-)
(Note that that in this case I'm backing up TO the NFS mount, and it's
possible that the same NFS share could be mounted on the same spot
twice, depending on how long it takes for the daily backup job to run).
I'll build some shell script logic using magic files and/or grep'ing
through the output of `mount` with some time-based backoffs if the
previous script hasn't finished running. It doesn't feel clean, though,
and there's race conditions that I'll have to think about how to handle.
Backups aren't something that I want to be so ... indeterministic. It
doesn't inspire trust in the backup set ;-)
"I don't believe in art. I believe in artists."
-- Marcel Duchamp
More information about the freebsd-questions