exportfs command is a Linux utility that is used to manage the list of Network File System (NFS) shared filesystems in a Linux system. NFS is a distributed file system protocol that allows a user on a client computer to access files over a network as if those files were on the local computer. The
exportfs command is used to specify which directories on the server are shared with clients and to configure how they are accessed.
To use the
exportfs command, you must have root privileges. The basic syntax for the command is:
exportfs [options] [directories]
exportfs command can be used to add, modify, or remove NFS shared filesystems. To add a new shared filesystem, you need to specify the directory that you want to share and the options that you want to use. For example, to share the directory
/data with read-only access, you would use the following command:
exportfs -ro /data
To modify an existing shared filesystem, you can use the same command but with different options. For example, to change the access to read-write, you would use the following command:
exportfs -rw /data
To remove a shared filesystem, you can use the
-u option followed by the directory that you want to remove. For example, to remove the
/data directory from the list of shared filesystems, you would use the following command:
exportfs -u /data
You can also use the
exportfs command to display the current list of shared filesystems by using the
-v option. For example:
This will display a list of all the directories that are currently shared, along with their access options.
The following table lists the available options for the
|-a||Export all directories listed in
|-u||Unexport a directory|
|-o||Specify export options|
|-r||Reexport all directories listed in
|-v||Verbose mode (display current list of shared filesystems)|
|-h||Display help message|
Here are some troubleshooting tips for common issues with the
- If you are having trouble accessing a shared filesystem from a client computer, make sure that the directory is listed in the
/etc/exportsfile on the server and that the options are set correctly.
- If you are having trouble exporting a directory, make sure that the directory exists and that you have permission to access it.
- If you are having trouble with NFS in general, make sure that the NFS service is running on both the server and the client computers.
exportfscommand is typically used in conjunction with the
/etc/exportsfile, which lists the directories that are shared and the options that are used.
- When you modify the
/etc/exportsfile, you must run the
exportfscommand to update the list of shared filesystems.
exportfscommand only exports directories that are listed in the
/etc/exportsfile. If you want to share a directory that is not listed in the file, you must add it to the file first.