]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/nfsd/nfsd.8
Merge OpenSSL 1.0.2p.
[FreeBSD/FreeBSD.git] / usr.sbin / nfsd / nfsd.8
1 .\" Copyright (c) 1989, 1991, 1993
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 .\"     @(#)nfsd.8      8.4 (Berkeley) 3/29/95
29 .\" $FreeBSD$
30 .\"
31 .Dd August 5, 2018
32 .Dt NFSD 8
33 .Os
34 .Sh NAME
35 .Nm nfsd
36 .Nd remote
37 .Tn NFS
38 server
39 .Sh SYNOPSIS
40 .Nm
41 .Op Fl ardute
42 .Op Fl n Ar num_servers
43 .Op Fl h Ar bindip
44 .Op Fl p Ar pnfs_setup
45 .Op Fl m Ar mirror_level
46 .Op Fl Fl maxthreads Ar max_threads
47 .Op Fl Fl minthreads Ar min_threads
48 .Sh DESCRIPTION
49 The
50 .Nm
51 utility runs on a server machine to service
52 .Tn NFS
53 requests from client machines.
54 At least one
55 .Nm
56 must be running for a machine to operate as a server.
57 .Pp
58 Unless otherwise specified, eight servers per CPU for
59 .Tn UDP
60 transport are started.
61 .Pp
62 The following options are available:
63 .Bl -tag -width Ds
64 .It Fl r
65 Register the
66 .Tn NFS
67 service with
68 .Xr rpcbind 8
69 without creating any servers.
70 This option can be used along with the
71 .Fl u
72 or
73 .Fl t
74 options to re-register NFS if the rpcbind server is restarted.
75 .It Fl d
76 Unregister the
77 .Tn NFS
78 service with
79 .Xr rpcbind 8
80 without creating any servers.
81 .It Fl n Ar threads
82 Specifies how many servers to create.  This option is equivalent to specifying
83 .Fl Fl maxthreads
84 and
85 .Fl Fl minthreads
86 with their respective arguments to
87 .Ar threads .
88 .It Fl Fl maxthreads Ar threads
89 Specifies the maximum servers that will be kept around to service requests.
90 .It Fl Fl minthreads Ar threads
91 Specifies the minimum servers that will be kept around to service requests.
92 .It Fl h Ar bindip
93 Specifies which IP address or hostname to bind to on the local host.
94 This option is recommended when a host has multiple interfaces.
95 Multiple
96 .Fl h
97 options may be specified.
98 .It Fl a
99 Specifies that nfsd should bind to the wildcard IP address.
100 This is the default if no
101 .Fl h
102 options are given.
103 It may also be specified in addition to any
104 .Fl h
105 options given.
106 Note that NFS/UDP does not operate properly when
107 bound to the wildcard IP address whether you use -a or do not use -h.
108 .It Fl p Ar pnfs_setup
109 Enables pNFS support in the server and specifies the information that the
110 daemon needs to start it.
111 This option can only be used on one server and specifies that this server
112 will be the MetaData Server (MDS) for the pNFS service.
113 This can only be done if there is at least one FreeBSD system configured
114 as a Data Server (DS) for it to use.
115 .Pp
116 The
117 .Ar pnfs_setup
118 string is a set of fields separated by ',' characters:
119 .Bl -tag -width Ds
120 Each of these fields specifies one DS.
121 It consists of a server hostname, followed by a ':'
122 and the directory path where the DS's data storage file system is mounted on
123 this MDS server.
124 This can optionally be followed by a '#' and the mds_path, which is the
125 directory path for an exported file system on this MDS.
126 If this is specified, it means that this DS is to be used to store data
127 files for this mds_path file system only.
128 If this optional component does not exist, the DS will be used to store data
129 files for all exported MDS file systems.
130 The DS storage file systems must be mounted on this system before the
131 .Nm
132 is started with this option specified.
133 .br
134 For example:
135 .sp
136 nfsv4-data0:/data0,nfsv4-data1:/data1
137 .sp
138 would specify two DS servers called nfsv4-data0 and nfsv4-data1 that comprise
139 the data storage component of the pNFS service.
140 These two DSs would be used to store data files for all exported file systems
141 on this MDS.
142 The directories
143 .Dq /data0
144 and
145 .Dq /data1
146 are where the data storage servers exported
147 storage directories are mounted on this system (which will act as the MDS).
148 .br
149 Whereas, for the example:
150 .sp
151 nfsv4-data0:/data0#/export1,nfsv4-data1:/data1#/export2
152 .sp
153 would specify two DSs as above, however nfsv4-data0 will be used to store
154 data files for
155 .Dq /export1
156 and nfsv4-data1 will be used to store data files for
157 .Dq /export2 .
158 .El
159 .sp
160 When using IPv6 addresses for DSs
161 be wary of using link local addresses.
162 The IPv6 address for the DS is sent to the client and there is no scope
163 zone in it.
164 As such, a link local address may not work for a pNFS client to DS
165 TCP connection.
166 When parsed,
167 .Nm
168 will only use a link local address if it is the only address returned by
169 .Xr getaddrinfo 3
170 for the DS hostname.
171 .It Fl m Ar mirror_level
172 This option is only meaningful when used with the
173 .Fl p
174 option.
175 It specifies the
176 .Dq mirror_level ,
177 which defines how many of the DSs will
178 have a copy of a file's data storage file.
179 The default of one implies no mirroring of data storage files on the DSs.
180 The
181 .Dq mirror_level
182 would normally be set to 2 to enable mirroring, but
183 can be as high as NFSDEV_MAXMIRRORS.
184 There must be at least
185 .Dq mirror_level
186 DSs for each exported file system on the MDS, as specified in the
187 .Fl p
188 option.
189 This implies that, for the above example using "#/export1" and "#/export2",
190 mirroring cannot be done.
191 There would need to be two DS entries for each of "#/export1" and "#/export2"
192 in order to support a
193 .Dq mirror_level
194 of two.
195 .Pp
196 If mirroring is enabled, the server must use the Flexible File
197 layout.
198 If mirroring is not enabled, the server will use the File layout
199 by default, but this default can be changed to the Flexible File layout if the
200 .Xr sysctl 1
201 vfs.nfsd.default_flexfile
202 is set non-zero.
203 .It Fl t
204 Serve
205 .Tn TCP NFS
206 clients.
207 .It Fl u
208 Serve
209 .Tn UDP NFS
210 clients.
211 .It Fl e
212 Ignored; included for backward compatibility.
213 .El
214 .Pp
215 For example,
216 .Dq Li "nfsd -u -t -n 6"
217 serves
218 .Tn UDP
219 and
220 .Tn TCP
221 transports using six daemons.
222 .Pp
223 A server should run enough daemons to handle
224 the maximum level of concurrency from its clients,
225 typically four to six.
226 .Pp
227 The
228 .Nm
229 utility listens for service requests at the port indicated in the
230 .Tn NFS
231 server specification; see
232 .%T "Network File System Protocol Specification" ,
233 RFC1094,
234 .%T "NFS: Network File System Version 3 Protocol Specification" ,
235 RFC1813,
236 .%T "Network File System (NFS) Version 4 Protocol" ,
237 RFC3530 and
238 .%T "Network File System (NFS) Version 4 Minor Version 1 Protocol" ,
239 RFC5661.
240 .Pp
241 If
242 .Nm
243 detects that
244 .Tn NFS
245 is not loaded in the running kernel, it will attempt
246 to load a loadable kernel module containing
247 .Tn NFS
248 support using
249 .Xr kldload 2 .
250 If this fails, or no
251 .Tn NFS
252 KLD is available,
253 .Nm
254 will exit with an error.
255 .Pp
256 If
257 .Nm
258 is to be run on a host with multiple interfaces or interface aliases, use
259 of the
260 .Fl h
261 option is recommended.
262 If you do not use the option NFS may not respond to
263 UDP packets from the same IP address they were sent to.
264 Use of this option
265 is also recommended when securing NFS exports on a firewalling machine such
266 that the NFS sockets can only be accessed by the inside interface.
267 The
268 .Nm ipfw
269 utility
270 would then be used to block nfs-related packets that come in on the outside
271 interface.
272 .Pp
273 If the server has stopped servicing clients and has generated a console message
274 like
275 .Dq Li "nfsd server cache flooded..." ,
276 the value for vfs.nfsd.tcphighwater needs to be increased.
277 This should allow the server to again handle requests without a reboot.
278 Also, you may want to consider decreasing the value for
279 vfs.nfsd.tcpcachetimeo to several minutes (in seconds) instead of 12 hours
280 when this occurs.
281 .Pp
282 Unfortunately making vfs.nfsd.tcphighwater too large can result in the mbuf
283 limit being reached, as indicated by a console message
284 like
285 .Dq Li "kern.ipc.nmbufs limit reached" .
286 If you cannot find values of the above
287 .Nm sysctl
288 values that work, you can disable the DRC cache for TCP by setting
289 vfs.nfsd.cachetcp to 0.
290 .Pp
291 The
292 .Nm
293 utility has to be terminated with
294 .Dv SIGUSR1
295 and cannot be killed with
296 .Dv SIGTERM
297 or
298 .Dv SIGQUIT .
299 The
300 .Nm
301 utility needs to ignore these signals in order to stay alive as long
302 as possible during a shutdown, otherwise loopback mounts will
303 not be able to unmount.
304 If you have to kill
305 .Nm
306 just do a
307 .Dq Li "kill -USR1 <PID of master nfsd>"
308 .Sh EXIT STATUS
309 .Ex -std
310 .Sh SEE ALSO
311 .Xr nfsstat 1 ,
312 .Xr kldload 2 ,
313 .Xr nfssvc 2 ,
314 .Xr nfsv4 4 ,
315 .Xr pnfs 4 ,
316 .Xr pnfsserver 4 ,
317 .Xr exports 5 ,
318 .Xr stablerestart 5 ,
319 .Xr gssd 8 ,
320 .Xr ipfw 8 ,
321 .Xr mountd 8 ,
322 .Xr nfsiod 8 ,
323 .Xr nfsrevoke 8 ,
324 .Xr nfsuserd 8 ,
325 .Xr rpcbind 8
326 .Sh HISTORY
327 The
328 .Nm
329 utility first appeared in
330 .Bx 4.4 .
331 .Sh BUGS
332 If
333 .Nm
334 is started when
335 .Xr gssd 8
336 is not running, it will service AUTH_SYS requests only. To fix the problem
337 you must kill
338 .Nm
339 and then restart it, after the
340 .Xr gssd 8
341 is running.
342 .Pp
343 If mirroring is enabled via the
344 .Fl m
345 option and there are Linux clients doing NFSv4.1 mounts, those clients
346 need to be patched to support the
347 .Dq tightly coupled
348 variant of
349 the Flexible File layout or the
350 .Xr sysctl 1
351 vfs.nfsd.flexlinuxhack
352 must be set to one on the MDS as a workaround.