Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Feb 2007 11:05:53 -0600
From:      Tillman Hodgson <tillman@seekingfire.com>
To:        freebsd-questions@freebsd.org
Subject:   Mounting multiple NFS shares to the same point
Message-ID:  <20070212170553.GA543@seekingfire.com>

next in thread | raw e-mail | index | archive | help
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@athena ~]# mount /exports/srvbackup/
[root@athena ~]# mount | grep srvbackup
nas:/srvbackup on /exports/srvbackup (nfs)
[root@athena ~]# mount /exports/srvbackup/
[root@athena ~]# mount | grep srvbackup
nas:/srvbackup on /exports/srvbackup (nfs)
nas:/srvbackup on /exports/srvbackup (nfs)
[root@athena ~]# umount /exports/srvbackup/
[root@athena ~]# mount | grep srvbackup
nas:/srvbackup on /exports/srvbackup (nfs)
[root@athena ~]# umount /exports/srvbackup/
[root@athena ~]# mount | grep srvbackup
[root@athena ~]# man mount_nfs

Further, you can mount /different/ shares to the same directory:

[root@athena ~]# mount /exports/srvbackup/
[root@athena ~]# mount_nfs nas:/pub /exports/srvbackup/
[root@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




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