xref: /openbsd/sbin/mount_nfs/mount_nfs.8 (revision 510d2225)
1.\"	$OpenBSD: mount_nfs.8,v 1.41 2023/11/09 13:47:27 kn Exp $
2.\"	$NetBSD: mount_nfs.8,v 1.3 1996/02/18 11:59:10 fvdl Exp $
3.\"
4.\" Copyright (c) 1992, 1993, 1994, 1995
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"	@(#)mount_nfs.8	8.3 (Berkeley) 3/29/95
32.\"
33.Dd $Mdocdate: November 9 2023 $
34.Dt MOUNT_NFS 8
35.Os
36.Sh NAME
37.Nm mount_nfs
38.Nd mount NFS file systems
39.Sh SYNOPSIS
40.Nm mount_nfs
41.Bk -words
42.Op Fl 23bcdilsTU
43.Op Fl a Ar maxreadahead
44.Op Fl g Ar maxgroups
45.Op Fl I Ar readdirsize
46.Op Fl o Ar options
47.Op Fl R Ar retrycnt
48.Op Fl r Ar readsize
49.Op Fl t Ar timeout
50.Op Fl w Ar writesize
51.Op Fl x Ar retrans
52.Ar rhost : Ns Ar path node
53.Ek
54.Sh DESCRIPTION
55The
56.Nm
57command
58calls the
59.Xr mount 2
60system call to prepare and graft a remote NFS file system (rhost:path)
61on to the file system tree at the point
62.Ar node .
63This command is normally executed by
64.Xr mount 8 .
65It implements the mount protocol as described in RFC 1094, Appendix A and
66.%T "NFS: Network File System Version 3 Protocol Specification" ,
67Appendix I.
68.Pp
69The options are as follows:
70.Bl -tag -width Ds
71.It Fl 2
72Use the NFS Version 2 protocol.
73.It Fl 3
74Use the NFS Version 3 protocol.
75The default is to try version 3 first, and
76fall back to version 2 if the mount fails.
77.It Fl a Ar maxreadahead
78Set the read-ahead count to the specified value.
79This may be in the range of 0\-4, and determines how many blocks
80will be read ahead when a large file is being read sequentially.
81Trying a value greater than 1 for this is suggested for
82mounts with a large bandwidth-delay product.
83.It Fl b
84If an initial attempt to contact the server fails, fork off a child to keep
85trying the mount in the background.
86Useful for
87.Xr fstab 5 ,
88where the file system mount is not critical to multiuser operation.
89.It Fl c
90For UDP mount points, do not do a
91.Xr connect 2 .
92This must be used for servers that do not reply to requests from the
93standard NFS port number 2049.
94It may also be required for servers
95with more than one IP address (only necessary if replies come from
96an address other than the one specified in the mount request).
97.It Fl d
98Turn off the dynamic retransmit timeout estimator.
99This may be useful for UDP mounts that exhibit high retry rates,
100since it is possible that the dynamically estimated timeout interval is too
101short.
102.It Fl g Ar maxgroups
103Set the maximum size of the group list for the credentials to the
104specified value.
105This should be used for mounts on old servers that cannot handle a
106group list size of 16, as specified in RFC 1057.
107Try 8, if users in a lot of groups cannot get a response from the mount
108point.
109.It Fl I Ar readdirsize
110Set the readdir read size to the specified value.
111The value should normally be a multiple of
112.Dv DIRBLKSIZ
113that is less than or equal to the read size for the mount.
114.It Fl i
115Make the mount interruptible, which implies that file system calls that
116are delayed due to an unresponsive server will fail with EINTR when a
117termination signal is posted for the process.
118.It Fl l
119Used with NFSV3 to specify that the
120.Dq readdir plus
121RPC should
122be used.
123This option reduces RPC traffic for cases such as
124.Dq "ls -l" ,
125but tends to flood the attribute and name caches with prefetched entries.
126Try this option and see whether performance improves or degrades.
127Probably
128most useful for client to server network interconnects with a large
129bandwidth-delay product.
130.It Fl o Ar options
131Options are specified with a
132.Fl o
133flag followed by a comma separated string of options.
134The prefix
135.Dq no
136may be added to invert the behavior of default options that do not
137take arguments.
138See the
139.Xr mount 8
140man page for possible options and their meanings.
141.Pp
142The following NFS specific options are also available:
143.Bl -tag -width 15n
144.It Cm ac
145Enable attribute caching for both files and directories (default).
146.It Cm acdirmax Ns = Ns Ar num
147Cache directory attributes for no more than
148.Ar num
149seconds.
150The default is 60 seconds.
151.It Cm acdirmin Ns = Ns Ar num
152Cache directory attributes for at least
153.Ar num
154seconds.
155The default is 5 seconds.
156.It Cm acregmax Ns = Ns Ar num
157Cache file attributes for no more than
158.Ar num
159seconds.
160The default is 60 seconds.
161.It Cm acregmin Ns = Ns Ar num
162Cache file attributes for at least
163.Ar num
164seconds.
165The default is 5 seconds.
166.It Cm port Ns = Ns Ar portnumber
167Use the specified port number for NFS requests.
168The default is to query the portmapper for the NFS port.
169.El
170.It Fl R Ar retrycnt
171Set the retry count for doing the mount to the specified value.
172The default is 10000.
173.It Fl r Ar readsize
174Set the read data size to the specified value.
175It should normally be a power of 2 greater than or equal to 1024.
176This should be used for UDP mounts when the
177.Dq "fragments dropped after timeout"
178value is getting large while actively using a mount point.
179(Use
180.Xr netstat 1
181with the
182.Fl s
183option to see what this
184value is.)
185See the
186.Fl w
187option as well.
188.It Fl s
189A soft mount, which implies that file system calls will fail
190after
191.Ar retrans
192round trip timeout intervals have been reached (see
193.Fl x ) .
194.It Fl T
195Use TCP instead of UDP.
196Note that TCP may not be supported by some very old NFS servers.
197.It Fl t Ar timeout
198Set the initial retransmit timeout to the specified value in milliseconds.
199May be useful for fine tuning UDP mounts over internetworks
200with high packet loss rates or an overloaded server.
201Try increasing the interval if
202.Xr nfsstat 1
203shows high retransmit rates while the file system is active or reducing the
204value if there is a low retransmit rate but long response delay observed.
205(Normally, the
206.Fl d
207option should be specified when using this option to manually
208tune the timeout
209interval.)
210.It Fl U
211Force the mount protocol to use UDP, even for TCP NFS mounts.
212(Necessary for some old
213.Bx
214servers.)
215.It Fl w Ar writesize
216Set the write data size to the specified value.
217Ditto the comments w.r.t. the
218.Fl r
219option, but using the
220.Dq "fragments dropped after timeout"
221value on the server instead of the client.
222Note that both the
223.Fl r
224and
225.Fl w
226options should only be used as a last ditch effort at improving performance
227when mounting servers that do not support TCP mounts.
228.It Fl x Ar retrans
229Set the retransmit timeout count for soft mounts to the specified value.
230Defaults to 10.
231.El
232.Pp
233In versions prior to
234.Ox 2.7 ,
235.Li nfsiod
236daemons were running to improve performance of client NFS I/O.
237This is no longer done this way.
238Use
239.Xr sysctl 8
240or modify
241.Xr sysctl.conf 5
242to adjust the
243.Va vfs.nfs.iothreads
244value, which is the number of kernel threads created
245to serve asynchronous NFS I/O requests.
246.Sh SEE ALSO
247.Xr nfsstat 1 ,
248.Xr mount 2 ,
249.Xr tcp 4 ,
250.Xr udp 4 ,
251.Xr fstab 5 ,
252.Xr mount 8 ,
253.Xr nfsd 8 ,
254.Xr showmount 8 ,
255.Xr sysctl 8 ,
256.Xr umount 8
257.Sh HISTORY
258The
259.Fl P
260flag historically informed the kernel to use a reserved port when
261communicating with clients.
262In
263.Ox ,
264a reserved port is always used.
265.Sh BUGS
266Due to the way that Sun RPC is implemented on top of UDP (unreliable datagram),
267tuning such mounts is really a black art that can only be expected
268to have limited success.
269