Mounting multiple NFS shares to the same point

Tillman Hodgson tillman at seekingfire.com
Mon Feb 12 17:36:01 UTC 2007


A bit of background:

I run backup scripts (dumps piped through gzip to a fileshare) out of
periodic on a daily, weekly and monthly basis. In the script I mount the
NFS share, perform the dumps, and then umount the share. I was worried
that if a daily backup took a long time (more than twice the normal
time) then the weekly would bomb out because the filesystem was already
mounted. So I was going to write some checks to see if it existed before
mounting it.

Which is when I discovered that you can mount multiple NFS shares to the
same directory :-)

Here's an example of it in action:

[root at athena ~]# mount /exports/srvbackup/
[root at athena ~]# mount | grep srvbackup
nas:/srvbackup on /exports/srvbackup (nfs)
[root at athena ~]# mount /exports/srvbackup/
[root at athena ~]# mount | grep srvbackup
nas:/srvbackup on /exports/srvbackup (nfs)
nas:/srvbackup on /exports/srvbackup (nfs)
[root at athena ~]# umount /exports/srvbackup/
[root at athena ~]# mount | grep srvbackup
nas:/srvbackup on /exports/srvbackup (nfs)
[root at athena ~]# umount /exports/srvbackup/
[root at athena ~]# mount | grep srvbackup
[root at athena ~]# man mount_nfs

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 definitely seems odd to me, I would've expected mount to express an
error to me.

-T



More information about the freebsd-questions mailing list