| 1 |
.\"@(#)exportfs.8" |
| 2 |
.\" |
| 3 |
.\" Copyright (C) 1995 Olaf Kirch <[email protected]> |
| 4 |
.\" Modifications 1999-2003 Neil Brown <[email protected]> |
| 5 |
.\" |
| 6 |
.TH exportfs 8 "30 September 2013" |
| 7 |
.SH NAME |
| 8 |
exportfs \- maintain table of exported NFS file systems |
| 9 |
.SH SYNOPSIS |
| 10 |
.BI "/usr/sbin/exportfs [-avi] [-o " "options,.." "] [" "client:/path" " ..] |
| 11 |
.br |
| 12 |
.BI "/usr/sbin/exportfs -r [-v]" |
| 13 |
.br |
| 14 |
.BI "/usr/sbin/exportfs [-av] -u [" "client:/path" " ..] |
| 15 |
.br |
| 16 |
.BI "/usr/sbin/exportfs [-v] |
| 17 |
.br |
| 18 |
.BI "/usr/sbin/exportfs -f" |
| 19 |
.br |
| 20 |
.BI "/usr/sbin/exportfs -s" |
| 21 |
.br |
| 22 |
.SH DESCRIPTION |
| 23 |
An NFS server maintains a table of local physical file systems |
| 24 |
that are accessible to NFS clients. |
| 25 |
Each file system in this table is referred to as an |
| 26 |
.IR "exported file system" , |
| 27 |
or |
| 28 |
.IR export , |
| 29 |
for short. |
| 30 |
.PP |
| 31 |
The |
| 32 |
.B exportfs |
| 33 |
command maintains the current table of exports for the NFS server. |
| 34 |
The master export table is kept in a file named |
| 35 |
.IR /var/lib/nfs/etab . |
| 36 |
This file is read by |
| 37 |
.B rpc.mountd |
| 38 |
when a client sends an NFS MOUNT request. |
| 39 |
.PP |
| 40 |
Normally the master export table is initialized with the contents of |
| 41 |
.I /etc/exports |
| 42 |
and files under |
| 43 |
.I /etc/exports.d |
| 44 |
by invoking |
| 45 |
.BR "exportfs -a" . |
| 46 |
However, a system administrator can choose to add or delete |
| 47 |
exports without modifying |
| 48 |
.I /etc/exports |
| 49 |
or files under |
| 50 |
.I /etc/exports.d |
| 51 |
by using the |
| 52 |
.B exportfs |
| 53 |
command. |
| 54 |
.PP |
| 55 |
.B exportfs |
| 56 |
does not communicate with the kernel directly. |
| 57 |
It writes export information to |
| 58 |
.I /var/lib/nfs/etab |
| 59 |
and relies on its partner programs |
| 60 |
.B rpc.mountd |
| 61 |
and |
| 62 |
.B nfsv4.exportd |
| 63 |
to manage kernel communication. |
| 64 |
These daemons work in one of two modes: a netlink mode and a |
| 65 |
.I /proc |
| 66 |
mode. |
| 67 |
.PP |
| 68 |
In the netlink mode, available on sufficiently recent kernels, |
| 69 |
.B rpc.mountd |
| 70 |
(or |
| 71 |
.BR nfsv4.exportd ) |
| 72 |
communicates with the kernel via generic netlink sockets. |
| 73 |
The kernel sends multicast notifications when cache entries need to be |
| 74 |
resolved, and the daemon responds with the appropriate export |
| 75 |
information. |
| 76 |
Cache flushing (via |
| 77 |
.BR "exportfs \-f" ) |
| 78 |
is also performed over netlink. |
| 79 |
This mode can be disabled with the |
| 80 |
.B \-L |
| 81 |
option. |
| 82 |
.PP |
| 83 |
In the |
| 84 |
.I /proc |
| 85 |
mode, used when netlink is unavailable, |
| 86 |
.B rpc.mountd |
| 87 |
manages kernel requests for information about exports |
| 88 |
via the |
| 89 |
.I /proc/net/rpc |
| 90 |
channel files. |
| 91 |
.SH OPTIONS |
| 92 |
.TP |
| 93 |
.B \-d kind " or " \-\-debug kind |
| 94 |
Turn on debugging. Valid kinds are: all, auth, call, general and parse. |
| 95 |
Debugging can also be turned on by setting |
| 96 |
.B debug= |
| 97 |
in the |
| 98 |
.B [exportfs] |
| 99 |
section of |
| 100 |
.IR /etc/nfs.conf . |
| 101 |
|
| 102 |
.TP |
| 103 |
.B -a |
| 104 |
Export or unexport all directories. |
| 105 |
.TP |
| 106 |
.BI "-o " options,... |
| 107 |
Specify a list of export options in the same manner as in |
| 108 |
.BR exports (5). |
| 109 |
.TP |
| 110 |
.B -i |
| 111 |
Ignore the |
| 112 |
.I /etc/exports |
| 113 |
file and files under |
| 114 |
.I /etc/exports.d |
| 115 |
directory. Only default options and options given on the command line are used. |
| 116 |
.TP |
| 117 |
.B -r |
| 118 |
Reexport all directories, synchronizing |
| 119 |
.I /var/lib/nfs/etab |
| 120 |
with |
| 121 |
.IR /etc/exports |
| 122 |
and files under |
| 123 |
.IR /etc/exports.d . |
| 124 |
This option removes entries in |
| 125 |
.I /var/lib/nfs/etab |
| 126 |
which have been deleted from |
| 127 |
.I /etc/exports |
| 128 |
or files under |
| 129 |
.IR /etc/exports.d , |
| 130 |
and removes any entries from the |
| 131 |
kernel export table which are no longer valid. |
| 132 |
.TP |
| 133 |
.B -u |
| 134 |
Unexport one or more directories. |
| 135 |
.TP |
| 136 |
.B -f |
| 137 |
If |
| 138 |
.I /proc/fs/nfsd |
| 139 |
or |
| 140 |
.I /proc/fs/nfs |
| 141 |
is mounted, flush everything out of the kernel's export table. |
| 142 |
Fresh entries for active clients are added to the kernel's export table by |
| 143 |
.B rpc.mountd |
| 144 |
when they make their next NFS mount request. |
| 145 |
.TP |
| 146 |
.B -v |
| 147 |
Be verbose. When exporting or unexporting, show what's going on. When |
| 148 |
displaying the current export list, also display the list of export |
| 149 |
options. |
| 150 |
.TP |
| 151 |
.B -s |
| 152 |
Display the current export list suitable for /etc/exports. |
| 153 |
.TP |
| 154 |
.B -L |
| 155 |
Disable the use of netlink for kernel communication and force the use |
| 156 |
of the legacy |
| 157 |
.I /proc |
| 158 |
interfaces for cache flushing and export validation. |
| 159 |
|
| 160 |
.SH CONFIGURATION FILE |
| 161 |
The |
| 162 |
.B [exportfs] |
| 163 |
section of the |
| 164 |
.I /etc/nfs.conf |
| 165 |
configuration file can contain a |
| 166 |
.B debug |
| 167 |
value, which can be one or more from the list |
| 168 |
.BR general , |
| 169 |
.BR call , |
| 170 |
.BR auth , |
| 171 |
.BR parse , |
| 172 |
.BR all . |
| 173 |
When a list is given, the members should be comma-separated. |
| 174 |
|
| 175 |
.B exportfs |
| 176 |
will also recognize the |
| 177 |
.B state-directory-path |
| 178 |
and |
| 179 |
.B no\-netlink |
| 180 |
values from both the |
| 181 |
.B [mountd] |
| 182 |
section and the |
| 183 |
.B [exportd] |
| 184 |
section. |
| 185 |
When |
| 186 |
.B no\-netlink |
| 187 |
is set, |
| 188 |
.B exportfs |
| 189 |
will skip the netlink probe and use the legacy |
| 190 |
.I /proc |
| 191 |
interfaces for cache flushing and export validation |
| 192 |
|
| 193 |
.SH DISCUSSION |
| 194 |
.SS Exporting Directories |
| 195 |
The first synopsis shows how to invoke |
| 196 |
.B exportfs |
| 197 |
when adding new entries to the export table. When using |
| 198 |
.BR "exportfs -a" , |
| 199 |
all exports listed in |
| 200 |
.I /etc/exports |
| 201 |
and files under |
| 202 |
.I /etc/exports.d |
| 203 |
are added to |
| 204 |
.IR /var/lib/nfs/etab . |
| 205 |
The kernel's export table is also updated as needed. |
| 206 |
.PP |
| 207 |
The |
| 208 |
.I host:/path |
| 209 |
argument specifies a local directory to export, |
| 210 |
along with the client or clients who are permitted to access it. |
| 211 |
See |
| 212 |
.B exports(5) |
| 213 |
for a description of supported options and access list formats. |
| 214 |
.PP |
| 215 |
IPv6 presentation addresses contain colons, which are already used |
| 216 |
to separate the "host" and "path" command line arguments. |
| 217 |
When specifying a client using a raw IPv6 address, |
| 218 |
enclose the address in square brackets. |
| 219 |
For IPv6 network addresses, place the prefix just after the closing |
| 220 |
bracket. |
| 221 |
.PP |
| 222 |
To export a directory to the world, simply specify |
| 223 |
.IR :/path . |
| 224 |
.PP |
| 225 |
The export options for a particular host/directory pair derive from |
| 226 |
several sources. |
| 227 |
The default export options are |
| 228 |
.BR sync,ro,root_squash,wdelay . |
| 229 |
These can be overridden by entries in |
| 230 |
.IR /etc/exports |
| 231 |
or files under |
| 232 |
.IR /etc/exports.d . |
| 233 |
.PP |
| 234 |
A system administrator may override options from these sources using the |
| 235 |
.B -o |
| 236 |
command-line option on |
| 237 |
.BR exportfs . |
| 238 |
This option takes a comma-separated list of options in the same fashion |
| 239 |
as one would specify them in |
| 240 |
.IR /etc/exports . |
| 241 |
In this way |
| 242 |
.B exportfs |
| 243 |
can be used to modify the export options of an already exported directory. |
| 244 |
.SS Unexporting Directories |
| 245 |
The third synopsis shows how to unexport a currently exported directory. |
| 246 |
When using |
| 247 |
.BR "exportfs -ua" , |
| 248 |
all entries listed in |
| 249 |
.I /var/lib/nfs/etab |
| 250 |
are removed from the kernel export tables, and the file is cleared. This |
| 251 |
effectively shuts down all NFS activity. |
| 252 |
.PP |
| 253 |
To remove an export, specify a |
| 254 |
.I host:/path |
| 255 |
pair. This deletes the specified entry from |
| 256 |
.I /var/lib/nfs/etab |
| 257 |
and removes the corresponding kernel entry (if any). |
| 258 |
.PP |
| 259 |
.SS Dumping the Export Table |
| 260 |
Invoking |
| 261 |
.B exportfs |
| 262 |
without options shows the current list of exported file systems. |
| 263 |
Adding the |
| 264 |
.B -v |
| 265 |
option causes |
| 266 |
.B exportfs |
| 267 |
to display the export options for each export. |
| 268 |
.SH EXAMPLES |
| 269 |
The following adds all directories listed in |
| 270 |
.I /etc/exports |
| 271 |
and files under |
| 272 |
.I /etc/exports.d |
| 273 |
to |
| 274 |
.I /var/lib/nfs/etab |
| 275 |
and pushes the resulting export entries into the kernel: |
| 276 |
.PP |
| 277 |
.nf |
| 278 |
.B "# exportfs -a |
| 279 |
.fi |
| 280 |
.PP |
| 281 |
To export the |
| 282 |
.I /usr/tmp |
| 283 |
directory to host |
| 284 |
.BR django , |
| 285 |
allowing insecure file locking requests from clients: |
| 286 |
.PP |
| 287 |
.nf |
| 288 |
.B "# exportfs -o insecure_locks django:/usr/tmp |
| 289 |
.fi |
| 290 |
.PP |
| 291 |
To unexport the |
| 292 |
.I /usr/tmp |
| 293 |
directory: |
| 294 |
.PP |
| 295 |
.nf |
| 296 |
.B "# exportfs -u django:/usr/tmp |
| 297 |
.fi |
| 298 |
.PP |
| 299 |
To unexport all exports listed in |
| 300 |
.IR /etc/exports |
| 301 |
and files under |
| 302 |
.IR /etc/exports.d : |
| 303 |
.PP |
| 304 |
.nf |
| 305 |
.B "# exportfs -au |
| 306 |
.fi |
| 307 |
.PP |
| 308 |
To export the |
| 309 |
.I /usr/tmp |
| 310 |
directory to IPv6 link-local clients: |
| 311 |
.PP |
| 312 |
.nf |
| 313 |
.B "# exportfs [fe80::]/64:/usr/tmp |
| 314 |
.fi |
| 315 |
.SH USAGE NOTES |
| 316 |
Exporting to IP networks or DNS and NIS domains does not enable clients |
| 317 |
from these groups to access NFS immediately. |
| 318 |
Rather, these sorts of exports are hints to |
| 319 |
.BR rpc.mountd (8) |
| 320 |
to grant any mount requests from these clients. |
| 321 |
This is usually not a problem, because any existing mounts are preserved in |
| 322 |
.I rmtab |
| 323 |
across reboots. |
| 324 |
.PP |
| 325 |
When unexporting a network or domain entry, any current exports to members |
| 326 |
of this group will be checked against the remaining valid exports and |
| 327 |
if they themselves are no longer valid they will be removed. |
| 328 |
.SH FILES |
| 329 |
.TP 2.5i |
| 330 |
.I /etc/exports |
| 331 |
input file listing exports, export options, and access control lists |
| 332 |
.TP 2.5i |
| 333 |
.I /etc/exports.d |
| 334 |
directory where extra input files are stored. |
| 335 |
.B Note: |
| 336 |
only files that end with |
| 337 |
.I .exports |
| 338 |
are used. |
| 339 |
.TP 2.5i |
| 340 |
.I /var/lib/nfs/etab |
| 341 |
master table of exports |
| 342 |
.TP 2.5i |
| 343 |
.I /var/lib/nfs/rmtab |
| 344 |
table of clients accessing server's exports |
| 345 |
.SH SEE ALSO |
| 346 |
.BR exports (5), |
| 347 |
.BR nfs.conf (5), |
| 348 |
.BR rpc.mountd (8), |
| 349 |
.BR exportd (8), |
| 350 |
.BR netgroup (5) |
| 351 |
.SH AUTHORS |
| 352 |
Olaf Kirch <[email protected]> |
| 353 |
.br |
| 354 |
Neil Brown <[email protected]> |