NFS Services Administrator's Guide (B1031-90072, March 2011)

Unsharing (Removing) a Shared Directory
NOTE: Before you unshare a directory, run the showmount -a command to verify whether
any clients are accessing the shared directory. If users are accessing the shared directories, they
must exit the directories before you unshare the directory.
A directory that is shared can be unshared. You can temporarily unshare a directory using the
unshare command. If you want to remove a directory from being automatically shared at server
restart or system reboot, remove it from the /etc/dfs/dfstab file.
NOTE: To unshare all the directories without restarting the server, use the unshareall command.
This command reads the entries in the /etc/dfs/dfstab file and unshares all the shared
directories. Use the share command to verify whether all the directories are unshared.
To unshare a shared directory and to prevent it from being automatically shared, follow these
steps:
Automatic Unshare
1. Use a text editor to comment or remove the entries in the /etc/dfs/dfstab file for each
directory that you want to unshare. Users on clients cannot mount the unshared directory after
the server is rebooted.
2. To verify whether all the directories are unshared, enter the following command:
share
The directory that you have unshared should not be present in the list displayed.
Manual Unshare
1. To remove a directory from the server’s internal list of shared directories, enter the following
command:
unshare directoryname
2. To verify whether all the directories are unshared, enter the following command:
share
The directory that you have unshared should not be present in the list displayed.
Disabling the NFS Server
To disable the NFS server, follow these steps:
1. On the NFS server, enter the following command to unshare all the shared directories:
unshareall -F nfs
2. Enter the following command to disable NFS server capability:
/sbin/init.d/nfs.server stop
3. On the NFS server, edit the /etc/rc.config.d/nfsconf file to set the NFS_SERVER
variable to 0, as follows:
NFS_SERVER=0
This prevents the NFS server daemons from starting when the system reboots.
For more information about forced unmount, unmounting and unsharing, see mount_nfs (1M),
unshare(1M), and umount(1M).
Configuring and Administering NFS Clients
An NFS client is a system that mounts remote directories using NFS. When a client mounts a remote
filesystem, it does not make a copy of the filesystem. The mounting process uses a series of remote
32 Configuring and Administering NFS Services