exportfs(8)
๐ exportfs โ the manual, but make it make sense ๐
okay bestie, so this is a page from the System Manager's Manual โ it's exportfs(8), and it's literally the girlboss who keeps your NFS exports in check. let's get into it ๐ซถ
โจ NAME โจ
exportfs โ maintain the table of exported NFS file systems
๐ธ SYNOPSIS ๐ธ
/usr/sbin/exportfs [-avi] [-o options,..] [client:/path ..]
/usr/sbin/exportfs -r [-v]
/usr/sbin/exportfs [-av] -u [client:/path ..]
/usr/sbin/exportfs [-v]
/usr/sbin/exportfs -f
/usr/sbin/exportfs -s
๐ DESCRIPTION ๐
So an NFS server keeps a whole table of local physical file systems that NFS clients are allowed to reach. every file system in that table is called an exported file system, or just an export for short. iconic, honestly.
The exportfs command is the one maintaining the current table of exports for the NFS server. the master export table lives in a file named /var/lib/nfs/etab. this file gets read by rpc.mountd when a client sends an NFS MOUNT request. ๐ซ
normally, that master export table gets initialized with the contents of /etc/exports and files under /etc/exports.d, by invoking exportfs -a. but โ plot twist โ a system administrator can also choose to add or delete exports without touching /etc/exports or the files under /etc/exports.d, just by using the exportfs command directly. main character energy fr.
here's the thing though: exportfs does not talk to the kernel directly. nope. it writes export info to /var/lib/nfs/etab and relies on its partner programs rpc.mountd and nfsv4.exportd to handle kernel communication. these daemons work in one of two modes: a netlink mode and a /proc mode. ๐ฆ
netlink mode is available on sufficiently recent kernels. in this mode, rpc.mountd (or nfsv4.exportd) communicates with the kernel via generic netlink sockets. the kernel sends multicast notifications when cache entries need to be resolved, and the daemon responds with the appropriate export information. cache flushing (via exportfs -f) is also performed over netlink. you can disable this mode with the -L option.
/proc mode is used when netlink isn't available โ then rpc.mountd manages kernel requests for info about exports via the /proc/net/rpc channel files.
โจ OPTIONS โจ
-d kindor--debug kindโ turn on debugging. valid kinds are:all,auth,call,generalandparse. debugging can also be turned on by settingdebug=in the[exportfs]section of/etc/nfs.conf. ๐-aโ export or unexport all directories.-o options,...โ specify a list of export options in the same manner as inexports(5).-iโ ignore the/etc/exportsfile and files under the/etc/exports.ddirectory. only default options and options given on the command line are used.-rโ reexport all directories, synchronizing/var/lib/nfs/etabwith/etc/exportsand files under/etc/exports.d. this option removes entries in/var/lib/nfs/etabwhich have been deleted from/etc/exportsor files under/etc/exports.d, and removes any entries from the kernel export table which are no longer valid. spring cleaning vibes ๐งน-uโ unexport one or more directories.-fโ if/proc/fs/nfsdor/proc/fs/nfsis mounted, flush everything out of the kernel's export table. fresh entries for active clients get added to the kernel's export table byrpc.mountdwhen they make their next NFS mount request.-vโ be verbose. when exporting or unexporting, show what's going on. when displaying the current export list, also display the list of export options.-sโ display the current export list, formatted suitable for/etc/exports.-Lโ disable the use of netlink for kernel communication and force the use of the legacy/procinterfaces for cache flushing and export validation.
๐ CONFIGURATION FILE ๐
The [exportfs] section of the /etc/nfs.conf configuration file can contain a debug value, which can be one or more from the list general, call, auth, parse, all. when a list is given, the members should be comma-separated.
exportfs will also recognize the state-directory-path and no-netlink values from both the [mountd] section and the [exportd] section. when no-netlink is set, exportfs will skip the netlink probe and use the legacy /proc interfaces for cache flushing and export validation.
๐ฌ DISCUSSION ๐ฌ
๐ Exporting Directories ๐
The first synopsis shows how to invoke exportfs when you're adding new entries to the export table. when using exportfs -a, all exports listed in /etc/exports and files under /etc/exports.d are added to /var/lib/nfs/etab. the kernel's export table also gets updated as needed. โจ
The host:/path argument specifies a local directory to export, along with the client or clients permitted to access it. see exports(5) for a description of supported options and access list formats.
heads up bestie: IPv6 presentation addresses contain colons, and colons are already used to separate the"host"and"path"command line arguments. when specifying a client using a raw IPv6 address, enclose the address in square brackets. for IPv6 network addresses, place the prefix just after the closing bracket. ๐ฆ
To export a directory to the world, simply specify :/path.
The export options for a particular host/directory pair derive from several sources. the default export options are sync,ro,root_squash,wdelay. these can be overridden by entries in /etc/exports or files under /etc/exports.d.
A system administrator may override options from these sources using the -o command-line option on exportfs. this option takes a comma-separated list of options in the same fashion as one would specify them in /etc/exports. so exportfs can be used to modify the export options of an already exported directory. ๐
๐ Unexporting Directories ๐
The third synopsis shows how to unexport a currently exported directory. when using exportfs -ua, all entries listed in /var/lib/nfs/etab are removed from the kernel export tables, and the file is cleared. this effectively shuts down all NFS activity. ๐ญ
To remove an export, specify a host:/path pair. this deletes the specified entry from /var/lib/nfs/etab and removes the corresponding kernel entry (if any).
When the last client for a given export path is unexported, exportfs signals the kernel to revoke NFSv4 state (opens, locks, and delegations) and release cached state for that path. without this revocation, retained state would prevent the underlying filesystem from being unmounted. affected clients receive NFS4ERR_ADMIN_REVOKED errors for operations that use revoked state. ๐
exportfs -ua does not revoke NFSv4 state, however. if nfsd is then restarted, clients may reclaim state during the grace period.
๐ Dumping the Export Table ๐
Invoking exportfs without options shows the current list of exported file systems. adding the -v option causes exportfs to display the export options for each export.
๐ฅ EXAMPLES ๐ฅ
The following adds all directories listed in /etc/exports and files under /etc/exports.d to /var/lib/nfs/etab and pushes the resulting export entries into the kernel:
# exportfs -a
To export the /usr/tmp directory to host django, allowing insecure file locking requests from clients:
# exportfs -o insecure_locks django:/usr/tmp
To unexport the /usr/tmp directory:
# exportfs -u django:/usr/tmp
To unexport all exports listed in /etc/exports and files under /etc/exports.d:
# exportfs -au
To export the /usr/tmp directory to IPv6 link-local clients:
# exportfs [fe80::]/64:/usr/tmp
โญ USAGE NOTES โญ
Exporting to IP networks or DNS and NIS domains does not enable clients from these groups to access NFS immediately. rather, these sorts of exports are hints to rpc.mountd(8) to grant any mount requests from these clients. this is usually not a problem, because any existing mounts are preserved in rmtab across reboots. no cap. ๐ซถ
When unexporting a network or domain entry, any current exports to members of this group will be checked against the remaining valid exports and, if they themselves are no longer valid, they will be removed.
๐ง FILES ๐ง
/etc/exportsโ input file listing exports, export options, and access control lists/etc/exports.dโ directory where extra input files are stored. Note: only files that end with.exportsare used./var/lib/nfs/etabโ master table of exports/var/lib/nfs/rmtabโ table of clients accessing server's exports
๐ SEE ALSO ๐
exports(5), nfs.conf(5), rpc.mountd(8), exportd(8), netgroup(5)
๐ AUTHORS ๐
- Olaf Kirch
<okir@monad.swb.de> - Neil Brown
<neilb@cse.unsw.edu.au>
and that's the whole thing, bestie โ this page is from 30 September 2013, from the exportfs(8) corner of the System Manager's Manual. slay, go forth and export responsibly ๐
โจ๐
๐ฆ where this page comes from
- arch rolling: nfs-utils 3.1.1-1 ยท GPL-2.0-or-later
- nixpkgs unstable: nfs-utils 3.1.1
- Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms