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