How to Use Showmount Command to Display Shares From an NFS Server

How to Use Showmount Command to Display Shares From an NFS Server

The command showmount provides information about mounts on an NFS server. This information is maintained by the mountd server on the host. The default value for the host is the value returned by the hostname. With no options, show the clients that have mounted directories from the host. Showmount is usually found in /usr/sbin, which is not in the default search path.

Showmount Command Options

The options available with the showmount command are as follows:

OptionDescription
-a, –allPrint all remote mounts in the format hostname:directory, where hostname is the name of the client and directory is the root of the filesystem that has been mounted.
-d, –directoriesList directories that have been remotely mounted by clients.
-e, –exportsPrint the list of exported filesystems.
-h, –helpProvide a short help summary.
–no-headersDo not print headers.
-v, –versionReport the current version of the program.

List of the most commonly used examples of showmount

To get the list of available options and usage of the command:

showmount -h
showmount --help

To list the remote mounts in the format hostname:directory, where hostname is the name of the client and directory is the root of the filesystem that has been mounted:

showmount -a
showmount --all

If you only want to list the directories mounted by remote clients, use the -d option:

showmount -d 192.168.1.10
showmount --directories 192.168.1.10

To print the list of exported filesystems:

showmount -e 192.168.1.10
showmount --exports 192.168.1.10

To remove the header from the showmount command output, use the -h option:

showmount --no-headers

Get the version of the showmount command/package being used:

showmount -v
showmount --version

In conclusion, the information given by showmount can sometimes include stale information about old mounts that are no longer present. This can happen, for example, if a client reboots without unmounting the NFS mount. In this case, to correct this situation, you can, if necessary, remove the file /var/lib/nfs/rmtab on the server and restart the NFS server.

Leave a Reply

Your email address will not be published.

Latest from Tips & Tricks