How to Use showmount Command to List Shares on an NFS Server

View available exports on an NFS server.

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

The showmount command provides information about mounts on an NFS server. This information is maintained by the mountd daemon on the host. The command queries the mount daemon on a remote host for information about the state of the NFS server on that machine.

Related: How To Access Linux Filesystems in Windows 10 and WSL 2

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
–all
Print 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
–directories
List directories that have been remotely mounted by clients.
-e
–exports
Print the list of exported filesystems.
-h
–help
Provide a short help summary.
–no-headersDo not print headers.
-v
–version
Report 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

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 file system that has been mounted:

showmount -a

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

showmount -d 192.168.1.10

To print the list of exported filesystems:

showmount -e 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

Bottom Line

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 Linux Knowledge