Servers provide access to their file systems by sharing the file systems over the NFS environment. You specify which file systems are to be shared with the share command or the /etc/dfs/dfstab file.
Entries in the /etc/dfs/dfstab file are shared automatically whenever you start NFS server operation. You should set up automatic sharing if you need to share the same set of file systems on a regular basis. For example, if your computer is a server that supports home directories, you need to make the home directories available at all times. Most file-system sharing should be done automatically. The only time that manual sharing should occur is during testing or troubleshooting.
The dfstab file lists all the file systems that your server shares with its clients. This file also controls which clients can mount a file system. You can modify dfstab to add or delete a file system or change the way sharing is done. Just edit the file with any text editor that is supported (such as vi). The next time that the computer enters run level 3, the system reads the updated dfstab to determine which file systems should be shared automatically.
Each line in the dfstab file consists of a share command—the same command that you type at the command-line prompt to share the file system. The share command is located in /usr/sbin.
Table 14–1 File-System Sharing Task Map
Task |
Description |
For Instructions |
---|---|---|
Establish automatic file-system sharing |
Steps to configure a server so that file systems are automatically shared when the server is rebooted | |
Enable WebNFS |
Steps to configure a server so that users can access files by using WebNFS | |
Enable NFS server logging |
Steps to configure a server so that NFS logging is run on selected file systems |
Become superuser or assume an equivalent role.
For information about roles, see “Using Privileged Applications” in System Administration Guide: Security Services.
Add entries for each file system to be shared.
Edit /etc/dfs/dfstab. Add one entry to the file for every file system that you want to be automatically shared. Each entry must be on a line by itself in the file and use this syntax:
share [-F nfs] [-o specific-options] [-d description] pathname |
See the dfstab(4) man page for a description of /etc/dfs/dfstab and the share_nfs(1M) man page for a complete list of options.
Check if the NFS service is running on the server.
If this is the first share command or set of share commands that you have initiated, the NFS service might not be running. Check that one of the NFS daemons is running by using the following command.
# pgrep nfsd 318 |
318 is the process ID for nfsd in this example. If an ID is not displayed, then the service is not running. The second daemon to check for is mountd.
(Optional) Start the NFS service.
If the previous step does not report a process ID for nfsd, start the NFS service by using the following command.
# /etc/init.d/nfs.server start |
This command ensures that NFS service is now running on the servers and restarts automatically when the server is at run level 3 during boot.
(Optional) Share the file system.
After the entry is in /etc/dfs/dfstab, the file system can be shared by either rebooting the system or by using the shareall command. If the NFS service was started earlier, this command does not need to be run because the init script runs the command.
# shareall |
Verify that the information is correct.
Run the share command to check that the correct options are listed:
# share - /export/share/man ro "" - /usr/src rw=eng "" - /export/ftp ro,public "" |
The next step is to set up your autofs maps so that clients can access the file systems that you have shared on the server. See Task Overview for Autofs Administration.
Starting with the 2.6 release, by default all file systems that are available for NFS mounting are automatically available for WebNFS access. The only condition that requires the use of this procedure is one of the following:
To allow NFS mounting on a server that does not already allow NFS mounting
To reset the public file handle to shorten NFS URLs by using the public option
To force the loading of a specific html file by using the index option
See Planning for WebNFS Access for a list of issues that you should consider before starting the WebNFS service.
Become superuser or assume an equivalent role.
For information about roles, see “Using Privileged Applications” in System Administration Guide: Security Services.
Add entries for each file system to be shared by using the WebNFS service.
Edit /etc/dfs/dfstab. Add one entry to the file for every file system. The public and index tags that are shown in the following example are optional.
share -F nfs -o ro,public,index=index.html /export/ftp |
See the dfstab(4) man page for a description of /etc/dfs/dfstab and the share_nfs(1M) man page for a complete list of options.
Check if the NFS service is running on the server.
If this is the first share command or set of share commands that you have initiated, the NFS daemons might not be running. Check that one of the NFS daemons is running by using the following command.
# pgrep nfsd 318 |
318 is the process ID for nfsd in this example. If an ID is not displayed, then the service is not running. The second daemon to check for is mountd.
(Optional) Start the NFS service.
If the previous step does not report a process ID for nfsd, start the NFS service by using the following command.
# /etc/init.d/nfs.server start |
This command ensures that NFS service is now running on the servers and restarts automatically when the server is at run level 3 during boot.
(Optional) Share the file system.
After the entry is in /etc/dfs/dfstab, the file system can be shared by either rebooting the system or by using the shareall command. If the NFS service was started earlier, this command does not need to be run because the script runs the command.
# shareall |
Verify that the information is correct.
Run the share command to check that the correct options are listed:
# share - /export/share/man ro "" - /usr/src rw=eng "" - /export/ftp ro,public,index=index.html "" |
Become superuser or assume an equivalent role.
For information about roles, see “Using Privileged Applications” in System Administration Guide: Security Services.
(Optional) Change file-system configuration settings.
In /etc/nfs/nfslog.conf, you can change the settings in one of two ways. You can edit the default settings for all file systems by changing the data that is associated with the global tag. Alternately, you can add a new tag for this file system. If these changes are not needed, you do not need to change this file. The format of /etc/nfs/nfslog.conf is described in nfslog.conf(4).
Add entries for each file system to be shared by using NFS server logging.
Edit /etc/dfs/dfstab. Add one entry to the file for the file system on which you are enabling NFS server logging. The tag that is used with the log=tag option must be entered in /etc/nfs/nfslog.conf. This example uses the default settings in the global tag.
share -F nfs -o ro,log=global /export/ftp |
See the dfstab(4) man page for a description of /etc/dfs/dfstab and the share_nfs(1M) man page for a complete list of options.
Check if the NFS service is running on the server.
If this is the first share command or set of share commands that you have initiated, the NFS daemons might not be running. Check that one of the NFS daemons is running by using the following command.
# pgrep nfsd 318 |
318 is the process ID for nfsd in this example. If an ID is not displayed, then the service is not running. The second daemon to check for is mountd.
(Optional) Start the NFS service.
If the previous step does not report a process ID for nfsd, start the NFS service by using the following command.
# /etc/init.d/nfs.server start |
This command ensures that NFS service is now running on the servers and restarts automatically when the server is at run level 3 during boot.
(Optional) Share the file system.
After the entry is in /etc/dfs/dfstab, the file system can be shared by either rebooting the system or by using the shareall command. If the NFS service was started earlier, this command does not need to be run because the script runs the command.
# shareall |
Verify that the information is correct.
Run the share command to check that the correct options are listed:
# share - /export/share/man ro "" - /usr/src rw=eng "" - /export/ftp ro,log=global "" |
(Optional) Start the NFS log daemon, nfslogd, if it is not running already.
Restarting the NFS daemons by using the nfs.server script starts the daemon if the nfslog.conf file exists. Otherwise, the command needs to be run once by hand to create the files so that the command automatically restarts when the server is rebooted.
# /usr/lib/nfs/nfslogd |