Contained Within
Find More Documentation
Featured Support Resources
| Download this book in PDF
NFS Administration
2
- This chapter provides an introduction to the NFS commands. This chapter also provides information on how to perform such NFS administration tasks as setting up NFS servers, adding new file systems to share, unsharing file systems, displaying shared local file systems, and displaying mounted file systems. It assumes you are using NIS or NIS+ as your name service.
-
- Your responsibilities as an NFS administrator depend on your site's requirements and the role of your computer on the network. You may be responsible for all the computers on your local network, in which case you may be responsible for the major tasks involved in NFS administration:
-
- Determining which computers, if any, should be dedicated servers
- Which should act as both servers and clients
- Which should be clients only
- Maintaining a server once it has been set up involves the following tasks:
-
- Sharing and unsharing file systems as necessary
- Modifying administrative files to update the lists of file systems your computer shares or mounts automatically
- Checking the status of the network
- Diagnosing and fixing NFS-related problems as they arise - see to Chapter 4, "NFS Troubleshooting"
- Setting up maps for autofs - see Chapter 5, "Using Autofs"
- Remember, a computer can be both a server and a client--sharing local file systems with remote computers and mounting remote file systems.
NFS Files
- Several ASCII files are needed to support NFS activities on any computer. Table 2-1 lists these files and their function.
-
Table 2-1
| File Name | Function |
| /etc/vfstab | Defines file systems to be mounted locally (see the vfstab(4) man page) |
| /etc/mnttab | Lists file systems that are currently mounted including automounted directories (see the mnttab(4) man page); do not edit this file |
| /etc/rmtab | Lists file systems remotely mounted by NFS clients (see the rmtab(4) man page); do not edit this file |
| /etc/default/fs | Lists the default file system type for local file systems |
| /etc/dfs/dfstab | Lists the local resources to be shared |
| /etc/dfs/fstypes | Lists the default file system types for remote file systems |
| /etc/dfs/sharetab | Lists the resources (local and remote) that are shared (see
the sharetab(4) man page); do not edit this file |
- The first entry in /etc/dfs/fstypes is often used as the default file system type for remote file systems. This entry defines the NFS file system type as the default.
- There is only one entry in /etc/default/fs: the default file system type for local disks. The file system types that are supported on a client or server can be determined by checking the files in /kernel/fs.
NFS Daemons
- To support NFS activities, several daemons are started when a system goes into run level 3 or multiuser mode. Two of these daemons (mountd and nfsd) are run on systems that are NFS servers. The automatic startup of the server daemons depends on the existence of entries labeled with the NFS file system type in /etc/dfs/sharetab.
- The other two daemons (lockd and statd) are run on NFS clients to support NFS file locking. These daemons must also run on the NFS servers.
-
-
lockd
- This daemon supports record locking operations on NFS files. It will send locking requests from the client to the NFS server. On the NFS server, it will start local locking. The daemon is normally started without any options. The command syntax is:
-
lockd [ -g graceperiod ] [ -t timeout ]
- where graceperiod selects the number of seconds that the clients have to reclaim locks after the server reboots, and timeout selects the number of seconds to wait before retransmitting a lock request to the remote server. The default value for graceperiod is 45 seconds. Reducing this value means that NFS clients can resume operation more quickly after a server reboot, but it increases the chances that a client might not be able to recover all of its locks. The default value for timeout is 15 seconds. Decreasing the timeout value can improve response time for NFS clients on a noisy network, but it can cause additional server load by increasing the frequency of lock requests.
-
-
mountd
- This is an RPC server that handles file system mount requests from remote systems. It checks /etc/dfs/sharetab to determine which file systems are available for remote mounting and which systems are allowed to do the remote mounting. There are no options to select with this daemon.
-
-
nfsd
- This daemon handles other client file system requests. The command syntax is:
-
nfsd [ -a ] [ -p protocol ] [ -t device ] [ -c #_conn ] [ nservers ]
- where -a indicates to start a daemon over all available transports, protocol selects a specific protocol to run the daemon over, device chooses a specific transport for the daemon, -c #_conn selects the maximum number of connections per connection-oriented transport, and nservers is the maximum number of concurrent requests that a server can handle. The default value for #_conn is unlimited. The default value for nservers is 1, but the startup scripts select 16.
- Unlike older versions of this daemon, nfsd does not spawn multiple copies to handle concurrent requests. Checking the process table with ps will only show one copy of the daemon running.
-
-
statd
- This daemon works with lockd to provide crash and recovery functions for the lock manager. It keeps track of the clients that hold locks on a NFS server. If a server crashes, upon rebooting statd on the server will contact statd on the client. The client statd can then attempt to reclaim any locks on the server. The client statd will also inform the server statd when a client has crashed, so that the client's locks on the server can be cleared. There are no options to select with this daemon.
NFS Commands
- These commands must be run as root to be fully effective, but requests for information can be made by all users:
-
-
mount
- With this command, you can attach a named file system, either local or remote, to a specified mount point. For more information, see the mount(1M) man page.
- Used without arguments, mount displays a list of file systems that are currently mounted on your computer. The syntax is:
-
mount [ -F FSType ] [ generic_options ] [ -o specific_options ] resource mount_point
- where -F FSType specifies the file system type to be accessed, generic_options selects options that are not specific to the type of file system that regulates how the file system will be accessed, -o specific_options indicates access options that are specific to each file system type, resource is the name of the file system to be accessed, and mount_point is the place on the local file system to which the file system will be attached.
- Many types of file systems are included in the standard Solaris installation. For a complete description of all of the file system types, see System Administration Guide, Volume I. Some available options are listed in Table 2-2.
-
Table 2-2 mount
| FSType Selection | File System Type Description |
| cachefs | Cache file system using local disks to store information from a remote system for faster access and less net traffic |
| hsfs | High Sierra file system used on CD-ROMs |
| nfs | Default SunOS distributed file system |
| pcfs | PC file system created on a DOS system |
| s5fs | System V file system used by PC versions of UNIX |
| tmpfs | Temporary file system using local memory for the file system |
| ufs | UNIX file system is the SunOS default for local disks |
- The mount command includes options that are file system specific and some that are not. The options that are not file system specific are sometimes called the generic options. These options are shown in Table 2-3.
-
Table 2-3 mount
| Generic Option | Description |
| -m | Mounts without creating an entry in /etc/mnttab |
| -r | Mounts read-only |
| -o | Includes FSType-specific options in a comma separated list |
| -O | Overlays mount on top of file system already mounted |
- The list of options that may be included with the -o flag are different for each file system type. Each file system type has a specific mount man page which lists these options. The man page for NFS file systems is mount_nfs(1M), for UFS file systems it is mount_ufs(1M), and so forth.
mount Options for NFS File Systems
- Listed below are some of the most commonly used options that can follow the -o flag when mounting an NFS file system.
-
-
bg|fg
- If the first mount attempt fails, retry in the background (bg) or foreground (fg). The default is fg, which is the best selection for file systems that must be available. It prevents further processing until the mount is complete. bg is a good selection for file systems that are not critical, because the client will do other processing while waiting for the mount request to complete.
-
-
intr|nointr
Allow (intr) or disallow (nointr) keyboard interruption to kill a process
that is hung while waiting for a hard-mounted file system. Default is intr.
The intr option makes it possible for clients to interrupt applications
which may be waiting for a remote mount.
noac
- Suppress attribute caching, so attributes are always up-to-date. This allows for the mail delivery and mail user agents to lock mail files properly.
-
-
proto=netid
- Select the transport protocol to be used. The value for netid must be listed in /etc/netconfig. Possible values are udp or tcp. TCP will be selected by default.
-
-
quota|noquota
- Execution of quota is enabled or disabled (see the quota(1M) man page). If the file system is on a remote server that has quota enabled, quota will be run regardless of how it is mounted locally. Running quota is the default.
-
-
rsize=#
Select the read buffer size in bytes. The default is 8 Kbytes for Version 2 and
32 Kbytes for Version 3.
wsize=#
- Select the write buffer siz in bytes. The default is 8 Kbytes for Version 2, and 32 Kbytes for Version 3.
-
Warning - Third party Ethernet cards, can not always support the 8-Kbyte buffer size so it may be necessary to select a proper rsize and wsize value.
-
-
rw|ro
- The file system is to be mounted read-write or read-only. The default is read-write, which is the appropriate option for remote home directories, mail-spooling directories or other file systems that will be need to be changed by the users. The read-only option is appropriate for directories that should not be changed by the users, for example, shared copies of the man pages should not be writable by the users.
-
-
soft|hard
- An NFS file system mounted with the soft option will return an error if the server does not respond. The hard option will cause the mount to continue to retry until the server responds. The default is hard which should be used for most file systems. Applications frequently do not check return values from soft mounted file systems, which can make the application fail or can lead to corrupted files. Even if the application does check, routing problems and other conditions can still confuse the application or lead to file
- corruption if the soft option is used. In most cases the soft option should not be used. If a file system is unavailable, an application using this file system may hang if the hard option is selected until the file system becomes available.
-
-
suid|nosuid
setuid execution on the file system is allowed or disallowed. Allowing
suid execution is the default. This is a potential security problem.
vers=#
- Select the version of the NFS protocol to be used (either 2 or 3). Version 3 will automatically be selected if it is supported by the client and the server. This option can be used to force a specific version.
Additional mount Options
- The mount command includes some options that do not require a file system type to be specified in the command line. These are described below.
-
-a [ mount_points ]
- Attempts to mount the selected mount_points in parallel if possible. If mount_points are not given then all entries in /etc/vfstab that should be mounted at boot are tried. If the -F nfs option is included then all file system that are listed as nfs type in /etc/vfstab are mounted. Selecting -F ufs mounts only the local file systems.
-
-
-p
Prints a list of the mounted file systems in a format appropriate for the
/etc/vfstab file. This is useful for adding entries to the file without
mistakes. This option cannot be used with others.
-v
- Displays a more verbose listing of the currently mounted file systems. The information is much like that displayed when no options are used, but it includes the type of file system. This option cannot be used with others.
-
-
-V
- Echoes the command line but will not execute it. This command can be useful when verifying configurations and needed command lines.
Using the mount Command
- Both of these commands will mount an NFS file system from the server bee read-only:
-
# mount -F nfs -r bee:/export/share/man /usr/man
|
-
# mount -F nfs -o -ro bee:/export/share/man /usr/man
|
- This command will force the man pages from the server bee to be mounted on the local system even if /usr/man has already been mounted on:
-
# mount -F nfs -O bee:/export/share/man /usr/man
|
- Use the mount command with no arguments to display file systems mounted on a client.
-
% mount
/ on /dev/dsk/c0t3d0s0 read/write/setuid on Tues Jan 24 13:20:47 1995
/usr on /dev/dsk/c0t3d0s6 read/write/setuid on Tues Jan 24 13:20:47 1995
/proc on /proc read/write/setuid on Tues Jan 24 13:20:47 1995
/dev/fd on fd read/write/setuid on Tues Jan 24 13:20:47 1995
/tmp on swap read/write on Tues Jan 24 13:20:51 1995
/opt on /dev/dsk/c0t3d0s5 setuid/read/write on Tues Jan 24 13:20:51 1995
/home/kathys on bee:/export/home/bee7/kathys
intr/noquota/nosuid/remote on Tues Jan 24 13:22:13 1995
|
umount
- This command allows you to remove a remote file system that is currently mounted. The syntax of the command is:
-
umount [ -o specific_options ] resource | mount_point
- where -o specific_options indicates options that are specific to each file system type, resource is the name of the file system to be disconnected, and mount_point is the place on the local file system to which the file system is attached.
- Like mount, umount supports the -o and -V options to allow for extra options and for testing. The extra options selected with the -o option should not be necessary to uniquely identify the file system if entries are kept current in /etc/mnttab. The -a option may also be used, but it behaves differently. If mount_points are included with the -a option, then those file systems are unmounted. If no mount points are included, then an attempt is made to unmount all file systems listed in /etc/mnttab, except for the "required" file systems, such as /, /usr, /var, /proc, /dev/fd, and /tmp.
- Since the file system is already mounted and should have any entry in /etc/mnttab there is no need to include a flag for the file system type.
- The command will not succeed if the file system is in use. For instance, if a user has used cd to get access to a file system, the file system will be busy until they change their working directory. The umount command may hang temporarily if the NFS server is unreachable.
Using the umount Command
- This example unmounts a file system mounted on /usr/man:
-
- This example displays the results of running umount -a -V:
-
# umount -a -V
umount /home/kathys
umount /opt
umount /home
umount /net
|
mountall
- Use this command to mount all file systems specified in a file system table. The syntax of the command is:
-
-
mountall [ -F FSType ] [ -l | -r ] [ file_system_table ]
- where -F FSType specifies the file system type to be accessed, -l indicates that only local file systems are to be used, -r indicates that only remote file systems are to be used, and file_system_table selects an alternate to /etc/vfstab.
Using the mountall Command
- These two examples are equivalent:
-
-
umountall
- Use this command to unmount a group of file systems. The syntax of the command is:
-
-
umountall [ -k ] [ -s ] [ -F FSType ] [ -l | -r ]
umountall [ -k ] [ -s ] [ -h host ]
- where -k indicates that the fuser -k mount_point command should be used to kill any processes associated with the mount_point, -s indicates that unmount is not to be performed in parallel, -F FSType specifies the file system type to be
- unmounted, -l specifies that only local file systems are to be used, and -r specifies that only remote file systems are to be used. The -h host option indicates that all file systems from the named host should be unmounted. The -h option can not be combined with -F, -l or -r.
Using the umountall Command
- This command unmounts all file systems that are mounted from remote hosts:
-
- This command unmounts all file systems currently mounted from the server bee:
-
share
- With this command, you can make a local file system on an NFS server available for mounting. You can also use the share command to display a list of the file systems on your system that are currently shared. The command has this syntax:
-
share [ -F FSType ] [ -o specific_options ][ -d description ] pathname
- where -F FSType indicates the type of file system that is to be shared, -o specific_options is a comma-separated list of options that regulates how the file system is shared, description is a comment that describes the file system to be shared, and pathname is the full name of the file system to be shared, starting at root (/). If the -F option is not used, then /etc/dfs/fstypes is checked to determine the default file system type (normally this is set to NFS).
- The NFS server must be running for the share command to work. The NFS server software is started automatically during boot if there is an entry in /etc/dfs/dfstab. The command will not report an error if the NFS server software is not running, so you must check this yourself.
- The objects that can be shared include any directory tree, but each file system hierarchy is limited by the disk slice or partition that the file system is located on. For instance, sharing the root (/) file system would not also share /usr, unless they are on the same disk partition or slice. Normal installation places root on slice 0 and /usr on slice 6. Also, sharing /usr would not share any other local disk partitions that are mounted on subdirectories of /usr.
- A file system can not be shared that is part of a larger file system that is already shared. For example, if /usr and /usr/local are on one disk slice, then /usr can be shared or /usr/local can be shared, but if both need to be shared with different share options then /usr/local will need to be moved to a separate disk slice.
-
Warning - It is possible to gain access to a file system which is shared read-only through the file handle of a file system that is shared read-write if the two file systems are on the same disk slice. It is more secure to place those file systems that need to be read-write on a separate partition or disk slice than the file systems that you need to share read-only.
share Options
- The options that can be included with the -o flag are:
-
-
rw|ro
The pathname file system is shared read-write or read-only to all clients
rw=client[:client]...
- The file system is shared read-write to the listed clients only. All other requests are denied. Netgroup names can be used instead of client names in most cases. Netgroup names may not be used in rw=list if there is also a ro=list in the option string. This same type of entry can be used with the ro option.
share Options for NFS File Systems
- The options that can be used with NFS file systems only include:
-
-
anon=uid
- where uid is used to select the user ID of unauthenticated users. If uid is set to -1, access is denied to unauthenticated users. Authentication is explained further in Chapter 3, "Setting Up and Maintaining NFS Security." Root access can be granted by setting anon=0, but this will allow unauthenticated users to have root access, so use the root option instead.
-
-
root=host[:host]....
Root access is given to the hosts in the list. By default, no remote host is
given root access. Netgroup names can not be used with the root option.
-
Caution - Granting root access to other hosts has far-reaching security implications; use the root= option with extreme caution.
-
-
nosuid
This option signals that all attempts to enable the setuid or setgid mode
should be ignored.
aclok
- This option allows the NFS server to do access control for NFS Version 2 clients (running SunOS 2.4 or earlier releases). Without this option minimal access is given to all clients. With this option maximal access is given to the clients. For instance, with aclok set on the server, if anyone has read permissions, then everyone does. See System Administration Guide, Volume I for more information about ACLs.
-
Note - To take advantage of ACLs, it is best to have clients and servers run software that supports the NFS Version 3 and NFS_ACL protocols. If the software only supports the NFS Version 3 protocol, then clients will get correct access, but will not be able to manipulate the ACLs. If the software supports the NFS_ACL protocol, then the client will get correct access and the ability to manipulate the ACLs. The Solaris 2.5 release supports both protocols.
Using the share Command
- To list the file systems that are shared on the local system, use the share command without options. The -F FSType option used alone lists all of the file systems of that specific type that are being shared.
-
# share
- /export/share/man ro ""
- /usr/src rw=eng ""
|
- The command below provides read-only access for most systems but allows read-write access for rose and lilac:
-
# share -F nfs -o ro,rw=rose:lilac /usr/src
|
- In the next example, read-only access is assigned to any host in the eng netgroup. The client rose is specifically given read-write access.
-
# share -F nfs -o ro=eng,rw=rose /usr/src
|
- If both the ro=list and rw=list options are used, only the ro entry may include a netgroup name. In the previous example, rw is used to add write access for only one host. For more information about netgroups, see System Administration Guide, Volume I.
-
Note - You cannot specify both rw and ro without arguments, and you cannot specify the same client in the rw=list and the ro=list. If no read-write option is specified, the default is read-write for all clients.
- To share one file system with multiple clients, all options must be entered on the same line, since multiple invocations of the share command on the same object will "remember" only the last command run. This command will allow read-write access to three client systems, but only rose and tulip are given access to the file system as root.
-
# share -F nfs -o rw=rose:lilac:tulip,root=rose:tulip /usr/src
|
unshare
- This command allows you to make a previously available file system unavailable for mounting by clients. The syntax of the command is:
-
unshare [ -F FSType ] [ -o specific_options ] [ pathname ]
- where -F FSType indicates the type of file system that is to be made unavailable, -o specific-options is a comma-separated list of options specific to the file system, and pathname is the full name of the file system.
- The unshare command can be used to unshare any file system--whether the file system was shared explicitly with the share command or automatically through /etc/dfs/dfstab. If you use the unshare command to unshare a file system that you shared through the dfstab file, remember that it will be shared again when you exit and re-enter run level 3. The entry for this file system must be removed from the dfstab file if the change is to continue.
- When you unshare an NFS file system, access from clients with existing mounts is inhibited. The file system may still be mounted on the client, but the files will not be accessible.
Using the unshare Command
- This command unshares a specific file system:
-
shareall
- This command allows for multiple file systems to be shared. When used with no options, the command will share all entries in /etc/dfs/dfstab. The syntax of the command is:
-
-
shareall [ -F FSType[,FSType...]] [ file ]
- where -F FSType is a list of file system types defined in /etc/dfs/fstypes and file is a name of a file that lists share command lines. If file is not included /etc/dfs/dfstab is checked. If a "-" is used for file, then share commands may be entered from standard input.
Using the shareall Command
- This command shares all file systems listed in a local file:
-
# shareall /etc/dfs/special_dfstab
|
unshareall
- This command will make all currently shared resources unavailable. This is the command syntax:
-
-
unshareall [ -F FSType[,FSType...]
- where -F FSType is a list of file system types defined in /etc/dfs/fstypes. This flag allows you to choose only certain types of file systems to be unshared. The default file system type is defined in /etc/dfs/fstypes. To choose specific file systems, use the unshare command.
Using the unshareall Command
- This example should unshare all NFS type file systems:
-
showmount
- This command displays all the clients that have remotely mounted file systems that are shared from an NFS server, or only the file systems that are mounted by clients, or the shared file systems with the client access information. The command syntax is:
-
-
showmount [ -ade ] [ hostname ]
- where -a prints a list all of the remote mounts (each entry includes the client name and the directory), -d prints a list of the directories that are remotely mounted by clients, -e prints a list of the files shared (or exported), and hostname selects the NFS server to gather the information from. If hostname is not specified then the local host is queried.
Using the showmount Command
- This command lists all clients and the directory that they have mounted.
-
# showmount -a bee
lilac:/export/share/man
lilac:/usr/src
rose:/usr/src
tulip:/export/share/man
|
- This command lists the directories that have been mounted.
-
# showmount -d bee
/export/share/man
/usr/src
|
- This command lists file systems that have been shared.
-
# showmount -e bee
/usr/src (everyone)
/export/share/man eng
|
setmnt
- This command creates an /etc/mnttab table. The table is consulted by the mount and umount commands. Generally, there is no reason to run this command by hand; it is run automatically when a system is booted.
Other Useful Commands
- These commands can be useful when troubleshooting NFS problems.
-
nfsstat
- This command can be used to gather statistical information about NFS and RPC connections. The syntax of the command is:
-
-
nfsstat [ -cmnrsz ]
- where -c displays client side information, -m displays statistics for each NFS mounted file system, -n specifies that NFS information is to be displayed (both client and server side), -r displays RPC statistics, -s displays the server side information, and -z specifies that the statistics should be set to zero. If no options are supplied on the command line, the -cnrs options are used.
- Gathering server side statistics can be very important for debugging problems when new software or hardware are added to the computing environment. Running this command, at least once a week, and storing the numbers will provide a good history of previous performance.
Using the nfsstat Command
-
# nfsstat -s
Server rpc:
Connection oriented:
calls badcalls nullrecv badlen xdrcall dupchecks dupreqs
11420263 0 0 0 0 1428274 19
Connectionless:
calls badcalls nullrecv badlen xdrcall dupchecks dupreqs
14569706 0 0 0 0 953332 1601
Server nfs:
calls badcalls
24234967 226
Version 2: (13073528 calls)
null getattr setattr root lookup readlink read
138612 1% 1192059 9% 45676 0% 0 0% 9300029 71% 9872 0% 1319897 10%
wrcache write create remove rename link symlink
0 0% 805444 6% 43417 0% 44951 0% 3831 0% 4758 0% 1490 0%
mkdir rmdir readdir statfs
2235 0% 1518 0% 51897 0% 107842 0%
Version 3: (11114810 calls)
null getattr setattr lookup access readlink read
141059 1% 3911728 35% 181185 1% 3395029 30% 1097018 9% 4777 0% 960503 8%
write create mkdir symlink mknod remove rmdir
763996 6% 159257 1% 3997 0% 10532 0% 26 0% 164698 1% 2251 0%
rename link readdir readdir+ fsstat fsinfo pathconf
53303 0% 9500 0% 62022 0% 79512 0% 3442 0% 34275 0% 3023 0%
commit
73677 0%
Server nfs_acl:
Version 2: (1579 calls)
null getacl setacl getattr access
0 0% 3 0% 0 0% 1000 63% 576 36%
Version 3: (45318 calls)
null getacl setacl
0 0% 45318 100% 0 0%
|
- This is an example of NFS server statistics. The first five lines deal with RPC and the rest of them report NFS activities. In both sets of statistics knowing the
- average number of badcalls/calls and the number of calls/week, can help identify when something is going wrong. The badcalls value reports the number of bad messages from a client and can point out network hardware problems.
- Some of the connections generate write activity on the disks. A sudden increase in these statistics could indicate trouble and should be investigated. For NFS Version 2 statistics, the connections to pay special attention to are: setattr, write, create, remove, rename, link, symlink, mkdir, and rmdir. For NFS Version 3 statistics the value to watch is commit. If the commit level is high in one NFS server as compared to another almost identical one, check to make sure that the NFS clients have enough memory. The number of commit operations on the server go up when clients do not have resources available.
pstack
- This command displays a stack trace for each process. It must be run by root. It can be used to determine where a process is hung, The only option allowed with this command is the PID of the process that you want to check (see the proc(1) man page).
Using the pstack Command
- The example below is checking the nfsd process that is running.
-
# /usr/proc/bin/pstack 243
243: /usr/lib/nfs/nfsd -a 16
ef675c04 poll (24d50, 2, ffffffff)
000115dc ???????? (24000, 132c4, 276d8, 1329c, 276d8, 0)
00011390 main (3, efffff14, 0, 0, ffffffff, 400) + 3c8
00010fb0 _start (0, 0, 0, 0, 0, 0) + 5c
|
- It shows that the process is waiting for a request. This is a normal response for a system that is not handling much NFS activity. If the stack shows that the process is still in poll after a request is made, it is possible that the process is hung. Please follow the instructions in "How to Restart NFS Services" on page 57 to fix this problem. Review the instructions in "NFS Troubleshooting Procedures" on page 53 to fully verify that your problem is a hung program.
rpcinfo
- This command generates information about the RPC service running on a system. It can also be used to change the RPC service. There are many options available with this command (see the rpcinfo(1M) man page). This is a shortened synopsis for some of the options that can be used with the command:
-
-
rpcinfo [ -m | -s ] [ hostname ]
rpcinfo [ -t | -u ] [ hostname ] [ progname ]
- where -m displays a table of statistics of the rpcbind operations, -s displays a concise list of all registered RPC programs, -t displays the RPC programs that use TCP, -u displays the RPC programs that use UDP, hostname selects the hostname of the server you need information from, and progname selects the RPC program to gather information about. If no value is given for hostname, then the local hostname is used. The RPC program number can be substituted for progname, but many will remember the name and not the number. The -p option can be used in place of the -s option on those systems which do not run the NFS Version 3 software.
- The data generated by this command can include:
-
- the RPC program number
- the version number for a specific program
- the transport protocol that is being used
- the name of the RPC service
- the owner of the RPC service
Using the rpcinfo Command
- This example gathers information on the RPC services running on a server. The text generated by the command is filtered by the sort command to make it more readable. Several lines listing RPC services have been deleted from the example.
-
% rpcinfo -s bee |sort -n
program version(s) netid(s) service owner
100000 2,3,4 udp,tcp,ticlts,ticotsord,ticots portmapper superuser
100001 4,3,2 ticlts,udp rstatd superuser
100002 3,2 ticots,ticotsord,tcp,ticlts,udp rusersd superuser
100003 3,2 tcp,udp nfs superuser
100005 3,2,1 ticots,ticotsord,tcp,ticlts,udp mountd superuser
100008 1 ticlts,udp walld superuser
100011 1 ticlts,udp rquotad superuser
100012 1 ticlts,udp sprayd superuser
100021 4,3,2,1 ticots,ticotsord,ticlts,tcp,udp nlockmgr superuser
100024 1 ticots,ticotsord,ticlts,tcp,udp status superuser
100026 1 ticots,ticotsord,ticlts,tcp,udp bootparam superuser
100029 2,1 ticots,ticotsord,ticlts keyserv superuser
100068 4,3,2 tcp,udp cmsd superuser
100078 4 ticots,ticotsord,ticlts kerbd superuser
100083 1 tcp,udp - superuser
100087 11 udp adm_agent superuser
100088 1 udp,tcp - superuser
100089 1 tcp - superuser
100099 1 ticots,ticotsord,ticlts pld superuser
100101 10 tcp,udp event superuser
100104 10 udp sync superuser
100105 10 udp diskinfo superuser
100107 10 udp hostperf superuser
100109 10 udp activity superuser
.
.
100227 3,2 tcp,udp - superuser
100301 1 ticlts niscachemgr superuser
390100 3 udp - superuser
1342177279 1,2 tcp - 14072
|
- This example shows how to gather information about a particular RPC service using a particular transport on a server.
-
% rpcinfo -t bee mountd
program 100005 version 1 ready and waiting
program 100005 version 2 ready and waiting
program 100005 version 3 ready and waiting
% rpcinfo -u bee nfs
program 100003 version 2 ready and waiting
program 100003 version 3 ready and waiting
|
- The first example checks the mountd service running over TCP. The second example checks the NFS service running over UDP.
snoop
- This command is often used to watch for packets on the network. It must be run as root. It is a good way to make sure that the network hardware is functioning on both the client and the server. There are many options available (see the snoop(1M) man page). A shortened synopsis of the command is given below:
-
-
snoop [ -d device ] [ -o filename ] [ host hostname ]
- where -d device specifies the local network interface, -o filename will store all of the captured packets into the named file, and hostname indicates to only display packets going to and from a specific host.
- The -d device option is very useful on those servers which have multiple network interfaces. There are many other expressions that can be used besides setting the host. A combination of command expressions with grep can often generate data that is specific enough to be useful.
- When troubleshooting, make sure that packets are going to and from the host that you expect them too. Also, look for error messages. Saving the packets to a file can make it much easier to review the data.
truss
- This command can be used to see if a process is hung. It must be run by root. There are many options that can be used with this command (see the truss(1) man page). A shortened syntax of the command is:
-
-
truss [ -t syscall ] -p pid
- where -t syscall selects system calls to trace, and -p pid indicates the PID of the process to be traced. The syscall may be a comma-separated list of system calls to be traced. Also, starting syscall with a ! selects to exclude the system calls from the trace.
Using the truss Command
- The example below shows that the process is waiting for another request for service.
-
# /usr/bin/truss -p 243
poll(0x00024D50, 2, -1) (sleeping...)
|
- This is a normal response for a system that is not handling much NFS activity. If the response does not change after a request has been made, it is possible that the process is hung. Please follow the instructions in "How to Restart NFS Services" on page 57 to fix the hung program. Review the instructions in "NFS Troubleshooting Procedures" on page 53 to fully verify that your problem is a hung program.
Automatic File System Sharing
- Servers provide access to their file systems by sharing them over the NFS environment. You specify which file systems are to be shared with the share command and/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 diskless clients, you need to make your clients' root directories available at all times.
- The dfstab file lists all the file systems that your server shares with its clients and controls which clients may mount a file system. If you want to modify dfstab to add or delete a file system or to modify the way sharing is done, simply edit the file with any supported text editor (such as vi). The next time 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 you would enter at the command line prompt to share the file system. The share command is located in /usr/sbin.
-
-
Edit the /etc/dfs/dfstab file.
Add one entry to the file for each file system that you want to have shared automatically. Each entry must be on a line by itself in the file and uses this syntax:
-
share [-F nfs] [-o specific-options] [-d description] pathname
|
-
-
Make sure that the NFS software is running on the server.
If this is the first share command or set of share commands that you have initiated, it is likely that the NFS daemons are not running. The following commands kill the daemons and restart them.
-
# /etc/init.d/nfs.server stop
# /etc/init.d/nfs.server start
|
- This ensures that NFS software is now running on the servers and will restart automatically when the server is at run level 3 during boot.
- At this point, set up your autofs maps so clients can access the file systems you've shared on the server. See "Setting Up Autofs Maps" on page 65.
Mounting at Boot Time
- If you want to mount file systems at boot time instead of using autofs maps, follow this procedure. Although this procedure must be followed for all local file systems, it is not recommended for remote file systems, because it must be completed on every client.
-
* Edit the /etc/vfstab file.
- Entries in the /etc/vfstab file have the following syntax:
-
-
special fsckdev mountp fstype fsckpass mount-at-boot mntopts
Example of a vfstab entry
- You want a client computer to mount the /var/mail directory on the server wasp. You would like it mounted as /var/mail on the client. You want the client to have read-write access. Add the following entry to the client's vfstab file.
-
wasp:/var/mail - /var/mail nfs - yes rw
|
-
Warning - NFS Servers should not have NFS vfstab entries because of a potential dead-lock. The NFS server software is started after the entries in /etc/vfstab are checked, so that if you have two servers go down at the same time which are mounting file systems from the other, each system could hang as the systems reboot.
Mounting on the Fly
- To manually mount a file system during normal operation, run the mount command as superuser:
-
# mount -F nfs -r -o bee:/export/share/stuff /mnt
|
- In this case the /export/share/stuff file system from the server bee is mounted on read-only /mnt on the local system. This will allow for temporary viewing of the file system. The file system can be unmounted with umount or by rebooting the local host.
Mounting with the Automounter
-
Chapter 5, "Using Autofs," includes the specific instructions for establishing and supporting mounts with the automounter. Without any changes to the generic system, remote file systems should be accessible through the /net mount point. To mount the /export/share/stuff file system from the previous example, all you would need to do is:
-
% cd /net/bee/export/share/stuff
|
- Since the automounter allows all users to mount file systems, root access is not required. It also provides for automatic unmounting of file systems, so there is no need to unmount file systems after you are done.
|
|