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