]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/mount/nfs.man
bc1a6c6aefadbba3c33707445486b8851972ba4f
[nfs-utils.git] / utils / mount / nfs.man
1 .\"@(#)nfs.5"
2 .TH NFS 5 "2 November 2007"
3 .SH NAME
4 nfs \- fstab format and options for the
5 .B nfs
6 and
7 .B nfs4
8 file systems
9 .SH SYNOPSIS
10 .I /etc/fstab
11 .SH DESCRIPTION
12 NFS is an Internet Standard protocol
13 created by Sun Microsystems in 1984. NFS was developed
14 to allow file sharing between systems residing
15 on a local area network.
16 The Linux NFS client supports three versions
17 of the NFS protocol:
18 NFS version 2 [RFC1094],
19 NFS version 3 [RFC1813],
20 and NFS version 4 [RFC3530].
21 .P
22 The
23 .BR mount (8)
24 command attaches a file system to the system's
25 name space hierarchy at a given mount point.
26 The
27 .I /etc/fstab
28 file describes how
29 .BR mount (8)
30 should assemble a system's file name hierarchy
31 from various independent file systems 
32 (including file systems exported by NFS servers).
33 Each line in the
34 .I /etc/fstab
35 file describes a single file system, its mount point,
36 and a set of default mount options for that mount point.
37 .P
38 For NFS file system mounts, a line in the
39 .I /etc/fstab
40 file specifies the server name,
41 the path name of the exported server directory to mount,
42 the local directory that is the mount point,
43 the type of file system that is being mounted,
44 and a list of mount options that control
45 the way the filesystem is mounted and
46 how the NFS client behaves when accessing
47 files on this mount point.
48 The fifth and sixth fields on each line are not used
49 by NFS, thus conventionally each contain the digit zero. For example:
50 .P
51 .SP
52 .NF
53 .TA 2.5i +0.75i +0.75i +1.0i
54         server:path     /mountpoint     fstype  option,option,...       0 0
55 .FI
56 .P
57 The server's hostname and export pathname
58 are separated by a colon, while
59 the mount options are separated by commas. The remaining fields 
60 are separated by blanks or tabs.
61 The server's hostname can be an unqualified hostname,
62 a fully qualified domain name,
63 or a dotted quad IPv4 address.
64 The
65 .I fstype
66 field contains either "nfs" (for version 2 or version 3 NFS mounts)
67 or "nfs4" (for NFS version 4 mounts).
68 The
69 .B nfs
70 and
71 .B nfs4
72 file system types share similar mount options,
73 which are described below. 
74 .SH "MOUNT OPTIONS"
75 Refer to 
76 .BR mount (8)
77 for a description of generic mount options
78 available for all file systems. If you do not need to 
79 specify any mount options, use the generic option 
80 .B defaults
81 in
82 .IR /etc/fstab .
83
84 .DT
85 .SS "Valid options for either the nfs or nfs4 file system type"
86 These options are valid to use when mounting either
87 .B nfs
88 or
89 .B nfs4
90 file system types.
91 They imply the same behavior
92 and have the same default for both file system types.
93 .TP 1.5i
94 .BR soft " / " hard
95 Determines the recovery behavior of the NFS client
96 after an NFS request times out.
97 If neither option is specified (or if the
98 .B hard
99 option is specified), NFS requests are retried indefinitely.
100 If the
101 .B soft
102 option is specified, then the NFS client fails an NFS request
103 after 
104 .B retrans
105 retransmissions have been sent,
106 causing the NFS client to return an error
107 to the calling application.
108 .IP
109 .I NB:
110 A so-called "soft" timeout can cause
111 silent data corruption in certain cases. As such, use the
112 .B soft
113 option only when client responsiveness
114 is more important than data integrity.
115 Using NFS over TCP or increasing the value of the
116 .B retrans
117 option may mitigate some of the risks of using the
118 .B soft
119 option.
120 .TP 1.5i
121 .BI timeo= n
122 The time (in tenths of a second) the NFS client waits for a 
123 response before it retries an NFS request. If this 
124 option is not specified, requests are retried after 
125 60 seconds for NFS over TCP, and are retried after 7/10 of a second for
126 NFS over UDP.
127 .IP
128 For NFS over TCP, the client uses a fixed timeout, as specified by the
129 .B timeo
130 option. However, for NFS over UDP, the client uses an adaptive
131 algorithm to estimate an appropriate timeout value for frequently used
132 request types (such as READ and WRITE requests), but uses the 
133 .B timeo
134 setting for infrequently used request types (such as FSINFO requests).
135 After each retransmission, the NFS client doubles the timeout for that
136 request, up to a maximum timeout length of 60 seconds.
137 .TP 1.5i
138 .BI retrans= n
139 The number of times the NFS client retries a request before
140 it attempts further recovery action. If the 
141 .B retrans
142 option is not specified, the NFS client retries each request 
143 three times.
144 .IP
145 The NFS client generates a "server not responding" message
146 after 
147 .B retrans
148 retries, then attempts further recovery (depending on whether the
149 .B hard
150 mount option is in effect).
151 .TP 1.5i
152 .BI rsize= n
153 The maximum number of bytes in each network READ request
154 that the NFS client can receive when reading data from a file
155 on an NFS server.
156 The actual data payload size of each NFS READ request is equal to
157 or smaller than the
158 .B rsize
159 setting. The largest read payload supported by the Linux NFS client
160 is 1,048,576 bytes (one megabyte).
161 .IP
162 The
163 .B rsize
164 value is a positive integral multiple of 1024.
165 Specified 
166 .B rsize
167 values lower than 1024 are replaced with 4096; values larger than
168 1048576 are replaced with 1048576. If a specified value is within the supported
169 range but not a multiple of 1024, it is rounded down to the nearest 
170 multiple of 1024.
171 .IP
172 If an
173 .B rsize
174 value is not specified, or if the specified 
175 .B rsize 
176 value is larger than the maximum that either client or server can support,
177 the client and server negotiate the largest
178 .B rsize
179 value that they can both support. 
180 .IP
181 The
182 .B rsize
183 mount option as specified on the
184 .BR mount (8)
185 command line appears in the
186 .I /etc/mtab
187 file. However, the effective
188 .B rsize
189 value negotiated by the client and server is reported in the
190 .I /proc/mounts
191 file.
192 .TP 1.5i
193 .BI wsize= n
194 The maximum number of bytes per network WRITE request
195 that the NFS client can send when writing data to a file
196 on an NFS server. The actual data payload size of each 
197 NFS WRITE request is equal to
198 or smaller than the
199 .B wsize
200 setting. The largest write payload supported by the Linux NFS client
201 is 1,048,576 bytes (one megabyte).
202 .IP
203 Similar to
204 .B rsize
205 , the
206 .B wsize 
207 value is a positive integral multiple of 1024.
208 Specified 
209 .B wsize
210 values lower than 1024 are replaced with 4096; values larger than
211 1048576 are replaced with 1048576. If a specified value is within the supported
212 range but not a multiple of 1024, it is rounded down to the nearest 
213 multiple of 1024.
214 .IP
215 If a
216 .B wsize
217 value is not specified, or if the specified 
218 .B wsize 
219 value is larger than the maximum that either client or server can support,
220 the client and server negotiate the largest
221 .B wsize
222 value that they can both support.
223 .IP
224 The
225 .B wsize
226 mount option as specified on the
227 .BR mount (8)
228 command line appears in the
229 .I /etc/mtab
230 file. However, the effective
231 .B wsize
232 value negotiated by the client and server is reported in the
233 .I /proc/mounts
234 file. 
235 .TP 1.5i
236 .BR ac " / " noac
237 Selects whether the client may cache file attributes. If neither  
238 option is specified (or if 
239 .B ac
240 is specified), the client caches file  
241 attributes.  
242 .IP
243 To improve performance, NFS clients cache file  
244 attributes. Every few seconds, an NFS client checks the server's version of each  
245 file's attributes for updates.  Changes that occur on the server in  
246 those small intervals remain undetected until the client checks the  
247 server again. The 
248 .B noac
249 option prevents clients from caching file  
250 attributes so that applications can more quickly detect file changes  
251 on the server.
252 .IP
253 In addition to preventing the client from caching file attributes,  
254 the 
255 .B noac
256 option forces application writes to become synchronous so  
257 that local changes to a file become visible on the server  
258 immediately.  That way, other clients can quickly detect recent  
259 writes when they check the file's attributes.
260 .IP
261 Using the
262 .B noac
263 option provides greater cache coherence among NFS clients
264 accessing the same files,
265 but it extracts a significant performance penalty.
266 As such, judicious use of file locking is encouraged instead.
267 The DATA AND METADATA COHERENCE section contains a detailed discussion
268 of these trade-offs.
269 .TP 1.5i
270 .BI acregmin= n
271 The minimum time (in seconds) that the NFS client caches
272 attributes of a regular file before it requests
273 fresh attribute information from a server.
274 If this option is not specified, the NFS client uses
275 a 3-second minimum.
276 .TP 1.5i
277 .BI acregmax= n
278 The maximum time (in seconds) that the NFS client caches
279 attributes of a regular file before it requests
280 fresh attribute information from a server.
281 If this option is not specified, the NFS client uses
282 a 60-second maximum.
283 .TP 1.5i
284 .BI acdirmin= n
285 The minimum time (in seconds) that the NFS client caches
286 attributes of a directory before it requests
287 fresh attribute information from a server.
288 If this option is not specified, the NFS client uses
289 a 30-second minimum.
290 .TP 1.5i
291 .BI acdirmax= n
292 The maximum time (in seconds) that the NFS client caches
293 attributes of a directory before it requests
294 fresh attribute information from a server.
295 If this option is not specified, the NFS client uses
296 a 60-second maximum.
297 .TP 1.5i
298 .BI actimeo= n
299 Using
300 .B actimeo
301 sets all of
302 .BR acregmin ,
303 .BR acregmax ,
304 .BR acdirmin ,
305 and
306 .B acdirmax
307 to the same value.
308 If this option is not specified, the NFS client uses
309 the defaults for each of these options listed above.
310 .TP 1.5i
311 .BR bg " / " fg
312 Determines how the
313 .BR mount (8)
314 command behaves if an attempt to mount an export fails.
315 The
316 .B fg
317 option causes
318 .BR mount (8)
319 to exit with an error status if any part of the mount request
320 times out or fails outright.
321 This is called a "foreground" mount,
322 and is the default behavior if neither the
323 .B fg
324 nor
325 .B bg
326 mount option is specified.
327 .IP
328 If the
329 .B bg
330 option is specified, a timeout or failure causes the
331 .BR mount (8)
332 command to fork a child which continues to attempt
333 to mount the export.
334 The parent immediately returns with a zero exit code.
335 This is known as a "background" mount.
336 .IP
337 If the local mount point directory is missing, the
338 .BR mount (8)
339 command acts as if the mount request timed out.
340 This permits nested NFS mounts specified in
341 .I /etc/fstab
342 to proceed in any order during system initialization,
343 even if some NFS servers are not yet available.
344 Alternatively these issues can be addressed
345 using an automounter (refer to
346 .BR automount (8)
347 for details).
348 .TP 1.5i
349 .BI retry= n
350 The number of minutes that the
351 .BR mount (8)
352 command retries an NFS mount operation
353 in the foreground or background before giving up.
354 If this option is not specified, the default value for foreground mounts
355 is 2 minutes, and the default value for background mounts is 10000 minutes (80 minutes shy of one week).
356 .TP 1.5i
357 .BI sec= mode
358 The RPCGSS security flavor to use for accessing files on this mount point.
359 If the
360 .B sec
361 option is not specified, or if
362 .B sec=sys
363 is specified, the NFS client uses the AUTH_SYS security flavor
364 for all NFS requests on this mount point.
365 Valid security flavors are
366 .BR none ,
367 .BR sys ,
368 .BR krb5 ,
369 .BR krb5i ,
370 .BR krb5p ,
371 .BR lkey ,
372 .BR lkeyi ,
373 .BR lkeyp ,
374 .BR spkm ,
375 .BR spkmi ,
376 and
377 .BR spkmp .
378 Refer to the SECURITY CONSIDERATIONS section for details.
379 .TP 1.5i
380 .BR sharecache " / " nosharecache
381 Determines how the client's data cache and attribute cache are shared
382 when mounting the same export more than once concurrently.  Using the  
383 same cache reduces memory requirements on the client and presents  
384 identical file contents to applications when the same remote file is  
385 accessed via different mount points.
386 .IP
387 If neither option is specified, or if the 
388 .B sharecache
389 option is  
390 specified, then a single cache is used for all mount points that  
391 access the same export.  If the 
392 .B nosharecache
393 option is specified,  
394 then that mount point gets a unique cache.  Note that when data and  
395 attribute caches are shared, the mount options from the first mount  
396 point take effect for subsequent concurrent mounts of the same export.
397 .IP
398 As of kernel 2.6.18, the behavior specified by
399 .B nosharecache
400 is legacy caching behavior. This
401 is considered a data risk since multiple cached copies
402 of the same file on the same client can become out of sync
403 following a local update of one of the copies.
404 .SS "Valid options for the nfs file system type"
405 Use these options, along with the options in the above subsection,
406 for mounting the
407 .B nfs
408 file system type.
409 .TP 1.5i
410 .BI proto= netid
411 The transport protocol used by the NFS client
412 to transmit requests to the NFS server for this mount point.
413 .I netid
414 can be either
415 .B udp
416 or
417 .BR tcp .
418 Each transport protocol uses different default
419 .B retrans
420 and
421 .B timeo
422 settings; refer to the description of these two mount options for details.
423 .IP
424 In addition to controlling how the NFS client transmits requests to
425 the server, this mount option also controls how the
426 .BR mount (8)
427 command communicates with the server's rpcbind and mountd services.
428 Specifying 
429 .B proto=tcp
430 forces all traffic from the 
431 .BR mount (8)
432 command and the NFS client to use TCP.
433 Specifying
434 .B proto=udp
435 forces all traffic types to use UDP.
436 .IP
437 If the
438 .B proto
439 mount option is not specified, the
440 .BR mount (8)
441 command discovers which protocols the server supports
442 and chooses an appropriate transport for each service.
443 Refer to the TRANSPORT METHODS section for more details.
444 .TP 1.5i
445 .B udp
446 The
447 .B udp
448 option is an alternative to specifying
449 .BR proto=udp.
450 It is included for compatibility with other operating systems.
451 .TP 1.5i
452 .B tcp
453 The
454 .B tcp
455 option is an alternative to specifying
456 .BR proto=tcp.
457 It is included for compatibility with other operating systems.
458 .TP 1.5i
459 .BI port= n
460 The numeric value of the server's NFS service port.
461 If the server's NFS service is not available on the specified port,
462 the mount request fails.
463 .IP
464 If this option is not specified, or if the specified port value is 0,
465 then the NFS client uses the NFS service port number
466 advertised by the server's rpcbind service.
467 The mount request fails if the server's rpcbind service is not available,
468 the server's NFS service is not registered with its rpcbind service,
469 or the server's NFS service is not available on the advertised port.
470 .TP 1.5i
471 .BI mountport= n
472 The numeric value of the server's mountd port.
473 If the server's mountd service is not available on the specified port,
474 the mount request fails.
475 .IP
476 If this option is not specified,
477 or if the specified port value is 0, then the
478 .BR mount (8)
479 command uses the mountd service port number
480 advertised by the server's rpcbind service.
481 The mount request fails if the server's rpcbind service is not available,
482 the server's mountd service is not registered with its rpcbind service,
483 or the server's mountd service is not available on the advertised port.
484 .IP
485 This option can be used when mounting an NFS server
486 through a firewall that blocks the rpcbind protocol.
487 .TP 1.5i
488 .BI mounthost= name
489 The hostname of the host running mountd.
490 If this option is not specified, the
491 .BR mount (8)
492 command assumes that the mountd service runs
493 on the same host as the NFS service.
494 .TP 1.5i
495 .BI mountvers= n
496 The RPC version number used to contact the server's mountd.
497 If this option is not specified, the client uses a version number
498 appropriate to the requested NFS version.
499 This option is useful when multiple NFS services
500 are running on the same remote server host.
501 .TP 1.5i
502 .BI namlen= n
503 The maximum length of a pathname component on this mount.
504 If this option is not specified, the maximum length is negotiated
505 with the server. In most cases, this maximum length is 255 characters.
506 .IP
507 Some early versions of NFS did not support this negotiation.
508 Using this option ensures that
509 .BR pathconf (3)
510 reports the proper maximum component length to applications
511 in such cases.
512 .TP 1.5i
513 .BI nfsvers= n
514 The NFS protocol version number used to contact the server's NFS service.
515 The Linux client supports version 2 and version 3 of the NFS protocol
516 when using the file system type
517 .BR nfs .
518 If the server does not support the requested version,
519 the mount request fails.
520 If this option is not specified, the client attempts to use version 3,
521 but negotiates the NFS version with the server if version 3 support
522 is not available.
523 .TP 1.5i
524 .BI vers= n
525 This option is an alternative to the
526 .B nfsvers
527 option.
528 It is included for compatibility with other operating systems.
529 .TP 1.5i
530 .BR lock " / " nolock
531 Selects whether to use the NLM sideband protocol to lock files on the server.
532 If neither option is specified (or if 
533 .B lock 
534 is specified), NLM locking is used for this mount point. 
535 When using the
536 .B nolock
537 option, applications can lock files,
538 but such locks provide exclusion only against other applications
539 running on the same client.
540 Remote applications are not affected by these locks.
541 .IP
542 NLM locking must be disabled with the
543 .B nolock
544 option when using NFS to mount
545 .I /var
546 because
547 .I /var
548 contains files used by the NLM implementation on Linux.
549 Using the
550 .B nolock
551 option is also required when mounting exports on NFS servers
552 that do not support the NLM protocol.
553 .TP 1.5i
554 .BR intr " / " nointr
555 Selects whether to allow signals to interrupt file operations
556 on this mount point. If neither option 
557 is specified (or if 
558 .B nointr
559 is specified),
560 signals do not interrupt NFS file operations. If
561 .B intr 
562 is specified, system calls return EINTR if an in-progress NFS operation is interrupted by 
563 a signal.
564 .IP
565 Using the
566 .B intr
567 option is preferred to using the
568 .B soft
569 option because it is significantly less likely to result in data corruption.
570 .TP 1.5i
571 .BR cto " / " nocto
572 Selects whether to use close-to-open cache coherence semantics.
573 If neither option is specified (or if 
574 .B cto
575 is specified), the client uses close-to-open
576 cache coherence semantics. If the 
577 .B nocto 
578 option is specified, the client uses a non-standard heuristic to determine when
579 files on the server have changed. 
580 .IP
581 Using the
582 .B nocto
583 option may improve performance for read-only mounts,
584 but should be used only if the data on the server changes only occasionally.
585 The DATA AND METADATA COHERENCE section discusses the behavior
586 of this option in more detail.
587 .TP 1.5i
588 .BR acl " / " noacl
589 Selects whether to use the NFSACL sideband protocol on this mount point.
590 The NFSACL sideband protocol is a proprietary protocol
591 implemented in Solaris that manages Access Control Lists. NFSACL was never 
592 made a standard part of the NFS protocol specification.
593 .IP
594 If neither 
595 .B acl
596 nor 
597 .B noacl 
598 option is specified,
599 the NFS client negotiates with the server
600 to see if the NFSACL protocol is supported,
601 and uses it if the server supports it.
602 Disabling the NFSACL sideband protocol may be necessary
603 if the negotiation causes problems on the client or server.
604 Refer to the SECURITY CONSIDERATIONS section for more details.
605 .TP 1.5i
606 .BR rdirplus " / " nordirplus
607 Selects whether to use NFS version 3 READDIRPLUS requests.
608 If this option is not specified, the NFS client uses READDIRPLUS requests
609 on NFS version 3 mounts to read small directories.
610 Some applications perform better if the client uses only READDIR requests
611 for all directories.  
612 .SS "Valid options for the nfs4 file system type"
613 Use these options, along with the options in the first subsection above,
614 for mounting the
615 .B nfs4
616 file system type.
617 .TP 1.5i
618 .BI proto= netid
619 The transport protocol used by the NFS client
620 to transmit requests to the NFS server for this mount point.
621 .I netid
622 can be either
623 .B udp
624 or
625 .BR tcp .
626 All NFS version 4 servers are required to support TCP,
627 so if this mount option is not specified, the NFS version 4 client 
628 uses the TCP transport protocol. 
629 Refer to the TRANSPORT METHODS section for more details.
630 .TP 1.5i
631 .BI port= n
632 The numeric value of the server's NFS service port.
633 If the server's NFS service is not available on the specified port,
634 the mount request fails.
635 .IP
636 If this mount option is not specified,
637 the NFS client uses the standard NFS port number of 2049
638 without first checking the server's rpcbind service.
639 This allows an NFS version 4 client to contact an NFS version 4
640 server through a firewall that may block rpcbind requests.
641 .IP
642 If the specified port value is 0,
643 then the NFS client uses the NFS service port number
644 advertised by the server's rpcbind service.
645 The mount request fails if the server's rpcbind service is not available,
646 the server's NFS service is not registered with its rpcbind service,
647 or the server's NFS service is not available on the advertised port.
648 .TP 1.5i
649 .BR intr " / " nointr
650 Selects whether to allow signals to interrupt file operations
651 on this mount point. If neither option is specified (or if 
652 .B intr 
653 is specified), system calls return EINTR if an in-progress NFS operation  
654 is interrupted by a signal.  If 
655 .B nointr
656 is specified, signals do not  
657 interrupt NFS operations.
658 .IP
659 Using the
660 .B intr
661 option is preferred to using the
662 .B soft
663 option because it is significantly less likely to result in data corruption.
664 .TP 1.5i
665 .BR cto " / " nocto
666 Selects whether to use close-to-open cache coherence semantics
667 for NFS directories on this mount point.
668 If neither
669 .B cto
670 nor
671 .B nocto 
672 is specified,
673 the default is to use close-to-open cache coherence
674 semantics for directories.
675 .IP
676 File data caching behavior is not affected by this option.
677 The DATA AND METADATA COHERENCE section discusses
678 the behavior of this option in more detail.
679 .TP 1.5i
680 .BI clientaddr= n.n.n.n
681 Specifies  a  single  IPv4  address  (in dotted-quad form) 
682 that the NFS client advertises to allow servers 
683 to perform NFS version 4 callback requests against 
684 files on this mount point. If  the  server is unable to 
685 establish callback connections to clients, performance 
686 may degrade, or accesses to files may temporarily hang.
687 .IP
688 If this option is not specified, the
689 .BR mount (8)
690 command attempts to discover an appropriate callback address automatically.
691 The automatic discovery process is not perfect, however.
692 In the presence of multiple client network interfaces,
693 special routing policies,
694 or atypical network topologies,
695 the exact address to use for callbacks may be nontrivial to determine. 
696 .SH EXAMPLES
697 To mount an export using NFS version 2,
698 use the
699 .B nfs
700 file system type and specify the
701 .B nfsvers=2
702 mount option.
703 To mount using NFS version 3,
704 use the
705 .B nfs
706 file system type and specify the
707 .B nfsvers=3
708 mount option.
709 To mount using NFS version 4,
710 use the
711 .B nfs4
712 file system type.
713 The
714 .B nfsvers
715 mount option is not supported for the
716 .B nfs4
717 file system type.
718 .P
719 The following example from an
720 .I /etc/fstab
721 file causes the mount command to negotiate
722 reasonable defaults for NFS behavior.
723 .P
724 .NF
725 .TA 2.5i +0.7i +0.7i +.7i
726         server:/export  /mnt    nfs     defaults        0 0
727 .FI
728 .P
729 Here is an example from an /etc/fstab file for an NFS version 2 mount over UDP.
730 .P
731 .NF
732 .TA 2.5i +0.7i +0.7i +.7i
733         server:/export  /mnt    nfs     nfsvers=2,proto=udp     0 0
734 .FI
735 .P
736 Try this example to mount using NFS version 4 over TCP
737 with Kerberos 5 mutual authentication.
738 .P
739 .NF
740 .TA 2.5i +0.7i +0.7i +.7i
741         server:/export  /mnt    nfs4    sec=krb5        0 0
742 .FI
743 .P
744 This example can be used to mount /usr over NFS.
745 .P
746 .NF
747 .TA 2.5i +0.7i +0.7i +.7i
748         server:/export  /usr    nfs     ro,nolock,nocto,actimeo=3600    0 0
749 .FI
750 .SH "TRANSPORT METHODS"
751 NFS clients send requests to NFS servers via
752 Remote Procedure Calls, or
753 .IR RPCs .
754 The RPC client discovers remote service endpoints automatically,
755 handles per-request authentication,
756 adjusts request parameters for different byte endianness on client and server,
757 and retransmits requests that may have been lost by the network or server.
758 RPC requests and replies flow over a network transport.
759 .P
760 In most cases, the
761 .BR mount (8)
762 command, NFS client, and NFS server
763 can automatically negotiate proper transport
764 and data transfer size settings for a mount point.
765 In some cases, however, it pays to specify
766 these settings explicitly using mount options.
767 .P
768 Traditionally, NFS clients used the UDP transport exclusively for  
769 transmitting requests to servers.  Though its implementation is  
770 simple, NFS over UDP has many limitations that prevent smooth  
771 operation and good performance in some common deployment  
772 environments.  Even an insignificant packet loss rate results in the  
773 loss of whole NFS requests; as such, retransmit timeouts are usually  
774 in the subsecond range to allow clients to recover quickly from  
775 dropped requests, but this can result in extraneous network traffic  
776 and server load.
777 .P
778 However, UDP can be quite effective in specialized settings where  
779 the network’s MTU is large relative to NFS’s data transfer size (such  
780 as network environments that enable jumbo Ethernet frames).  In such  
781 environments, trimming the 
782 .B rsize 
783 and 
784 .B wsize 
785 settings so that each  
786 NFS read or write request fits in just a few network frames (or even  
787 in  a single  frame) is advised.  This reduces the probability that  
788 the loss of a single MTU-sized network frame results in the loss of  
789 an entire large read or write request.
790 .P
791 TCP is the default transport protocol used for all modern NFS 
792 implementations.  It performs well in almost every conceivable
793 network environment and provides excellent guarantees against data 
794 corruption caused by network unreliability.  TCP is often a  
795 requirement for mounting a server through a network firewall.
796 .P
797 Under normal circumstances, networks drop packets much more
798 frequently than NFS servers drop requests.  As such, an aggressive
799 retransmit timeout  setting for NFS over TCP is unnecessary. Typical
800 timeout settings for NFS over TCP are between one and ten minutes.
801 After  the client exhausts its retransmits (the value of the
802 .B retrans
803 mount option), it assumes a network partition has occurred,
804 and attempts to reconnect to the server on a fresh socket. Since
805 TCP itself makes network data transfer reliable, 
806 .B rsize
807 and 
808 .B wsize
809 can safely be allowed to default to the largest values supported by  
810 both client and server, independent of the network's MTU size.
811 .SH "DATA AND METADATA COHERENCE"
812 Some modern cluster file systems provide
813 perfect cache coherence among their clients.
814 Perfect cache coherence among disparate NFS clients
815 is expensive to achieve, especially on wide area networks.
816 As such, NFS settles for weaker cache coherence that 
817 satisfies the requirements of most file sharing types. Normally, 
818 file sharing is completely sequential:
819 first client A opens a file, writes something to it, then closes it;
820 then client B opens the same file, and reads the changes.
821 .DT
822 .SS "Close-to-open cache consistency"
823 When an application opens a file stored on an NFS server,
824 the NFS client checks that it still exists on the server
825 and is permitted to the opener by sending a GETATTR or ACCESS request.
826 When the application closes the file,
827 the NFS client writes back any pending changes
828 to the file so that the next opener can view the changes.
829 This also gives the NFS client an opportunity to report
830 any server write errors to the application
831 via the return code from
832 .BR close (2).
833 The behavior of checking at open time and flushing at close time
834 is referred to as close-to-open cache consistency.
835 .SS "Weak cache consistency"
836 There are still opportunities for a client's data cache
837 to contain stale data.
838 The NFS version 3 protocol introduced "weak cache consistency"
839 (also known as WCC) which provides a way of efficiently checking
840 a file's attributes before and after a single request.
841 This allows a client to help identify changes
842 that could have been made by other clients.
843 .P
844 When a client is using many concurrent operations
845 that update the same file at the same time
846 (for example, during asynchronous write behind),
847 it is still difficult to tell whether it was
848 that client's updates or some other client's updates
849 that altered the file.
850 .SS "Attribute caching"
851 Use the 
852 .B noac
853 mount option to achieve attribute cache coherence
854 among multiple clients.
855 Almost every file system operation checks
856 file attribute information.
857 The client keeps this information cached
858 for a period of time to reduce network and server load.
859 When
860 .B noac
861 is in effect, a client's file attribute cache is disabled,
862 so each operation that needs to check a file's attributes
863 is forced to go back to the server.
864 This permits a client to see changes to a file very quickly,
865 at the cost of many extra network operations.
866 .P
867 Be careful not to confuse the
868 .B noac
869 option with "no data caching."
870 The
871 .B noac
872 mount option prevents the client from caching file metadata,
873 but there are still races that may result in data cache incoherence
874 between client and server.
875 .P
876 The NFS protocol is not designed to support
877 true cluster file system cache coherence
878 without some type of application serialization.
879 If absolute cache coherence among clients is required,
880 applications should use file locking. Alternatively, applications 
881 can also open their files with the O_DIRECT flag
882 to disable data caching entirely.
883 .SS "The sync mount option"
884 The NFS client treats the
885 .B sync
886 mount option differently than some other file systems
887 (refer to 
888 .BR mount (8)
889 for a description of the generic
890 .B sync
891 and
892 .B async
893 mount options).
894 If neither
895 .B sync
896 nor
897 .B async
898 is specified (or if the 
899 .B async 
900 option is specified),
901 the NFS client delays sending application
902 writes to the server
903 until any of these events occur: 
904 .IP
905 Memory pressure forces reclamation of system memory resources.
906 .IP
907 An application flushes file data explicitly with 
908 .BR sync (2),
909 .BR msync (2),
910 or
911 .BR fsync (3).
912 .IP
913 An application closes a file with
914 .BR close (2).
915 .IP
916 The file is locked/unlocked via
917 .BR fcntl (2).
918 .P
919 In other words, under normal circumstances,
920 data written by an application may not immediately appear
921 on the server that hosts the file.
922 .P
923 If the
924 .B sync
925 option is specified on a mount point,
926 any system call that writes data to files on that mount point
927 causes that data to be flushed to the server
928 before the system call returns control to user space.
929 This provides greater data cache coherence among clients,
930 but at a significant performance cost.
931 .P
932 Applications can use the O_SYNC open flag to force application
933 writes to individual files to go to the server immediately without
934 the use of the
935 .B sync 
936 mount option.
937 .SS "Using file locks with NFS"
938 The Network Lock Manager protocol is a separate sideband protocol
939 used to manage file locks in NFS version 2 and version 3.
940 To support lock recovery after a client or server reboot,
941 a second sideband protocol --
942 known as the Network Status Manager protocol --
943 is also required.
944 In NFS version 4,
945 file locking is supported directly in the main NFS protocol,
946 and the NLM and NSM sideband protocols are not used.
947 .P
948 In most cases, NLM and NSM services are started automatically,
949 and no extra configuration is required.
950 Configure all NFS clients with fully-qualified domain names
951 to ensure that NFS servers can find clients to notify them of server reboots.
952 .P
953 NLM supports advisory file locks only.
954 To lock NFS files, use
955 .BR fcntl (2)
956 with the F_GETLK and F_SETLK commands.
957 The NFS client converts file locks obtained via
958 .BR flock (2)
959 to advisory locks.
960 .P
961 When mounting servers that do not support the NLM protocol,
962 or when mounting an NFS server through a firewall
963 that blocks the NLM service port,
964 specify the
965 .B nolock
966 mount option. NLM locking must be disabled with the
967 .B nolock
968 option when using NFS to mount
969 .I /var
970 because 
971 .I /var 
972 contains files used by the NLM implementation on Linux.
973 .P
974 Specifying the
975 .B nolock
976 option may also be advised to improve the performance
977 of a proprietary application which runs on a single client
978 and uses file locks extensively. 
979 .SS "NFS version 4 caching features"
980 The data and metadata caching behavior of NFS version 4
981 clients is similar to that of earlier versions.
982 However, NFS version 4 adds two features that improve
983 cache behavior:
984 .I change attributes
985 and
986 .IR "file delegation" .
987 .P
988 The
989 .I change attribute
990 is a new part of NFS file and directory metadata
991 which tracks data changes.
992 It replaces the use of a file's modification
993 and change time stamps
994 as a way for clients to validate the content
995 of their caches.
996 Change attributes are independent of the time stamp
997 resolution on either the server or client, however.
998 .P
999 A
1000 .I file delegation
1001 is a contract between an NFS version 4 client
1002 and server that allows the client to treat a file temporarily
1003 as if no other client is accessing it.
1004 The server promises to notify the client (via a callback request) if another client
1005 attempts to access that file.
1006 Once a file has been delegated to a client, the client can
1007 cache that file's data and metadata aggressively without
1008 contacting the server.
1009 .P
1010 File delegations come in two flavors:
1011 .I read
1012 and
1013 .IR write .
1014 A
1015 .I read
1016 delegation means that the server notifies the client
1017 about any other clients that want to write to the file.
1018 A
1019 .I write
1020 delegation means that the client gets notified about
1021 either read or write accessors.
1022 .P
1023 Servers grant file delegations when a file is opened,
1024 and can recall delegations at any time when another
1025 client wants access to the file that conflicts with
1026 any delegations already granted.
1027 Delegations on directories are not supported.
1028 .P
1029 In order to support delegation callback, the server
1030 checks the network return path to the client during
1031 the client's initial contact with the server.
1032 If contact with the client cannot be established,
1033 the server simply does not grant any delegations to
1034 that client.
1035 .SH "SECURITY CONSIDERATIONS"
1036 NFS servers control access to file data,
1037 but they depend on their RPC implementation
1038 to provide authentication of NFS requests.
1039 Traditional NFS access control mimics
1040 the standard mode bit access control provided in local file systems.
1041 Traditional RPC authentication uses a number
1042 to represent each user
1043 (usually the user's own uid),
1044 a number to represent the user's group (the user's gid),
1045 and a set of up to 16 auxiliary group numbers
1046 to represent other groups of which the user may be a member.
1047 .P
1048 Typically, file data and user ID values appear unencrypted
1049 (i.e. "in the clear") on the network.
1050 Moreover, NFS versions 2 and 3 use
1051 separate sideband protocols for mounting,
1052 locking and unlocking files,
1053 and reporting system status of clients and servers.
1054 These auxiliary protocols use no authentication.
1055 .P
1056 In addition to combining these sideband protocols with the main NFS protocol,
1057 NFS version 4 introduces more advanced forms of access control,
1058 authentication, and in-transit data protection.
1059 The NFS version 4 specification mandates NFSv4 ACLs,
1060 RPCGSS authentication, and RPCGSS security flavors
1061 that provide per-RPC integrity checking and encryption.
1062 Because NFS version 4 combines the  
1063 function of the sideband protocols into the main NFS protocol,
1064 the new security features apply to all NFS version 4 operations
1065 including mounting, file locking, and so on.
1066 RPCGSS authentication can also be used with NFS versions 2 and 3,
1067 but does not protect their sideband protocols.
1068 .P
1069 The
1070 .B sec
1071 mount option specifies the RPCGSS security mode
1072 that is in effect on a given NFS mount point.
1073 Specifying
1074 .B sec=krb5
1075 provides cryptographic proof of a user's identity in each RPC request.
1076 This provides strong verification of the identity of users 
1077 accessing data on the server.
1078 Note that additional configuration besides adding this mount option
1079 is required in order to enable Kerberos security.
1080 Refer to the 
1081 .BR rpc.gssd (8)
1082 man page for details.
1083 .P
1084 Two additional flavors of Kerberos security are supported:
1085 .B krb5i
1086 and
1087 .BR krb5p .
1088 The
1089 .B krb5i
1090 security flavor provides a cryptographically strong guarantee
1091 that the data in each RPC request has not been tampered with.
1092 The
1093 .B krb5p
1094 security flavor encrypts every RPC request
1095 to prevent data exposure during network transit; however,
1096 expect some performance impact
1097 when using integrity checking or encryption.
1098 Similar support for other forms of cryptographic security (such as lipkey and SPKM3)
1099 is also available.
1100 .P
1101 The NFS version 4 protocol allows
1102 clients and servers to negotiate among multiple security flavors
1103 during mount processing.
1104 However, Linux does not yet implement such negotiation.
1105 The Linux client specifies a single security flavor at mount time
1106 which remains in effect for the lifetime of the mount.
1107 If the server does not support this flavor,
1108 the initial mount request is rejected by the server.
1109 .SS "Mounting through a firewall"
1110 A firewall may reside between an NFS client and server,
1111 or the client or server may block some of its own ports via IP
1112 filter rules.
1113 It is still possible to mount an NFS server through a firewall,
1114 though some of the
1115 .BR mount (8)
1116 command's automatic service endpoint discovery mechanisms may not work; this 
1117 requires you to provide specific endpoint details via NFS mount options.
1118 .P
1119 NFS servers normally run a portmapper or rpcbind daemon to advertise
1120 their service endpoints to clients. Clients use the rpcbind daemon to determine: 
1121 .IP
1122 What network port each RPC-based service is using
1123 .IP
1124 What transport protocols each RPC-based service supports 
1125 .P
1126 The rpcbind daemon uses a well-known port number (111) to help clients find a service endpoint.
1127 Although NFS often uses a standard port number (2049),
1128 auxiliary services such as the NLM service can choose
1129 any unused port number at random.
1130 .P
1131 Common firewall configurations block the well-known rpcbind port.
1132 In the absense of an rpcbind service,
1133 the server administrator fixes the port number
1134 of NFS-related services so that the firewall
1135 can allow access to specific NFS service ports.
1136 Client administrators then specify the port number
1137 for the mountd service via the
1138 .BR mount (8)
1139 command's
1140 .B mountport
1141 option.
1142 It may also be necessary to enforce the use of TCP or UDP
1143 if the firewall blocks one of those transports.
1144 .SS "NFS Access Control Lists"
1145 Solaris allows NFS version 3 clients direct access
1146 to POSIX Access Control Lists stored in its local file systems.
1147 This proprietary sideband protocol, known as NFSACL,
1148 provides richer access control than mode bits.
1149 Linux implements this protocol
1150 for compatibility with the Solaris NFS implementation.
1151 The NFSACL protocol never became a standard part
1152 of the NFS version 3 specification, however.
1153 .P
1154 The NFS version 4 specification mandates a new version
1155 of Access Control Lists that are semantically richer than POSIX ACLs.
1156 NFS version 4 ACLs are not fully compatible with POSIX ACLs; as such, 
1157 some translation between the two is required
1158 in an environment that mixes POSIX ACLs and NFS version 4. 
1159 .SH FILES
1160 .TP 1.5i
1161 .I /etc/fstab
1162 file system table
1163 .SH BUGS
1164 The generic
1165 .B remount
1166 option is not fully supported.
1167 Generic options, such as
1168 .BR rw " and " ro
1169 can be modified using the
1170 .B remount
1171 option,
1172 but NFS-specific options are not all supported.
1173 The underlying transport or NFS version
1174 cannot be changed by a remount, for example.
1175 Performing a remount on an NFS file system mounted with the
1176 .B noac
1177 option may have unintended consequences.
1178 The
1179 .B noac
1180 option is a mixture of a generic option,
1181 .BR sync ,
1182 and an NFS-specific option
1183 .BR actimeo=0 .
1184 .P
1185 Before 2.4.7, the Linux NFS client did not support NFS over TCP.
1186 .P
1187 Before 2.4.20, the Linux NFS client used a heuristic
1188 to determine whether cached file data was still valid
1189 rather than using the standard close-to-open cache coherency method
1190 described above.
1191 .P
1192 Starting with 2.4.22, the Linux NFS client employs
1193 a Van Jacobsen-based RTT estimator to determine retransmit
1194 timeout values when using NFS over UDP.
1195 .P
1196 Before 2.6.0, the Linux NFS client did not support NFS version 4.
1197 .P
1198 Before 2.6.8, the Linux NFS client used only synchronous reads and writes
1199 when the
1200 .BR rsize " and " wsize
1201 settings were smaller than the system's page size.
1202 .P
1203 The Linux NFS client does not yet support
1204 certain optional features of the NFS version 4 protocol,
1205 such as security negotiation, server referrals, and named attributes.
1206 .SH "SEE ALSO"
1207 .BR fstab (5),
1208 .BR mount (8),
1209 .BR umount (8),
1210 .BR mount.nfs (5),
1211 .BR umount.nfs (5),
1212 .BR exports (5),
1213 .BR nfsd (8),
1214 .BR rpc.idmapd (8),
1215 .BR rpc.gssd (8),
1216 .BR rpc.svcgssd (8),
1217 .BR kerberos (1)
1218 .sp
1219 RFC 768 for the UDP specification.
1220 .br
1221 RFC 793 for the TCP specification.
1222 .br
1223 RFC 1094 for the NFS version 2 specification.
1224 .br
1225 RFC 1813 for the NFS version 3 specification.
1226 .br
1227 RFC 1832 for the XDR specification.
1228 .br
1229 RFC 1833 for the RPC bind specification.
1230 .br
1231 RFC 2203 for the RPCSEC GSS API protocol specification.
1232 .br
1233 RFC 3530 for the NFS version 4 specification.