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