MOUNT_NFS(8) | System Manager's Manual | MOUNT_NFS(8) |
mount_nfs
— mount
NFS file systems
mount_nfs |
[-o options]
server:/path directory |
The mount_nfs
command calls the
mount(2) system call to prepare and graft a remote NFS
file system ( server:/path ) on to the file system
tree at the point directory.
This command is expected to be executed by the
mount(8) command. Direct use of
mount_nfs
to mount NFS file systems is strongly
discouraged because there is little practical benefit of using it instead of
mount(8).
For NFS versions that use a separate mount protocol,
mount_nfs
implements the mount protocol as described
in RFC 1094, Appendix A and NFS: Network File System
Version 3 Protocol Specification, RFC 1813, Appendix I.
By default, mount_nfs
will attempt the
mount twice before exiting with an error. If the -o
bg
option is given, it will attempt the mount once
and then background itself to continue trying another 10,000 times (pausing
for one minute between attempts). The option -o
retrycnt
=⟨num⟩
can be used if a different retry behavior is desired for a mount.
If the server becomes unresponsive while an NFS file system is
mounted, any new or outstanding file operations on that file system will
hang uninterruptibly until the server comes back (or that NFS file system is
forcibly unmounted). To modify this default behaviour, see the
-o
intr
and
-o
soft
mount options.
Mount options are specified with a -o
flag
followed by a comma separated string of options. See the
mount(8) man page for possible options and their meanings.
The following NFS-specific options are also available:
bg
retrycnt
=⟨num⟩retrycnt
to 0, in addition to only trying
to establish connection once, will case nfs client code to use quick time
out value (default 8s) instead of regular mount time out (default 30s)
value while establishing initial connection.
udp
tcp
inet
inet6
proto
=⟨netid⟩tcp
(TCP over IPv4), udp
(UDP over IPv4), tcp6
(TCP over IPv6), and
udp6
(UDP over IPv6). Note that this option
differs from the separate tcp
and
udp
options described above in that each netid
value specifies both a transport protocol and address family (IP version).
mntudp
mountport
=⟨port-number⟩port
=⟨port-number⟩noconn
resvport
resvport
mount option.
intr
EINTR
when a termination signal is posted for the
process.
soft
retrans
round trip timeout intervals. Note: mounts
which are both soft and read-only will also have the
locallocks
mount option enabled by default -
unless explicitly overridden with a lock option (for example,
nolocks
or nolocallocks
).
vers
=⟨num[.num]⟩[-
⟨num[.num]⟩]nfsvers
=⟨num[.num]⟩[-
⟨num[.num]⟩]vers
or
nfsvers
option. Versions 2 or 3 do not support
minor versioning so minor versions greater than zero are treated as above.
nfsv2
nfsv3
nfsv4
-o
vers
=⟨num⟩ to
specify NFS protocol version.
sec
=⟨mechanism⟩etype
=⟨encryption-type⟩realm
=⟨realm⟩principal
=⟨principal⟩sprincipal
=⟨server-principal⟩rsize
=⟨readsize⟩-s
option to see what the “fragments
dropped due to timeout” value is.)
wsize
=⟨writesize⟩rsize
option, but using the “fragments
dropped due to timeout” value on the server instead of the client.
Note that both the rsize
and
wsize
options should only be used as a last ditch
effort at improving performance when mounting servers that do not support
TCP mounts.
rwsize
=⟨size⟩dsize
=⟨readdirsize⟩readahead
=⟨maxreadahead⟩rdirplus
/ nordirplus
acregmin
=⟨seconds⟩acregmax
=⟨seconds⟩acdirmin
=⟨seconds⟩acdirmax
=⟨seconds⟩acrootdirmin
=⟨seconds⟩acrootdirmax
=⟨seconds⟩acrootdirmin
and
acrootdirmax
will be assigned to those of
acdirmin
and acdirmax
respectively, to maintain backward compatibility. Setting all the minimum
and maximum to zero will disable attribute caching. The algorithm to
calculate the timeout is based on the age of the file or directory. The
older it is, the longer the attribute cache is considered valid, subject
to the limits above. Note that the effectiveness of this algorithm depends
on how well the clocks on the client and server are synchronized.
actimeo
=⟨seconds⟩noac
actimeo
to 0.
nonegnamecache
accesscache
=⟨size⟩locallocks
locallocks
mount
option enabled by default - unless explicitly overridden with a lock
option (for example, nolocks
or
nolocallocks
).
nolocks
nolockd
nolock
nonlm
ENOTSUP
regardless of whether or not the NFS
server supports NFS file locking.
noquota
ENOTSUP
regardless of whether or not the NFS
server supports the RQUOTA service.
maxgroups
=⟨num⟩dumbtimer
timeo
=⟨timeout⟩dumbtimer
option should be
specified when using this option to manually tune the timeout interval.)
retrans
=⟨count⟩deadtimeout
=⟨timeout⟩deadtimeout
mount
option set to 60 seconds. This can be explicitly overridden by setting
deadtimeout
=0.
mutejukebox
async
nfs.client.allow_async
option in
nfs.conf(5) is also enabled.
sync
nosync
, behavior is to return once
the I/O has been queued up.)
nocallback
nonamedattr
namedattr
noacl
acl
option.
aclonly
noacl
option.
nfc
nfs.conf(5) can be used to configure some NFS
client options. In particular,
nfs.client.mount.options
can be used to specify
default mount options. This can be useful in situations where it is not easy
to configure the command-line options. Some NFS client options in
nfs.conf(5) correspond to kernel configuration values
which will get set by mount_nfs
when performing a
mount. To update these values without performing a mount, use the command:
mount_nfs
configupdate
.
The following mount_nfs
command line flags
have equivalent -o
option
forms (shown in parentheses) and their use is strongly discouraged. These
command line flags are deprecated and the -o
option forms should be used instead.
-2
(vers=2), -3
(vers=3), -4
(vers=4), -L
(nolocks), -P
(resvport), -T
(tcp), -U
(mntudp), -b
(bg),
-c
(noconn), -d
(dumbtimer),
-i
(intr), -l
(rdirplus),
-m
(nordirplus), -s
(soft),
-I
readdirsize (dsize=#),
-R
retrycnt (retrycnt=#),
-a
maxreadahead (readahead=#),
-g
maxgroups (maxgroups=#),
-r
readsize (rsize=#),
-t
timeout (timeo=#),
-w
writesize (wsize=#),
-x
retrans (retrans=#).
The simplest way to invoke mount_nfs
is
with a command like:
mount remotehost:/filesystem
/localmountpoint
or:
mount -t nfs remotehost:/filesystem
/localmountpoint
As can be derived from the comments accompanying the options, performance tuning of NFS can be a non-trivial task. Here are some common points to watch:
sync
option will probably have a
detrimental affect on performance. Its use is discouraged as it provides
little benefit.async
option may improve performance,
but only at the risk of losing data if the server crashes because the
client will not be making sure that all data is committed to stable
storage on the server.rsize
and wsize
options respectively will increase
throughput if the network interface can handle the larger packet sizes.
The default read and write sizes are 8K when using UDP, and 32K when using TCP. Values over 16K are only supported for TCP, where 2M is the maximum.
Any value over 32K is unlikely to get you more performance, unless you have a very fast network.
This can especially happen with lossy network connections (e.g. wireless networks) which can lead to a lot of dropped packets.
In this case, decreasing the read and write size, using TCP, or a combination of both will usually lead to better throughput.
Some common problems with mount_nfs
can be
difficult for first time users to understand.
mount_nfs: can't access /foo:
Permission denied
This message means that the remote host is either not exporting the file system you requested or is not exporting it to your host. If you believe the remote host is indeed exporting a file system to you, make sure the exports(5) file is exporting the proper directories. The program showmount(8) can be used to see a server's exports list. The command “showmount -e remotehostname” will display what file systems the remote host is exporting.
A common mistake is that mountd(8) will not
export a file system with the -alldirs
option,
unless it is a mount point on the exporting host. It is not possible to
remotely mount a subdirectory of an exported mount, unless it is exported
with the -alldirs
option.
The following error:
NFS Portmap: RPC: Program not
registered
means that the remote host is not running nfsd(8). or mountd(8). The program rpcinfo(8) can be used to determine if the remote host is running nfsd and mountd by issuing the command:
rpcinfo -p
remotehostname
If the remote host is running nfsd, mountd, rpc.statd, and rpc.lockd it would display:
program vers proto port
100000 2 tcp 111
portmapper
100000 2 udp 111
portmapper
100005 1 udp 950 mountd
100005 3 udp 950 mountd
100005 1 tcp 884 mountd
100005 3 tcp 884 mountd
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100024 1 udp 644 status
100024 1 tcp 918 status
100021 0 udp 630
nlockmgr
100021 1 udp 630
nlockmgr
100021 3 udp 630
nlockmgr
100021 4 udp 630
nlockmgr
100021 0 tcp 917
nlockmgr
100021 1 tcp 917
nlockmgr
100021 3 tcp 917
nlockmgr
100021 4 tcp 917
nlockmgr
The following error:
mount_nfs: can't resolve
host
indicates that mount_nfs
could not resolve
the name of the remote host.
The following error:
In case the remote host is not running rpc.statd and the client is
mounting the NFS directory with remote locks (enabled by default),
mount_nfs
should fail with EPROGUNAVAIL. rpc.statd
status can be verified using rpcinfo (see above).
The following warning:
indicates that provided wsize
is much
greater than rsize.
which could end up with a
different amount of readahead
RPCs compared to the
amount requested by the user.
mount(2), unmount(2), mount(8), umount(8), nfsstat(1), netstat(1), rpcinfo(8), showmount(8), automount(8), nfs.conf(5), nfs(5)
An NFS server shouldn't loopback-mount its own exported file systems because it's fundamentally prone to deadlock.
February 28, 2010 | Mac OS X 12 |