UNIX / Linux exportfs Command Examples

What is exportfs?
3 exportfs examples
Syntax and Options
Related Commands

What is exportfs?

exportfs stands for export file system, which exports file system to a remote server which can mount, and access it like a local file system.

You can also unexport the directories using exportfs command.

3 exportfs Examples

Export a directory to remote server

Export a directory to remote server using exportfs command.

# exportfs

The argument to exportfs command should be in the format of remote server ip : directory to be exported.

List out the exported directories

Executing the exportfs command without any argument displays the exported directories.

# exportfs

Unexport a exported directory

Unexport a directory using the option -u as shown below.

# exportfs -u

Syntax and Options

/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

Short Option Option Description
-a Export or unexport all directories
-o options,… Specify a list of export options in the same manner as in exports(5)
-i Ignore the /etc/exports file, so that only default options and options given on the command line are used
-r Reexport all directories. It synchronizes /var/lib/nfs/etab with /etc/exports. It removes entries in /var/lib/nfs/etab which are deleted from /etc/exports, and remove any entries from the kernel export table which are no longer valid
-u Unexport one or more directories
-f In ‘new’ mode, flush everything out of the kernels export table. Any clients that are active will get new entries added by mountd when they make their next 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

Related Commands