2 .TH NFS 5 "2 November 2007"
4 nfs \- fstab format and options for the
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
18 NFS version 2 [RFC1094],
19 NFS version 3 [RFC1813],
20 and NFS version 4 [RFC3530].
24 command attaches a file system to the system's
25 name space hierarchy at a given mount point.
30 should assemble a system's file name hierarchy
31 from various independent file systems
32 (including file systems exported by NFS servers).
35 file describes a single file system, its mount point,
36 and a set of default mount options for that mount point.
38 For NFS file system mounts, a line in the
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:
53 .TA 2.5i +0.75i +0.75i +1.0i
54 server:path /mountpoint fstype option,option,... 0 0
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.
66 field contains either "nfs" (for version 2 or version 3 NFS mounts)
67 or "nfs4" (for NFS version 4 mounts).
72 file system types share similar mount options,
73 which are described below.
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
85 .SS "Valid options for either the nfs or nfs4 file system type"
86 These options are valid to use when mounting either
91 They imply the same behavior
92 and have the same default for both file system types.
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
99 option is specified), NFS requests are retried indefinitely.
102 option is specified, then the NFS client fails an NFS request
105 retransmissions have been sent,
106 causing the NFS client to return an error
107 to the calling application.
110 A so-called "soft" timeout can cause
111 silent data corruption in certain cases. As such, use the
113 option only when client responsiveness
114 is more important than data integrity.
115 Using NFS over TCP or increasing the value of the
117 option may mitigate some of the risks of using the
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
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
133 setting for infrequently used request types (such as FSINFO requests).
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
140 up to a maximum timeout length of 60 seconds.
143 The number of times the NFS client retries a request before
144 it attempts further recovery action. If the
146 option is not specified, the NFS client tries each request
149 The NFS client generates a "server not responding" message
152 retries, then attempts further recovery (depending on whether the
154 mount option is in effect).
157 The maximum number of bytes in each network READ request
158 that the NFS client can receive when reading data from a file
160 The actual data payload size of each NFS READ request is equal to
163 setting. The largest read payload supported by the Linux NFS client
164 is 1,048,576 bytes (one megabyte).
168 value is a positive integral multiple of 1024.
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
178 value is not specified, or if the specified
180 value is larger than the maximum that either client or server can support,
181 the client and server negotiate the largest
183 value that they can both support.
187 mount option as specified on the
189 command line appears in the
191 file. However, the effective
193 value negotiated by the client and server is reported in the
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
204 setting. The largest write payload supported by the Linux NFS client
205 is 1,048,576 bytes (one megabyte).
211 value is a positive integral multiple of 1024.
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
221 value is not specified, or if the specified
223 value is larger than the maximum that either client or server can support,
224 the client and server negotiate the largest
226 value that they can both support.
230 mount option as specified on the
232 command line appears in the
234 file. However, the effective
236 value negotiated by the client and server is reported in the
241 Selects whether the client may cache file attributes. If neither
242 option is specified (or if
244 is specified), the client caches file
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
253 option prevents clients from caching file
254 attributes so that applications can more quickly detect file changes
257 In addition to preventing the client from caching file attributes,
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.
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
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
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
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
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
312 If this option is not specified, the NFS client uses
313 the defaults for each of these options listed above.
318 command behaves if an attempt to mount an export fails.
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
330 mount option is specified.
334 option is specified, a timeout or failure causes the
336 command to fork a child which continues to attempt
338 The parent immediately returns with a zero exit code.
339 This is known as a "background" mount.
341 If the local mount point directory is missing, the
343 command acts as if the mount request timed out.
344 This permits nested NFS mounts specified in
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
354 The number of minutes that the
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).
362 The RPCGSS security flavor to use for accessing files on this mount point.
365 option is not specified, or if
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
382 Refer to the SECURITY CONSIDERATIONS section for details.
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.
391 If neither option is specified, or if the
394 specified, then a single cache is used for all mount points that
395 access the same export. If the
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.
402 As of kernel 2.6.18, the behavior specified by
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.
409 .BR resvport " / " noresvport
410 Specifies whether the NFS client should use a privileged source port
411 when communicating with an NFS server for this mount point.
412 If this option is not specified, or the
414 option is specified, the NFS client uses a privileged source port.
417 option is specified, the NFS client uses a non-privileged source port.
418 This option is supported in kernels 2.6.28 and later.
420 Using non-privileged source ports helps increase the maximum number of
421 NFS mount points allowed on a client, but NFS servers must be configured
422 to allow clients to connect via non-privileged source ports.
424 Refer to the SECURITY CONSIDERATIONS section for important details.
425 .SS "Valid options for the nfs file system type"
426 Use these options, along with the options in the above subsection,
432 The transport the NFS client uses
433 to transmit requests to the NFS server for this mount point.
439 Each transport uses different default
443 settings; refer to the description of these two mount options for details.
445 In addition to controlling how the NFS client transmits requests to
446 the server, this mount option also controls how the
448 command communicates with the server's rpcbind and mountd services.
451 forces all traffic from the
453 command and the NFS client to use TCP.
456 forces all traffic types to use UDP.
460 mount option is not specified, the
462 command discovers which protocols the server supports
463 and chooses an appropriate transport for each service.
464 Refer to the TRANSPORT METHODS section for more details.
469 option is an alternative to specifying
471 It is included for compatibility with other operating systems.
476 option is an alternative to specifying
478 It is included for compatibility with other operating systems.
481 The numeric value of the server's NFS service port.
482 If the server's NFS service is not available on the specified port,
483 the mount request fails.
485 If this option is not specified, or if the specified port value is 0,
486 then the NFS client uses the NFS service port number
487 advertised by the server's rpcbind service.
488 The mount request fails if the server's rpcbind service is not available,
489 the server's NFS service is not registered with its rpcbind service,
490 or the server's NFS service is not available on the advertised port.
493 The numeric value of the server's mountd port.
494 If the server's mountd service is not available on the specified port,
495 the mount request fails.
497 If this option is not specified,
498 or if the specified port value is 0, then the
500 command uses the mountd service port number
501 advertised by the server's rpcbind service.
502 The mount request fails if the server's rpcbind service is not available,
503 the server's mountd service is not registered with its rpcbind service,
504 or the server's mountd service is not available on the advertised port.
506 This option can be used when mounting an NFS server
507 through a firewall that blocks the rpcbind protocol.
509 .BI mountproto= transport
510 The transport the NFS client uses
511 to transmit requests to the NFS server's mountd service when performing
512 this mount request, and when later unmounting this mount point.
519 This option can be used when mounting an NFS server
520 through a firewall that blocks a particular transport.
521 When used in combination with the
523 option, different transports for mountd requests and NFS requests
525 If the server's mountd service is not available via the specified
526 transport, the mount request fails.
527 Refer to the TRANSPORT METHODS section for more on how the
529 mount option interacts with the
534 The hostname of the host running mountd.
535 If this option is not specified, the
537 command assumes that the mountd service runs
538 on the same host as the NFS service.
541 The RPC version number used to contact the server's mountd.
542 If this option is not specified, the client uses a version number
543 appropriate to the requested NFS version.
544 This option is useful when multiple NFS services
545 are running on the same remote server host.
548 The maximum length of a pathname component on this mount.
549 If this option is not specified, the maximum length is negotiated
550 with the server. In most cases, this maximum length is 255 characters.
552 Some early versions of NFS did not support this negotiation.
553 Using this option ensures that
555 reports the proper maximum component length to applications
559 The NFS protocol version number used to contact the server's NFS service.
560 The Linux client supports version 2 and version 3 of the NFS protocol
561 when using the file system type
563 If the server does not support the requested version,
564 the mount request fails.
565 If this option is not specified, the client attempts to use version 3,
566 but negotiates the NFS version with the server if version 3 support
570 This option is an alternative to the
573 It is included for compatibility with other operating systems.
575 .BR lock " / " nolock
576 Selects whether to use the NLM sideband protocol to lock files on the server.
577 If neither option is specified (or if
579 is specified), NLM locking is used for this mount point.
582 option, applications can lock files,
583 but such locks provide exclusion only against other applications
584 running on the same client.
585 Remote applications are not affected by these locks.
587 NLM locking must be disabled with the
589 option when using NFS to mount
593 contains files used by the NLM implementation on Linux.
596 option is also required when mounting exports on NFS servers
597 that do not support the NLM protocol.
599 .BR intr " / " nointr
600 Selects whether to allow signals to interrupt file operations
601 on this mount point. If neither option
605 signals do not interrupt NFS file operations. If
607 is specified, system calls return EINTR if an in-progress NFS operation is interrupted by
612 option is preferred to using the
614 option because it is significantly less likely to result in data corruption.
617 Selects whether to use close-to-open cache coherence semantics.
618 If neither option is specified (or if
620 is specified), the client uses close-to-open
621 cache coherence semantics. If the
623 option is specified, the client uses a non-standard heuristic to determine when
624 files on the server have changed.
628 option may improve performance for read-only mounts,
629 but should be used only if the data on the server changes only occasionally.
630 The DATA AND METADATA COHERENCE section discusses the behavior
631 of this option in more detail.
634 Selects whether to use the NFSACL sideband protocol on this mount point.
635 The NFSACL sideband protocol is a proprietary protocol
636 implemented in Solaris that manages Access Control Lists. NFSACL was never
637 made a standard part of the NFS protocol specification.
644 the NFS client negotiates with the server
645 to see if the NFSACL protocol is supported,
646 and uses it if the server supports it.
647 Disabling the NFSACL sideband protocol may be necessary
648 if the negotiation causes problems on the client or server.
649 Refer to the SECURITY CONSIDERATIONS section for more details.
651 .BR rdirplus " / " nordirplus
652 Selects whether to use NFS version 3 READDIRPLUS requests.
653 If this option is not specified, the NFS client uses READDIRPLUS requests
654 on NFS version 3 mounts to read small directories.
655 Some applications perform better if the client uses only READDIR requests
657 .SS "Valid options for the nfs4 file system type"
658 Use these options, along with the options in the first subsection above,
664 The transport the NFS client uses
665 to transmit requests to the NFS server for this mount point.
671 All NFS version 4 servers are required to support TCP,
672 so if this mount option is not specified, the NFS version 4 client
673 uses the TCP transport protocol.
674 Refer to the TRANSPORT METHODS section for more details.
677 The numeric value of the server's NFS service port.
678 If the server's NFS service is not available on the specified port,
679 the mount request fails.
681 If this mount option is not specified,
682 the NFS client uses the standard NFS port number of 2049
683 without first checking the server's rpcbind service.
684 This allows an NFS version 4 client to contact an NFS version 4
685 server through a firewall that may block rpcbind requests.
687 If the specified port value is 0,
688 then the NFS client uses the NFS service port number
689 advertised by the server's rpcbind service.
690 The mount request fails if the server's rpcbind service is not available,
691 the server's NFS service is not registered with its rpcbind service,
692 or the server's NFS service is not available on the advertised port.
694 .BR intr " / " nointr
695 Selects whether to allow signals to interrupt file operations
696 on this mount point. If neither option is specified (or if
698 is specified), system calls return EINTR if an in-progress NFS operation
699 is interrupted by a signal. If
701 is specified, signals do not
702 interrupt NFS operations.
706 option is preferred to using the
708 option because it is significantly less likely to result in data corruption.
711 Selects whether to use close-to-open cache coherence semantics
712 for NFS directories on this mount point.
718 the default is to use close-to-open cache coherence
719 semantics for directories.
721 File data caching behavior is not affected by this option.
722 The DATA AND METADATA COHERENCE section discusses
723 the behavior of this option in more detail.
725 .BI clientaddr= n.n.n.n
726 Specifies a single IPv4 address (in dotted-quad form)
727 that the NFS client advertises to allow servers
728 to perform NFS version 4 callback requests against
729 files on this mount point. If the server is unable to
730 establish callback connections to clients, performance
731 may degrade, or accesses to files may temporarily hang.
733 If this option is not specified, the
735 command attempts to discover an appropriate callback address automatically.
736 The automatic discovery process is not perfect, however.
737 In the presence of multiple client network interfaces,
738 special routing policies,
739 or atypical network topologies,
740 the exact address to use for callbacks may be nontrivial to determine.
742 To mount an export using NFS version 2,
745 file system type and specify the
748 To mount using NFS version 3,
751 file system type and specify the
754 To mount using NFS version 4,
760 mount option is not supported for the
764 The following example from an
766 file causes the mount command to negotiate
767 reasonable defaults for NFS behavior.
770 .TA 2.5i +0.7i +0.7i +.7i
771 server:/export /mnt nfs defaults 0 0
774 Here is an example from an /etc/fstab file for an NFS version 2 mount over UDP.
777 .TA 2.5i +0.7i +0.7i +.7i
778 server:/export /mnt nfs nfsvers=2,proto=udp 0 0
781 Try this example to mount using NFS version 4 over TCP
782 with Kerberos 5 mutual authentication.
785 .TA 2.5i +0.7i +0.7i +.7i
786 server:/export /mnt nfs4 sec=krb5 0 0
789 This example can be used to mount /usr over NFS.
792 .TA 2.5i +0.7i +0.7i +.7i
793 server:/export /usr nfs ro,nolock,nocto,actimeo=3600 0 0
795 .SH "TRANSPORT METHODS"
796 NFS clients send requests to NFS servers via
797 Remote Procedure Calls, or
799 The RPC client discovers remote service endpoints automatically,
800 handles per-request authentication,
801 adjusts request parameters for different byte endianness on client and server,
802 and retransmits requests that may have been lost by the network or server.
803 RPC requests and replies flow over a network transport.
807 command, NFS client, and NFS server
808 can automatically negotiate proper transport
809 and data transfer size settings for a mount point.
810 In some cases, however, it pays to specify
811 these settings explicitly using mount options.
813 Traditionally, NFS clients used the UDP transport exclusively for
814 transmitting requests to servers. Though its implementation is
815 simple, NFS over UDP has many limitations that prevent smooth
816 operation and good performance in some common deployment
817 environments. Even an insignificant packet loss rate results in the
818 loss of whole NFS requests; as such, retransmit timeouts are usually
819 in the subsecond range to allow clients to recover quickly from
820 dropped requests, but this can result in extraneous network traffic
823 However, UDP can be quite effective in specialized settings where
824 the network’s MTU is large relative to NFS’s data transfer size (such
825 as network environments that enable jumbo Ethernet frames). In such
826 environments, trimming the
830 settings so that each
831 NFS read or write request fits in just a few network frames (or even
832 in a single frame) is advised. This reduces the probability that
833 the loss of a single MTU-sized network frame results in the loss of
834 an entire large read or write request.
836 TCP is the default transport protocol used for all modern NFS
837 implementations. It performs well in almost every conceivable
838 network environment and provides excellent guarantees against data
839 corruption caused by network unreliability. TCP is often a
840 requirement for mounting a server through a network firewall.
842 Under normal circumstances, networks drop packets much more
843 frequently than NFS servers drop requests. As such, an aggressive
844 retransmit timeout setting for NFS over TCP is unnecessary. Typical
845 timeout settings for NFS over TCP are between one and ten minutes.
846 After the client exhausts its retransmits (the value of the
848 mount option), it assumes a network partition has occurred,
849 and attempts to reconnect to the server on a fresh socket. Since
850 TCP itself makes network data transfer reliable,
854 can safely be allowed to default to the largest values supported by
855 both client and server, independent of the network's MTU size.
856 .SS "Using the mountproto mount option"
857 This section applies only to NFS version 2 and version 3 mounts
858 since NFS version 4 does not use a separate protocol for mount
861 The Linux NFS client can use a different transport for
862 contacting an NFS server's rpcbind service, its mountd service,
863 its Network Lock Manager (NLM) service, and its NFS service.
864 The exact transports employed by the Linux NFS client for
865 each mount point depends on the settings of the transport
866 mount options, which include
869 .BR udp ", and " tcp .
871 The client sends Network Status Manager (NSM) notifications
872 via UDP no matter what transport options are specified, but
873 listens for server NSM notifications on both UDP and TCP.
874 The NFS Access Control List (NFSACL) protocol shares the same
875 transport as the main NFS service.
877 If no transport options are specified, the Linux NFS client
878 uses UDP to contact the server's mountd service, and TCP to
879 contact its NLM and NFS services by default.
881 If the server does not support these transports for these services, the
883 command attempts to discover what the server supports, and then retries
884 the mount request once using the discovered transports.
885 If the server does not advertise any transport supported by the client
886 or is misconfigured, the mount request fails.
889 option is in effect, the mount command backgrounds itself and continues
890 to attempt the specified mount request.
898 option is specified but the
900 option is not, the specified transport is used to contact
901 both the server's mountd service and for the NLM and NFS services.
905 option is specified but none of the
906 .BR proto ", " udp " or " tcp
907 options are specified, then the specified transport is used for the
908 initial mountd request, but the mount command attempts to discover
909 what the server supports for the NFS protocol, preferring TCP if
910 both transports are supported.
913 .BR mountproto " and " proto
916 options are specified, then the transport specified by the
918 option is used for the initial mountd request, and the transport
922 .BR udp " or " tcp " options)"
923 is used for NFS, no matter what order these options appear.
924 No automatic service discovery is performed if these options are
928 .BR proto ", " udp ", " tcp ", "
931 options are specified more than once on the same mount command line,
932 then the value of the rightmost instance of each of these options
934 .SH "DATA AND METADATA COHERENCE"
935 Some modern cluster file systems provide
936 perfect cache coherence among their clients.
937 Perfect cache coherence among disparate NFS clients
938 is expensive to achieve, especially on wide area networks.
939 As such, NFS settles for weaker cache coherence that
940 satisfies the requirements of most file sharing types. Normally,
941 file sharing is completely sequential:
942 first client A opens a file, writes something to it, then closes it;
943 then client B opens the same file, and reads the changes.
945 .SS "Close-to-open cache consistency"
946 When an application opens a file stored on an NFS server,
947 the NFS client checks that it still exists on the server
948 and is permitted to the opener by sending a GETATTR or ACCESS request.
949 When the application closes the file,
950 the NFS client writes back any pending changes
951 to the file so that the next opener can view the changes.
952 This also gives the NFS client an opportunity to report
953 any server write errors to the application
954 via the return code from
956 The behavior of checking at open time and flushing at close time
957 is referred to as close-to-open cache consistency.
958 .SS "Weak cache consistency"
959 There are still opportunities for a client's data cache
960 to contain stale data.
961 The NFS version 3 protocol introduced "weak cache consistency"
962 (also known as WCC) which provides a way of efficiently checking
963 a file's attributes before and after a single request.
964 This allows a client to help identify changes
965 that could have been made by other clients.
967 When a client is using many concurrent operations
968 that update the same file at the same time
969 (for example, during asynchronous write behind),
970 it is still difficult to tell whether it was
971 that client's updates or some other client's updates
972 that altered the file.
973 .SS "Attribute caching"
976 mount option to achieve attribute cache coherence
977 among multiple clients.
978 Almost every file system operation checks
979 file attribute information.
980 The client keeps this information cached
981 for a period of time to reduce network and server load.
984 is in effect, a client's file attribute cache is disabled,
985 so each operation that needs to check a file's attributes
986 is forced to go back to the server.
987 This permits a client to see changes to a file very quickly,
988 at the cost of many extra network operations.
990 Be careful not to confuse the
992 option with "no data caching."
995 mount option prevents the client from caching file metadata,
996 but there are still races that may result in data cache incoherence
997 between client and server.
999 The NFS protocol is not designed to support
1000 true cluster file system cache coherence
1001 without some type of application serialization.
1002 If absolute cache coherence among clients is required,
1003 applications should use file locking. Alternatively, applications
1004 can also open their files with the O_DIRECT flag
1005 to disable data caching entirely.
1006 .SS "The sync mount option"
1007 The NFS client treats the
1009 mount option differently than some other file systems
1012 for a description of the generic
1021 is specified (or if the
1023 option is specified),
1024 the NFS client delays sending application
1025 writes to the server
1026 until any of these events occur:
1028 Memory pressure forces reclamation of system memory resources.
1030 An application flushes file data explicitly with
1036 An application closes a file with
1039 The file is locked/unlocked via
1042 In other words, under normal circumstances,
1043 data written by an application may not immediately appear
1044 on the server that hosts the file.
1048 option is specified on a mount point,
1049 any system call that writes data to files on that mount point
1050 causes that data to be flushed to the server
1051 before the system call returns control to user space.
1052 This provides greater data cache coherence among clients,
1053 but at a significant performance cost.
1055 Applications can use the O_SYNC open flag to force application
1056 writes to individual files to go to the server immediately without
1060 .SS "Using file locks with NFS"
1061 The Network Lock Manager protocol is a separate sideband protocol
1062 used to manage file locks in NFS version 2 and version 3.
1063 To support lock recovery after a client or server reboot,
1064 a second sideband protocol --
1065 known as the Network Status Manager protocol --
1068 file locking is supported directly in the main NFS protocol,
1069 and the NLM and NSM sideband protocols are not used.
1071 In most cases, NLM and NSM services are started automatically,
1072 and no extra configuration is required.
1073 Configure all NFS clients with fully-qualified domain names
1074 to ensure that NFS servers can find clients to notify them of server reboots.
1076 NLM supports advisory file locks only.
1077 To lock NFS files, use
1079 with the F_GETLK and F_SETLK commands.
1080 The NFS client converts file locks obtained via
1084 When mounting servers that do not support the NLM protocol,
1085 or when mounting an NFS server through a firewall
1086 that blocks the NLM service port,
1089 mount option. NLM locking must be disabled with the
1091 option when using NFS to mount
1095 contains files used by the NLM implementation on Linux.
1099 option may also be advised to improve the performance
1100 of a proprietary application which runs on a single client
1101 and uses file locks extensively.
1102 .SS "NFS version 4 caching features"
1103 The data and metadata caching behavior of NFS version 4
1104 clients is similar to that of earlier versions.
1105 However, NFS version 4 adds two features that improve
1107 .I change attributes
1109 .IR "file delegation" .
1113 is a new part of NFS file and directory metadata
1114 which tracks data changes.
1115 It replaces the use of a file's modification
1116 and change time stamps
1117 as a way for clients to validate the content
1119 Change attributes are independent of the time stamp
1120 resolution on either the server or client, however.
1124 is a contract between an NFS version 4 client
1125 and server that allows the client to treat a file temporarily
1126 as if no other client is accessing it.
1127 The server promises to notify the client (via a callback request) if another client
1128 attempts to access that file.
1129 Once a file has been delegated to a client, the client can
1130 cache that file's data and metadata aggressively without
1131 contacting the server.
1133 File delegations come in two flavors:
1139 delegation means that the server notifies the client
1140 about any other clients that want to write to the file.
1143 delegation means that the client gets notified about
1144 either read or write accessors.
1146 Servers grant file delegations when a file is opened,
1147 and can recall delegations at any time when another
1148 client wants access to the file that conflicts with
1149 any delegations already granted.
1150 Delegations on directories are not supported.
1152 In order to support delegation callback, the server
1153 checks the network return path to the client during
1154 the client's initial contact with the server.
1155 If contact with the client cannot be established,
1156 the server simply does not grant any delegations to
1158 .SH "SECURITY CONSIDERATIONS"
1159 NFS servers control access to file data,
1160 but they depend on their RPC implementation
1161 to provide authentication of NFS requests.
1162 Traditional NFS access control mimics
1163 the standard mode bit access control provided in local file systems.
1164 Traditional RPC authentication uses a number
1165 to represent each user
1166 (usually the user's own uid),
1167 a number to represent the user's group (the user's gid),
1168 and a set of up to 16 auxiliary group numbers
1169 to represent other groups of which the user may be a member.
1171 Typically, file data and user ID values appear unencrypted
1172 (i.e. "in the clear") on the network.
1173 Moreover, NFS versions 2 and 3 use
1174 separate sideband protocols for mounting,
1175 locking and unlocking files,
1176 and reporting system status of clients and servers.
1177 These auxiliary protocols use no authentication.
1179 In addition to combining these sideband protocols with the main NFS protocol,
1180 NFS version 4 introduces more advanced forms of access control,
1181 authentication, and in-transit data protection.
1182 The NFS version 4 specification mandates NFSv4 ACLs,
1183 RPCGSS authentication, and RPCGSS security flavors
1184 that provide per-RPC integrity checking and encryption.
1185 Because NFS version 4 combines the
1186 function of the sideband protocols into the main NFS protocol,
1187 the new security features apply to all NFS version 4 operations
1188 including mounting, file locking, and so on.
1189 RPCGSS authentication can also be used with NFS versions 2 and 3,
1190 but does not protect their sideband protocols.
1194 mount option specifies the RPCGSS security mode
1195 that is in effect on a given NFS mount point.
1198 provides cryptographic proof of a user's identity in each RPC request.
1199 This provides strong verification of the identity of users
1200 accessing data on the server.
1201 Note that additional configuration besides adding this mount option
1202 is required in order to enable Kerberos security.
1205 man page for details.
1207 Two additional flavors of Kerberos security are supported:
1213 security flavor provides a cryptographically strong guarantee
1214 that the data in each RPC request has not been tampered with.
1217 security flavor encrypts every RPC request
1218 to prevent data exposure during network transit; however,
1219 expect some performance impact
1220 when using integrity checking or encryption.
1221 Similar support for other forms of cryptographic security (such as lipkey and SPKM3)
1224 The NFS version 4 protocol allows
1225 clients and servers to negotiate among multiple security flavors
1226 during mount processing.
1227 However, Linux does not yet implement such negotiation.
1228 The Linux client specifies a single security flavor at mount time
1229 which remains in effect for the lifetime of the mount.
1230 If the server does not support this flavor,
1231 the initial mount request is rejected by the server.
1232 .SS "Using non-privileged source ports"
1233 NFS clients usually communicate with NFS servers via network sockets.
1234 Each end of a socket is assigned a port value, which is simply a number
1235 between 1 and 65535 that distinguishes socket endpoints at the same
1237 A socket is uniquely defined by a tuple that includes the transport
1238 protocol (TCP or UDP) and the port values and IP addresses of both
1241 The NFS client can choose any source port value for its sockets,
1242 but usually chooses a
1245 A privileged port is a port value less than 1024.
1246 Only a process with root privileges may create a socket
1247 with a privileged source port.
1249 The exact range of privileged source ports that can be chosen is
1250 set by a pair of sysctls to avoid choosing a well-known port, such as
1251 the port used by ssh.
1252 This means the number of source ports available for the NFS client,
1253 and therefore the number of socket connections that can be used
1255 is practically limited to only a few hundred.
1257 As described above, the traditional default NFS authentication scheme,
1258 known as AUTH_SYS, relies on sending local UID and GID numbers to identify
1259 users making NFS requests.
1260 An NFS server assumes that if a connection comes from a privileged port,
1261 the UID and GID numbers in the NFS requests on this connection have been
1262 verified by the client's kernel or some other local authority.
1263 This is an easy system to spoof, but on a trusted physical network between
1264 trusted hosts, it is entirely adequate.
1266 Roughly speaking, one socket is used for each NFS mount point.
1267 If a client could use non-privileged source ports as well,
1268 the number of sockets allowed,
1269 and thus the maximum number of concurrent mount points,
1270 would be much larger.
1272 Using non-privileged source ports may compromise server security somewhat,
1273 since any user on AUTH_SYS mount points can now pretend to be any other
1274 when making NFS requests.
1275 Thus NFS servers do not support this by default.
1276 They explicitly allow it usually via an export option.
1278 To retain good security while allowing as many mount points as possible,
1279 it is best to allow non-privileged client connections only if the server
1280 and client both require strong authentication, such as Kerberos.
1281 .SS "Mounting through a firewall"
1282 A firewall may reside between an NFS client and server,
1283 or the client or server may block some of its own ports via IP
1285 It is still possible to mount an NFS server through a firewall,
1288 command's automatic service endpoint discovery mechanisms may not work; this
1289 requires you to provide specific endpoint details via NFS mount options.
1291 NFS servers normally run a portmapper or rpcbind daemon to advertise
1292 their service endpoints to clients. Clients use the rpcbind daemon to determine:
1294 What network port each RPC-based service is using
1296 What transport protocols each RPC-based service supports
1298 The rpcbind daemon uses a well-known port number (111) to help clients find a service endpoint.
1299 Although NFS often uses a standard port number (2049),
1300 auxiliary services such as the NLM service can choose
1301 any unused port number at random.
1303 Common firewall configurations block the well-known rpcbind port.
1304 In the absense of an rpcbind service,
1305 the server administrator fixes the port number
1306 of NFS-related services so that the firewall
1307 can allow access to specific NFS service ports.
1308 Client administrators then specify the port number
1309 for the mountd service via the
1314 It may also be necessary to enforce the use of TCP or UDP
1315 if the firewall blocks one of those transports.
1316 .SS "NFS Access Control Lists"
1317 Solaris allows NFS version 3 clients direct access
1318 to POSIX Access Control Lists stored in its local file systems.
1319 This proprietary sideband protocol, known as NFSACL,
1320 provides richer access control than mode bits.
1321 Linux implements this protocol
1322 for compatibility with the Solaris NFS implementation.
1323 The NFSACL protocol never became a standard part
1324 of the NFS version 3 specification, however.
1326 The NFS version 4 specification mandates a new version
1327 of Access Control Lists that are semantically richer than POSIX ACLs.
1328 NFS version 4 ACLs are not fully compatible with POSIX ACLs; as such,
1329 some translation between the two is required
1330 in an environment that mixes POSIX ACLs and NFS version 4.
1338 option is not fully supported.
1339 Generic options, such as
1341 can be modified using the
1344 but NFS-specific options are not all supported.
1345 The underlying transport or NFS version
1346 cannot be changed by a remount, for example.
1347 Performing a remount on an NFS file system mounted with the
1349 option may have unintended consequences.
1352 option is a mixture of a generic option,
1354 and an NFS-specific option
1357 Before 2.4.7, the Linux NFS client did not support NFS over TCP.
1359 Before 2.4.20, the Linux NFS client used a heuristic
1360 to determine whether cached file data was still valid
1361 rather than using the standard close-to-open cache coherency method
1364 Starting with 2.4.22, the Linux NFS client employs
1365 a Van Jacobsen-based RTT estimator to determine retransmit
1366 timeout values when using NFS over UDP.
1368 Before 2.6.0, the Linux NFS client did not support NFS version 4.
1370 Before 2.6.8, the Linux NFS client used only synchronous reads and writes
1372 .BR rsize " and " wsize
1373 settings were smaller than the system's page size.
1375 The Linux NFS client does not yet support
1376 certain optional features of the NFS version 4 protocol,
1377 such as security negotiation, server referrals, and named attributes.
1390 .BR rpc.svcgssd (8),
1393 RFC 768 for the UDP specification.
1395 RFC 793 for the TCP specification.
1397 RFC 1094 for the NFS version 2 specification.
1399 RFC 1813 for the NFS version 3 specification.
1401 RFC 1832 for the XDR specification.
1403 RFC 1833 for the RPC bind specification.
1405 RFC 2203 for the RPCSEC GSS API protocol specification.
1407 RFC 3530 for the NFS version 4 specification.