Mounting multiple NFS shares to the same point

Bob Johnson fbsdlists at gmail.com
Mon Feb 12 19:31:17 UTC 2007


On 2/12/07, Tillman Hodgson <tillman at seekingfire.com> wrote:
[...]
> Further, you can mount /different/ shares to the same directory:
>
> [root at athena ~]# mount /exports/srvbackup/
> [root at athena ~]# mount_nfs nas:/pub /exports/srvbackup/
> [root at athena ~]# mount | grep srvbackup
> nas:/srvbackup on /exports/srvbackup (nfs)
> nas:/pub on /exports/srvbackup (nfs)
>
> I then cd'ed to /exports/srvbackup, and only saw files from the second
> mount (nas:/pub). So it's not doing a union mount or anything like that.
>
> 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'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.

- Bob


More information about the freebsd-questions mailing list