Using the exportfs Command

If used without any options, the exportfs command displays a list of exported directories. Providing options to the exportfs command let you be selective about what gets exported.

The exportfs command options include the following:

-r

Refreshes the list of exported directories in the /var/lib/nfs/etab file by incorporating any changes that were made to the list in the /etc/exports file.

-a

Exports all the directories that are specified in the /etc/exports file. This option can be combined with other options, to specify what action is performed on the directories.

-u

Unexports one or more shared directories.

Note:

The exportfs -ua command suspends NFS file sharing, but keeps all NFS services running. To reenable NFS sharing, use the exportfs -r command.

-v

Specifies verbose logging, which displays detailed information about the file systems that are being exported or unexported.

Example 2-1 Export all directories in the /etc/exports file

To export every directory share defined in the /etc/exports file:

exportfs -a 

Example 2-2 Export a single directory from the /etc/exports file

To export only the /var/projects/proj1 directory from the /etc/exports file:

exportfs /var/projects/proj1

Example 2-3 Unexport a directory defined in the /etc/exports file

To unexport the /var/projects/proj1 directory from the /etc/exports file:

exportfs -u /var/projects/proj1

Example 2-4 Show detailed information about all exported directories

To show verbose information about all the directories being exported from the /etc/exports file:

exportfs -v

For more information on the exportfs command, see the exportfs(8), exports(5), and showmount(8) manual pages.