1nfsd(7) Miscellaneous Information Manual nfsd(7)
2
3
4
6 nfsd - special filesystem for controlling Linux NFS server
7
9 mount -t nfsd nfsd /proc/fs/nfsd
10
12 The nfsd filesystem is a special filesystem which provides access to
13 the Linux NFS server. Writing to files in this filesystem can affect
14 the server. Reading from them can provide information about the
15 server.
16
17 As well as this filesystem, there are a collection of files in the
18 procfs filesystem (normally mounted at /proc) which are used to control
19 the NFS server. This manual page describes all of these files.
20
21 The exportfs and mountd programs (part of the nfs-utils package) expect
22 to find this filesystem mounted at /proc/fs/nfsd or /proc/fs/nfs.
23
25 Files in the nfsd filesystem include:
26
27 exports
28 This file contains a list of filesystems that are currently
29 exported and clients that each filesystem is exported to,
30 together with a list of export options for that client/filesys‐
31 tem pair. This is similar to the /proc/fs/nfs/exports file in
32 2.4. One difference is that a client doesn't necessarily corre‐
33 spond to just one host. It can respond to a large collection of
34 hosts that are being treated identically.
35
36 Each line of the file contains a path name, a client name, and a
37 number of options in parentheses. Any space, tab, newline or
38 back-slash character in the path name or client name will be
39 replaced by a backslash followed by the octal ASCII code for
40 that character.
41
42
43 threads
44 This file represents the number of nfsd thread currently run‐
45 ning. Reading it will show the number of threads. Writing an
46 ASCII decimal number will cause the number of threads to be
47 changed (increased or decreased as necessary) to achieve that
48 number.
49
50
51 filehandle
52 This is a somewhat unusual file in that what is read from it
53 depends on what was just written to it. It provides a transac‐
54 tional interface where a program can open the file, write a
55 request, and read a response. If two separate programs open,
56 write, and read at the same time, their requests will not be
57 mixed up.
58
59 The request written to filehandle should be a client name, a
60 path name, and a number of bytes. This should be followed by a
61 newline, with white-space separating the fields, and octal quot‐
62 ing of special characters.
63
64 On writing this, the program will be able to read back a file‐
65 handle for that path as exported to the given client. The file‐
66 handle's length will be at most the number of bytes given.
67
68 The filehandle will be represented in hex with a leading '\x'.
69
70
71 clients/
72 This directory contains a subdirectory for each NFSv4 client.
73 Each file under that subdirectory gives some details about the
74 client in YAML format. In addition, writing "expire\n" to the
75 ctl file will force the server to immediately revoke all state
76 held by that client.
77
78
79 The directory /proc/net/rpc in the procfs filesystem contains a number
80 of files and directories. The files contain statistics that can be
81 display using the nfsstat program. The directories contain information
82 about various caches that the NFS server maintains to keep track of
83 access permissions that different clients have for different filesys‐
84 tems. The caches are:
85
86
87 auth.unix.ip
88 This cache contains a mapping from IP address to the name of the
89 authentication domain that the ipaddress should be treated as
90 part of.
91
92
93 nfsd.export
94 This cache contains a mapping from directory and domain to
95 export options.
96
97
98 nfsd.fh
99 This cache contains a mapping from domain and a filesystem iden‐
100 tifier to a directory. The filesystem identifier is stored in
101 the filehandles and consists of a number indicating the type of
102 identifier and a number of hex bytes indicating the content of
103 the identifier.
104
105
106 Each directory representing a cache can hold from 1 to 3 files. They
107 are:
108
109 flush When a number of seconds since epoch (1 Jan 1970) is written to
110 this file, all entries in the cache that were last updated
111 before that file become invalidated and will be flushed out.
112 Writing a time in the future (in seconds since epoch) will flush
113 everything. This is the only file that will always be present.
114
115
116 content
117 This file, if present, contains a textual representation of ever
118 entry in the cache, one per line. If an entry is still in the
119 cache (because it is actively being used) but has expired or is
120 otherwise invalid, it will be presented as a comment (with a
121 leading hash character).
122
123
124 channel
125 This file, if present, acts a channel for request from the ker‐
126 nel-based nfs server to be passed to a user-space program for
127 handling.
128
129 When the kernel needs some information which isn't in the cache,
130 it makes a line appear in the channel file giving the key for
131 the information. A user-space program should read this, find
132 the answer, and write a line containing the key, an expiry time,
133 and the content. For example the kernel might make
134 nfsd 127.0.0.1
135 appear in the auth.unix.ip/content file. The user-space program
136 might then write
137 nfsd 127.0.0.1 1057206953 localhost
138 to indicate that 127.0.0.1 should map to localhost, at least for
139 now.
140
141 If the program uses select(2) or poll(2) to discover if it can
142 read from the channel then it will never see and end-of-file but
143 when all requests have been answered, it will block until
144 another request appears.
145
146
147 In the /proc filesystem there are 4 files that can be used to enabled
148 extra tracing of nfsd and related code. They are:
149 /proc/sys/sunrpc/nfs_debug
150 /proc/sys/sunrpc/nfsd_debug
151 /proc/sys/sunrpc/nlm_debug
152 /proc/sys/sunrpc/rpc_debug
153 They control tracing for the NFS client, the NFS server, the Network
154 Lock Manager (lockd) and the underlying RPC layer respectively. Deci‐
155 mal numbers can be read from or written to these files. Each number
156 represents a bit-pattern where bits that are set cause certain classes
157 of tracing to be enabled. Consult the kernel header files to find out
158 what number correspond to what tracing.
159
160
162 This file system is only available in Linux 2.6 and later series ker‐
163 nels (and in the later parts of the 2.5 development series leading up
164 to 2.6). This man page does not apply to 2.4 and earlier.
165
166 Previously the nfsctl systemcall was used for communication between
167 nfsd and user utilities. That systemcall was removed in kernel version
168 3.1. Older nfs-utils versions were able to fall back to nfsctl if nec‐
169 essary; that was removed from nfs-utils 1.3.5.
170
171
173 nfsd(8), rpc.nfsd(8), exports(5), nfsstat(8), mountd(8) exportfs(8).
174
175
177 NeilBrown
178
179
180
181 3 July 2003 nfsd(7)