xref: /freebsd/sbin/mount_nfs/mount_nfs.8 (revision 38a52bd3b5cac3da6f7f6eef3dd050e6aa08ebb3)
1.\" Copyright (c) 1992, 1993, 1994, 1995
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"	@(#)mount_nfs.8	8.3 (Berkeley) 3/29/95
29.\" $FreeBSD$
30.\"
31.Dd September 24, 2022
32.Dt MOUNT_NFS 8
33.Os
34.Sh NAME
35.Nm mount_nfs
36.Nd mount NFS file systems
37.Sh SYNOPSIS
38.Nm
39.Op Fl 23bcdiLlNPsTU
40.Op Fl a Ar maxreadahead
41.Op Fl D Ar deadthresh
42.Op Fl g Ar maxgroups
43.Op Fl I Ar readdirsize
44.Op Fl o Ar options
45.Op Fl R Ar retrycnt
46.Op Fl r Ar readsize
47.Op Fl t Ar timeout
48.Op Fl w Ar writesize
49.Op Fl x Ar retrans
50.Ar rhost : Ns Ar path node
51.Sh DESCRIPTION
52The
53.Nm
54utility calls the
55.Xr nmount 2
56system call to prepare and graft a remote NFS file system
57.Pq Ar rhost : Ns Ar path
58on to the file system tree at the point
59.Ar node .
60This command is normally executed by
61.Xr mount 8 .
62For NFSv2 and NFSv3,
63it implements the mount protocol as described in RFC 1094, Appendix A and
64RFC 1813, Appendix I.
65For NFSv4, it uses the NFSv4 protocol as described in RFC 7530, RFC 5661 and
66RFC 7862.
67.Pp
68By default,
69.Nm
70keeps retrying until the mount succeeds.
71This behaviour is intended for file systems listed in
72.Xr fstab 5
73that are critical to the boot process.
74For non-critical file systems, the
75.Cm bg
76and
77.Cm retrycnt
78options provide mechanisms to prevent the boot process from hanging
79if the server is unavailable.
80.Pp
81If the server becomes unresponsive while an NFS file system is
82mounted, any new or outstanding file operations on that file system
83will hang uninterruptibly until the server comes back.
84To modify this default behaviour, see the
85.Cm intr
86and
87.Cm soft
88options.
89.Pp
90The options are:
91.Bl -tag -width indent
92.It Fl o
93Options are specified with a
94.Fl o
95flag followed by a comma separated string of options.
96See the
97.Xr mount 8
98man page for possible options and their meanings.
99The following NFS specific options are also available:
100.Bl -tag -width indent
101.It Cm acregmin Ns = Ns Aq Ar seconds
102.It Cm acregmax Ns = Ns Aq Ar seconds
103.It Cm acdirmin Ns = Ns Aq Ar seconds
104.It Cm acdirmax Ns = Ns Aq Ar seconds
105When attributes of files are cached, a timeout calculated to determine
106whether a given cache entry has expired.
107These four values determine the upper and lower bounds of the timeouts for
108.Dq directory
109attributes and
110.Dq regular
111(ie: everything else).
112The default values are 3 -> 60 seconds
113for regular files, and 30 -> 60 seconds for directories.
114The algorithm to calculate the timeout is based on the age of the file.
115The older the file,
116the longer the cache is considered valid, subject to the limits above.
117.It Cm actimeo Ns = Ns Aq Ar seconds
118Set four cache timeouts above to specified value.
119.It Cm allgssname
120This option can be used along with
121.Fl o Cm gssname
122to specify that all operations should use the host-based initiator
123credential.
124This may be used for clients that run system daemons that need to
125access files on the NFSv4 mounted volume.
126.It Cm bg
127If an initial attempt to contact the server fails, fork off a child to keep
128trying the mount in the background.
129Useful for
130.Xr fstab 5 ,
131where the file system mount is not critical to multiuser operation.
132.It Cm bgnow
133Like
134.Cm bg ,
135fork off a child to keep trying the mount in the background,
136but do not attempt to mount in the foreground first.
137This eliminates a
13860+ second timeout when the server is not responding.
139Useful for speeding up the boot process of a client when the server is
140likely to be unavailable.
141This is often the case for interdependent servers
142such as cross-mounted servers (each of two servers is an NFS client of
143the other) and for cluster nodes that must boot before the file servers.
144.It Cm deadthresh Ns = Ns Aq Ar value
145Set the
146.Dq "dead server threshold"
147to the specified number of round trip timeout intervals before a
148.Dq "server not responding"
149message is displayed.
150.It Cm dumbtimer
151Turn off the dynamic retransmit timeout estimator.
152This may be useful for UDP mounts that exhibit high retry rates,
153since it is possible that the dynamically estimated timeout interval is too
154short.
155.It Cm fg
156Same as not specifying
157.Cm bg .
158.It Cm gssname Ns = Ns Aq Ar service-principal-name
159This option can be used with the KerberosV security flavors for NFSv4 mounts
160to specify the
161.Dq "service-principal-name"
162of a host-based entry in the default
163keytab file that is used for system operations.
164It allows the mount to be performed by
165.Dq "root"
166and avoids problems with
167cached credentials for the system operations expiring.
168The
169.Dq "service-prinicpal-name"
170should be specified without instance or domain and is typically
171.Dq "host" ,
172.Dq "nfs"
173or
174.Dq "root" ,
175although the form
176.Sm off
177.Aq Ar service
178@
179.Aq Ar fqdn
180.Sm on
181can also be used if the local system's
182.Xr gethostname 3
183value does not match the host-based principal in the keytab.
184.It Cm hard
185Same as not specifying
186.Cm soft .
187.It Cm intr
188Make the mount interruptible, which implies that file system calls that
189are delayed due to an unresponsive server will fail with EINTR when a
190termination signal is posted for the process.
191To avoid leaving file locks in an indeterminate state on the NFS
192server, it is recommended that the
193.Cm nolockd
194option be used with this option.
195.It Cm maxgroups Ns = Ns Aq Ar value
196Set the maximum size of the group list for the credentials to the
197specified value.
198This should be used for mounts on old servers that cannot handle a
199group list size of 16, as specified in RFC 1057.
200Try 8, if users in a lot of groups cannot get response from the mount
201point.
202.It Cm mntudp
203Force the mount protocol to use UDP transport, even for TCP NFS mounts.
204(Necessary for some old
205.Bx
206servers.)
207.It Cm nametimeo Ns = Ns Aq Ar value
208Override the default of NFS_DEFAULT_NAMETIMEO for the timeout (in seconds)
209for positive name cache entries.
210If this is set to 0 it disables positive name caching for the mount point.
211.It Cm negnametimeo Ns = Ns Aq Ar value
212Override the default of NFS_DEFAULT_NEGNAMETIMEO for the timeout (in seconds)
213for negative name cache entries.
214If this is set to 0 it disables negative name caching for the mount point.
215.It Cm nconnect Ns = Ns Aq Ar value
216Specify the number of TCP connections (1-16) to be used
217for an NFS Version 4, minor version 1 or 2 mount.
218Multiple TCP connections can provide more client to server network
219bandwidth for certain network configurations such as:
220.Bd -literal
221- Multiple network interfaces that are aggregated together.
222- A fast network interface that uses multiple queues.
223.Ed
224.sp
225The first TCP connection will be used for all RPCs that consist
226entirely of small RPC messages.
227The RPCs that can have large RPC messages (Read/Readdir/Write) are
228distributed over the additional TCP connections in a round robin
229fashion.
230This option will result in more IP port#s being used.
231This option requires the
232.Cm nfsv4
233option.
234.It Cm nfsv2
235Use the NFS Version 2 protocol (the default is to try version 3 first
236then version 2).
237Note that NFS version 2 has a file size limit of 2 gigabytes.
238.It Cm nfsv3
239Use the NFS Version 3 protocol.
240.It Cm nfsv4
241Use the NFS Version 4 protocol.
242This option will force the mount to use
243TCP transport.
244By default, the highest minor version of NFS Version 4 that is
245supported by the NFS Version 4 server will be used.
246See the
247.Cm minorversion
248option.
249Make sure that all your NFS Version 4 clients have unique
250values in
251.Pa /etc/hostid .
252.It Cm minorversion Ns = Ns Aq Ar value
253Use the specified minor version for a NFS Version 4 mount,
254overriding the default.
255The minor versions supported are 0, 1, and 2.
256This option is only meaningful when used with the
257.Cm nfsv4
258option.
259.It Cm oneopenown
260Make a minor version 1 or 2 of the NFS Version 4 protocol mount use a single
261OpenOwner for all Opens.
262This may be useful for a server with a very low limit on OpenOwners, such as
263AmazonEFS.
264It may be required when an accumulation of NFS version 4 Opens occurs,
265as indicated by the
266.Dq Opens
267count displayed by
268.Xr nfsstat 1
269with the
270.Fl c
271and
272.Fl E
273command-line options.
274A common case for an accumulation of Opens is a shared library within
275the NFS mount that is used by several
276processes, where at least one of these processes is always running.
277This option cannot be used for an NFS Version 4, minor version 0 mount.
278It may not work correctly when Delegations are being issued by a server,
279but note that the AmazonEFS server does not issued delegations at this time.
280This option is only meaningful when used with the
281.Cm nfsv4
282option.
283.It Cm pnfs
284Enable support for parallel NFS (pNFS) for minor version 1 or 2 of the
285NFS Version 4 protocol.
286This option is only meaningful when used with the
287.Cm nfsv4
288option.
289.It Cm noac
290Disable attribute caching.
291.It Cm noconn
292For UDP mount points, do not do a
293.Xr connect 2 .
294This must be used if the server does not reply to requests from the standard
295NFS port number 2049 or replies to requests using a different IP address
296(which can occur if the server is multi-homed).
297Setting the
298.Va vfs.nfs.nfs_ip_paranoia
299sysctl to 0 will make this option the default.
300.It Cm nocto
301Normally, NFS clients maintain the close-to-open cache coherency.
302This works by flushing at close time and checking at open time.
303Checking at open time is implemented by getting attributes from
304the server and purging the data cache if they do not match
305attributes cached by the client.
306.Pp
307This option disables checking at open time.
308It may improve performance for read-only mounts,
309but should only be used if the data on the server changes rarely.
310Be sure to understand the consequences before enabling this option.
311.It Cm noinet4 , noinet6
312Disables
313.Dv AF_INET
314or
315.Dv AF_INET6
316connections.
317Useful for hosts that have
318both an A record and an AAAA record for the same name.
319.It Cm nolockd
320Do
321.Em not
322forward
323.Xr fcntl 2
324locks over the wire via the NLM protocol for NFSv3 mounts
325or via the NFSv4 protocol for NFSv4 mounts.
326All locks will be local and not seen by the server
327and likewise not seen by other NFS clients for NFSv3 or NFSv4 mounts.
328This removes the need to run the
329.Xr rpcbind 8
330service and the
331.Xr rpc.statd 8
332and
333.Xr rpc.lockd 8
334servers on the client for NFSv3 mounts.
335Note that this option will only be honored when performing the
336initial mount, it will be silently ignored if used while updating
337the mount options.
338Also, note that NFSv4 mounts do not use these daemons.
339The NFSv4 protocol handles locks,
340unless this option is specified.
341.It Cm noncontigwr
342This mount option allows the NFS client to
343combine non-contiguous byte ranges being written
344such that the dirty byte range becomes a superset of the bytes
345that are dirty.
346This reduces the number of writes significantly for software
347builds.
348The merging of byte ranges is not done if the file has been file
349locked, since most applications modifying a file from multiple
350clients will use file locking.
351As such, this option could result in a corrupted file for the
352rare case of an application modifying the file from multiple
353clients concurrently without using file locking.
354.It Cm principal
355For the RPCSEC_GSS security flavors, such as krb5, krb5i and krb5p,
356this option sets the name of the host based principal name expected
357by the server.
358This option overrides the default, which will be ``nfs@<server-fqdn>''
359and should normally be sufficient.
360.It Cm noresvport
361Do
362.Em not
363use a reserved socket port number (see below).
364.It Cm port Ns = Ns Aq Ar port_number
365Use specified port number for NFS requests.
366The default is to query the portmapper for the NFS port.
367.It Cm proto Ns = Ns Aq Ar protocol
368Specify transport protocol version to use.
369Currently, they are:
370.Bd -literal
371udp -   Use UDP over IPv4
372tcp -   Use TCP over IPv4
373udp6 -  Use UDP over IPv6
374tcp6 -  Use TCP over IPv6
375.Ed
376.It Cm rdirplus
377Used with NFSV3 to specify that the \fBReaddirPlus\fR RPC should
378be used.
379For NFSV4, setting this option has a similar effect, in that it will make
380the Readdir Operation get more attributes.
381This option reduces RPC traffic for cases such as
382.Dq "ls -l" ,
383but tends to flood the attribute and name caches with prefetched entries.
384Try this option and see whether performance improves or degrades.
385Probably
386most useful for client to server network interconnects with a large bandwidth
387times delay product.
388.It Cm readahead Ns = Ns Aq Ar value
389Set the read-ahead count to the specified value.
390This may be in the range of 0 - 4, and determines how many blocks
391will be read ahead when a large file is being read sequentially.
392Trying a value greater than 1 for this is suggested for
393mounts with a large bandwidth * delay product.
394.It Cm readdirsize Ns = Ns Aq Ar value
395Set the readdir read size to the specified value.
396The value should normally
397be a multiple of
398.Dv DIRBLKSIZ
399that is <= the read size for the mount.
400.It Cm resvport
401Use a reserved socket port number.
402This flag is obsolete, and only retained for compatibility reasons.
403Reserved port numbers are used by default now.
404(For the rare case where the client has a trusted root account
405but untrustworthy users and the network cables are in secure areas this does
406help, but for normal desktop clients this does not apply.)
407.It Cm retrans Ns = Ns Aq Ar value
408Set the retransmit timeout count for soft mounts to the specified value.
409.It Cm retrycnt Ns = Ns Aq Ar count
410Set the mount retry count to the specified value.
411The default is a retry count of zero, which means to keep retrying
412forever.
413There is a 60 second delay between each attempt.
414.It Cm rsize Ns = Ns Aq Ar value
415Set the read data size to the specified value.
416It should normally be a power of 2 greater than or equal to 1024.
417This should be used for UDP mounts when the
418.Dq "fragments dropped due to timeout"
419value is getting large while actively using a mount point.
420(Use
421.Xr netstat 1
422with the
423.Fl s
424option to see what the
425.Dq "fragments dropped due to timeout"
426value is.)
427.It Cm sec Ns = Ns Aq Ar flavor
428This option specifies what security flavor should be used for the mount.
429Currently, they are:
430.Bd -literal
431krb5 -  Use KerberosV authentication
432krb5i - Use KerberosV authentication and
433        apply integrity checksums to RPCs
434krb5p - Use KerberosV authentication and
435        encrypt the RPC data
436sys -   The default AUTH_SYS, which uses a
437        uid + gid list authenticator
438.Ed
439.It Cm soft
440A soft mount, which implies that file system calls will fail
441after
442.Ar retrycnt
443round trip timeout intervals.
444.It Cm tcp
445Use TCP transport.
446This is the default option, as it provides for increased reliability on both
447LAN and WAN configurations compared to UDP.
448Some old NFS servers do not support this method; UDP mounts may be required
449for interoperability.
450.It Cm timeout Ns = Ns Aq Ar value
451Set the initial retransmit timeout to the specified value,
452expressed in tenths of a second.
453May be useful for fine tuning UDP mounts over internetworks
454with high packet loss rates or an overloaded server.
455Try increasing the interval if
456.Xr nfsstat 1
457shows high retransmit rates while the file system is active or reducing the
458value if there is a low retransmit rate but long response delay observed.
459(Normally, the
460.Cm dumbtimer
461option should be specified when using this option to manually
462tune the timeout
463interval.)
464.It Cm timeo Ns = Ns Aq Ar value
465Alias for
466.Cm timeout .
467.It Cm tls
468This option specifies that the connection to the server must use TLS
469per RFC 9289.
470TLS is only supported for TCP connections and the
471.Xr rpc.tlsclntd 8
472daemon must be running for an NFS over TCP connection to use TLS.
473.It Cm tlscertname Ns = Ns Aq Ar name
474This option specifies the name of an alternate certificate to be
475presented to the NFS server during TLS handshake.
476The default certificate file names are
477.Dq cert.pem
478and
479.Dq certkey.pem .
480When this option is specified,
481.Ar name
482replaces
483.Dq cert
484in the above file names.
485For example, if the value of
486.Ar name
487is specified as
488.Dq other
489the certificate file names to be used will be
490.Dq other.pem
491and
492.Dq otherkey.pem .
493These files are stored in
494.Pa /etc/rpc.tlsclntd
495by default.
496This option is only meaningful when used with the
497.Cm tls
498option and the
499.Xr rpc.tlsclntd 8
500is running with the
501.Fl m
502command line flag set.
503.It Cm udp
504Use UDP transport.
505.It Cm vers Ns = Ns Aq Ar vers_number
506Use the specified version number for NFS requests.
507See the
508.Cm nfsv2 ,
509.Cm nfsv3 ,
510and
511.Cm nfsv4
512options for details.
513.It Cm wcommitsize Ns = Ns Aq Ar value
514Set the maximum pending write commit size to the specified value.
515This determines the maximum amount of pending write data that the NFS
516client is willing to cache for each file.
517.It Cm wsize Ns = Ns Aq Ar value
518Set the write data size to the specified value.
519Ditto the comments w.r.t.\& the
520.Cm rsize
521option, but using the
522.Dq "fragments dropped due to timeout"
523value on the server instead of the client.
524Note that both the
525.Cm rsize
526and
527.Cm wsize
528options should only be used as a last ditch effort at improving performance
529when mounting servers that do not support TCP mounts.
530.El
531.El
532.Sh COMPATIBILITY
533The following command line flags are equivalent to
534.Fl o
535named options and are supported for compatibility with older
536installations.
537.Bl -tag -width indent
538.It Fl 2
539Same as
540.Fl o Cm nfsv2
541.It Fl 3
542Same as
543.Fl o Cm nfsv3
544.It Fl D
545Same as
546.Fl o Cm deadthresh
547.It Fl I
548Same as
549.Fl o Cm readdirsize Ns = Ns Aq Ar value
550.It Fl L
551Same as
552.Fl o Cm nolockd
553.It Fl N
554Same as
555.Fl o Cm noresvport
556.It Fl P
557Use a reserved socket port number.
558This flag is obsolete, and only retained for compatibility reasons.
559(For the rare case where the client has a trusted root account
560but untrustworthy users and the network cables are in secure areas this does
561help, but for normal desktop clients this does not apply.)
562.It Fl R
563Same as
564.Fl o Cm retrycnt Ns = Ns Aq Ar value
565.It Fl T
566Same as
567.Fl o Cm tcp
568.It Fl U
569Same as
570.Fl o Cm mntudp
571.It Fl a
572Same as
573.Fl o Cm readahead Ns = Ns Aq Ar value
574.It Fl b
575Same as
576.Fl o Cm bg
577.It Fl c
578Same as
579.Fl o Cm noconn
580.It Fl d
581Same as
582.Fl o Cm dumbtimer
583.It Fl g
584Same as
585.Fl o Cm maxgroups
586.It Fl i
587Same as
588.Fl o Cm intr
589.It Fl l
590Same as
591.Fl o Cm rdirplus
592.It Fl r
593Same as
594.Fl o Cm rsize Ns = Ns Aq Ar value
595.It Fl s
596Same as
597.Fl o Cm soft
598.It Fl t
599Same as
600.Fl o Cm retransmit Ns = Ns Aq Ar value
601.It Fl w
602Same as
603.Fl o Cm wsize Ns = Ns Aq Ar value
604.It Fl x
605Same as
606.Fl o Cm retrans Ns = Ns Aq Ar value
607.El
608.Pp
609The following
610.Fl o
611named options are equivalent to other
612.Fl o
613named options and are supported for compatibility with other
614operating systems (e.g., Linux, Solaris, and OSX) to ease usage of
615.Xr autofs 5
616support.
617.Bl -tag -width indent
618.It Fl o Cm vers Ns = Ns 2
619Same as
620.Fl o Cm nfsv2
621.It Fl o Cm vers Ns = Ns 3
622Same as
623.Fl o Cm nfsv3
624.It Fl o Cm vers Ns = Ns 4
625Same as
626.Fl o Cm nfsv4
627.El
628.Sh IMPLEMENTATION NOTES
629When neither the
630.Cm rsize
631nor
632.Cm wsize
633options are specified, the I/O size will be set to the largest value
634supported by both the NFS client and server.
635The largest value supported by the NFS client is defined by
636the tunable
637.Cd vfs.maxbcachebuf
638which can be set to a power of two up to
639.Cd kern.maxphys .
640.Pp
641The
642.Xr nfsstat 1
643command with the
644.Ic -m
645command line option will show what
646.Nm
647option settings are actually in use for the mount.
648.Sh SEE ALSO
649.Xr nfsstat 1 ,
650.Xr nmount 2 ,
651.Xr unmount 2 ,
652.Xr lagg 4 ,
653.Xr nfsv4 4 ,
654.Xr fstab 5 ,
655.Xr gssd 8 ,
656.Xr mount 8 ,
657.Xr nfsd 8 ,
658.Xr nfsiod 8 ,
659.Xr rpc.tlsclntd 8 ,
660.Xr showmount 8
661.Sh HISTORY
662A version of the
663.Nm
664utility appeared in
665.Bx 4.4 .
666.Sh BUGS
667Since NFSv4 performs open/lock operations that have their ordering strictly
668enforced by the server, the options
669.Cm intr
670and
671.Cm soft
672cannot be safely used.
673For NFSv4 minor version 1 or 2 mounts, the ordering is done
674via session slots and the NFSv4 client now handles broken session slots
675fairly well.
676As such, if the
677.Cm nolockd
678option is used along with
679.Cm intr
680and/or
681.Cm soft ,
682an NFSv4 minor version 1 or 2 mount
683should work fairly well, although still not completely correctly.
684For NFSv4 minor version 0 mounts,
685.Cm hard
686mounts without the
687.Cm intr
688mount option is strongly recommended.
689