Professional Documents
Culture Documents
HP-UX 11i v1
Edition 1
Legal Notices
The information in this document is subject to change without notice. Hewlett-Packard makes no warranty of any kind with regard to this manual, including, but not limited to, the implied warranties of merchantability and tness for a particular purpose. Hewlett-Packard shall not be held liable for errors contained herein or direct, indirect, special, incidental, or consequential damages in connection with the furnishing, performance, or use of this material. Warranty A copy of the specic warranty terms applicable to your Hewlett-Packard product and replacement parts can be obtained from your local Sales and Service Ofce. U.S. Government License Proprietary computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license. Copyright Notice Copyright 2004 Hewlett-Packard Development Company, L.P. Reproduction, adaptation, or translation of this document without prior written permission is prohibited, except as allowed under the copyright laws. Copyright 1979, 1980, 1983, 1985-94 Regents of the University of California This software is based in part on the Fourth Berkeley Software Distribution under license from the Regents of the University of California. Copyright 1986-1997 Sun Microsystems, Inc. Copyright 1985-86, 1988 Massachusetts Institute of Technology Copyright 1989-93 The Open Software Foundation, Inc.
ii
Copyright 1986 Digital Equipment Corporation Copyright 1990 Motorola, Inc. Copyright 1990, 1991, 1992 Cornell University Copyright 1989-1991 The University of Maryland Copyright 1988 Carnegie Mellon University Trademark Notices UNIX is a registered trademark in the United States and other countries, licensed exclusively through The Open Group. X Window System is a trademark of the Massachusetts Institute of Technology. OSF/Motif is a trademark of the Open Software Foundation, Inc. in the U.S. and other countries. NFS is a registered trademark of Sun Microsystems, Inc. NIS and NIS+ are trademarks of Sun Microsystems, Inc.
NOTE
The Network Information Service (NIS) was formerly known as Yellow Pages (YP). The functionality is same; only the name has changed. Yellow Pages is a registered trademark in the United Kingdom of British Telecommunications plc.
iii
iv
Contents
About This Document 1. An Introduction to AutoFS
Overview of AutoFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . How AutoFS Works. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . New Features of AutoFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Comparing AutoFS with Automounter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 6 7
Contents
Executable Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Automounting Multiple Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Conguring Multiple Servers for an AutoFS Directory. . . . . . . . . . . . . . . . . . . . . . . . . Modifying or Removing an Automounted Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . Shortcuts for AutoFS Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Environment Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Wildcard Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Including an AutoFS Map in Another AutoFS Map . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating a Hierarchy of AutoFS Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Turning Off an AutoFS Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Support for HP CIFS Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example File Entries for CIFS Direct Map Automounts . . . . . . . . . . . . . . . . . . . . . . Example File Entries for CIFS Indirect Map Automounts . . . . . . . . . . . . . . . . . . . . Verifying the AutoFS Conguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 44 45 48 49 49 50 52 53 55 56 57 58 60
4. Troubleshooting AutoFS
AutoFS Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Starting AutoFS Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Stopping AutoFS Logging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . AutoFS Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Starting AutoFS Detailed Tracing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Stopping AutoFS Detailed Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Starting AutoFS Basic Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Stopping AutoFS Basic Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . AutoFS Tracing Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Mount Event Tracing Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Unmount Event Tracing Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 65 66 67 67 67 67 69 69 69 70
vi
Tables
Table 1. HP-UX 11i Releases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Table 2. Publishing History Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii Table 3. Document Organization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii Table 2-1. Old automount Command-Line Options . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Table 3-1. Automount Command-Line Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Table 3-2. Automountd Command-Line Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Table 3-3. Direct Versus Indirect AutoFS Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
vii
Tables
viii
Figures
Figure 1-1. Interaction Among AutoFS Components . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Figure 3-1. Automounted Directories for On-Demand Mounting . . . . . . . . . . . . . . . 22 Figure 3-2. Home Directories Automounted with Wildcards. . . . . . . . . . . . . . . . . . . 28 Figure 3-3. Automounted Directories from the -hosts MapOne Server. . . . . . . . . 31 Figure 3-4. Automounted Directories from the -hosts MapTwo Servers. . . . . . . . 31 Figure 3-5. Difference Between Direct Mounts and Indirect Mounts . . . . . . . . . . . . 34 Figure 3-6. Example of Direct Mounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Figure 3-7. Example of Indirect Mounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Figure 3-8. Example of CIFS Direct Mounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Figure 3-9. Example of CIFS Indirect Mounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
ix
Figures
Intended Audience
This document is intended for system and network administrators responsible for installing, conguring, and managing the AutoFS product. Administrators are expected to have knowledge of the NFS Services product.
xi
Publishing History
The publishing details of the document for various HP-UX releases are as follows: Table 2 Publishing History Details Document Manufacturing Part Number 5990-7199 Operating Systems Supported 11i version 1
xii
Typographical Conventions
This document uses the following conventions: Italics Bold monotype Identies titles of documents, lenames, and paths. Identies the strongly emphasized text. Identies program/script, command names, parameters, or display.
xiii
xiv
An Introduction to AutoFS
This chapter provides an overview of the AutoFS product. In addition, it provides information on the new features of AutoFS and the differences between AutoFS and Automounter.
Chapter 1
An Introduction to AutoFS
This chapters includes the following topics: Overview of AutoFS on page 3 New Features of AutoFS on page 6 Comparing AutoFS with Automounter on page 7
Chapter 1
Overview of AutoFS
AutoFS is a client-side service that supports automatic mounting and unmounting of le systems. This process is nearly transparent to the user. AutoFS is implemented as a virtual le system (VFS). It supports automounting by instructing the user-space daemon, automountd, to mount and unmount the directories it manages. It automatically mounts the appropriate le systems when needed and unmounts them if they have been idle for the congured period of time (10 minutes is the default value). AutoFS has been enhanced to provide the features of the SUN ONC+ version 2.3 AutoFS product. This version of AutoFS is known as Enhanced AutoFS. With the Enhanced AutoFS implementation, both performance and scalability are signicantly improved.
NOTE
You need to execute the automount command whenever the master map or the direct maps are updated.
The AutoFS le system (kernel AutoFS) A virtual le system that provides a directory structure for automatic mounting. It includes autofskd, a kernel-based process that periodically cleans up mounts. The automountd daemon A stateless daemon that accepts RPC requests from kernel AutoFS to perform mounts or umounts.
Chapter 1
An Introduction to AutoFS Overview of AutoFS Figure 1-1 illustrates the interaction among the components of AutoFS. Figure 1-1 Interaction Among AutoFS Components
The automount command is invoked at the system startup. It reads the AutoFS master map to create the initial set of AutoFS mount points in the internal mount table, /etc/mnttab. The automounted le systems are not mounted automatically at startup. The automounted le systems are points under which le systems are mounted when users request access to them. When AutoFS receives a request to mount a le system that is not mounted, it calls the automountd daemon, which actually mounts the requested le system. Once you mount the le system, further access does not require any action from the automountd daemon. AutoFS mounts le systems at the congured mount points. It does not maintain its own directory of mount points with symbolic links into it.
Chapter 1
An Introduction to AutoFS Overview of AutoFS The automountd daemon is completely independent from the automount command. Because of this separation, it is possible to add, delete, or change the AutoFS map information without having to stop and restart the automountd daemon. After system startup, when the AutoFS mount points are set up, you can modify the set of mount points by modifying AutoFS maps and running the automount command to read them and modify the mount table accordingly. You do not have to stop and restart AutoFS. If an automounted le system has been idle for a congured period of time (the default is 10 minutes), AutoFS unmounts it. For more information on AutoFS, see the following man pages: automount (1M) and automountd (1M).
WARNING
File systems under the management of AutoFS must always be maintained through AutoFS utilities, automountd and automount. Manually mounting and unmounting AutoFS managed le systems can lead to disruptive or unpredictable results, including but not limited to the following: Commands hang or do not return expected results. Applications fail due to their dependencies on these mounted le systems.
Chapter 1
Chapter 1
Chapter 1
Chapter 1
Chapter 2
This chapter includes the following topics: Installation and Verication on page 11 Enabling Enhanced AutoFS on page 13 Disabling Enhanced AutoFS on page 14 Restarting Enhanced AutoFS on page 15 Updating from Automounter to Enhanced AutoFS on page 17
10
Chapter 2
Chapter 2
11
NOTE
After installing Enhanced AutoFS, you can specify the maximum data segment size for an executing process using the maxdsiz kernel variable. The value for this variable should be at least 256 MB. It is necessary to change the value of the maxdsiz kernel variable because automountd requires a larger data segment size in a large map conguration.
12
Chapter 2
2. If you want to use a local le as your AutoFS master map, make sure the value for the AUTO_MASTER variable in /etc/rc.config.d/nfsconf is set to the name of your AutoFS master map. The default master map name is /etc/auto_master.
AUTO_MASTER=/etc/auto_master
If you want to use an NIS AutoFS master map, remove -f $AUTO_MASTER from the AUTOMOUNT_OPTIONS variable. 3. To start AutoFS, issue the following command:
/sbin/init.d/nfs.client start
When Enhanced AutoFS starts up, if your AUTOMOUNT_OPTIONS variable species a master map le with the -f filename option, Enhanced AutoFS searches for a le with that name on the local host. Enhanced AutoFS can also use the Name Service Switch to determine which name services you are using and nd the master maps that are available from those name services. If your AUTOMOUNT_OPTIONS variable does not specify the -f filename option, Enhanced AutoFS checks the Name Service Switch conguration to determine where to search for your AutoFS master map. For more information, see the following man pages: nsswitch.conf(4) or automount(1M).
Chapter 2
13
2. In the /etc/rc.config.d/nfsconf le, make sure the NFS_CLIENT variable is set to 1 and the AUTOFS variable is set to 0; see the following:
NFS_CLIENT=1 AUTOFS=0
WARNING
Do not kill the automountd daemon with the kill command because the daemon does not terminate gracefully. Moreover, it does not unmount AutoFS mount points before it dies. Use the nfs.client stop script to make sure automountd dies cleanly. After disabling AutoFS using the nfs.client stop script, you may notice that the autofskd process is still running. autofskd is the kernel daemon; it is dormant when the AUTOFS variable is 0. You can safely ignore this process. You cannot kill autofskd; the only way to stop autofskd is to reboot.
14
Chapter 2
2. For every automounted directory listed by the grep command, issue the following command to determine whether the directory is currently in use:
/usr/sbin/fuser -cu local_mount_point
This command lists the process IDs and user names of all the users using the mounted directory. 3. Warn any user to cd out of the directory, and kill any process that is using the directory, or wait until the processes terminate. You can issue the following command to kill all the processes using the mounted directory:
/usr/sbin/fuser -ck local_mount_point
WARNING
Do not kill the automountd daemon with the kill command because it does not die gracefully. Moreover, it does not unmount AutoFS mount points before it dies. Use the nfs.client stop script to make sure automountd dies cleanly.
5. To ensure that Enhanced AutoFS is no longer active, issue the ps command as follows:
/usr/bin/ps -ef | grep automount
Chapter 2
15
Installing Enhanced AutoFS Restarting Enhanced AutoFS If the ps command indicates that Enhanced AutoFS is still active, make sure all users are out of the automounted directories, and then try again. Do not restart Enhanced AutoFS until all automount processes have terminated. 6. To start Enhanced AutoFS, issue the following command:
/sbin/init.d/nfs.client start
16
Chapter 2
Purpose Assign value to the environment variable. Use master_file as the local master map. Automount directories under mount_directory instead of /tmp_mnt. Ignore the NIS auto.master map.
-f master_file -M mount_directory
-m
Chapter 2
17
Installing Enhanced AutoFS Updating from Automounter to Enhanced AutoFS Table 2-1 Old automount Command-Line Options (Continued) Old automount Option -n Equivalent AutoFS Command Option Obsolete with AutoFS.
Purpose Allow automounts of previously mounted target le systems only. Enable automount tracing. Specify time before unmounting idle directories. Specify interval between mount attempts. Specify interval between unmount attempts. Verbose mode.
-T -tl duration
automountd -T automount -t duration Obsolete with AutoFS. Obsolete with AutoFS. automount -v automountd -v
-tm interval
-tw interval
-v
3. Modify the scripts (if any) that kill and restart automount. The new AutoFS daemon, automountd, rarely needs to be restarted. If you need to make changes to your AutoFS maps, run the automount program after modifying the maps. automount is not a daemon; it is a program that runs once to read the maps and then terminates.
18
Chapter 2
Chapter 3
19
Indirect NFS Automounts on page 32. This chapter includes the following topics: Using the New Features on page 21 Command-Line Options on page 24 Automounting Home Directories on page 26 Automounting All Exported Directories Using the -hosts Map on page 29 Deciding Between Direct and Indirect NFS Automounts on page 32 Mounting a Remote Directory on page 35 Executable Maps on page 43 Automounting Multiple Directories on page 44 Conguring Multiple Servers for an AutoFS Directory on page 45 Modifying or Removing an Automounted Directory on page 48 Shortcuts for AutoFS Maps on page 49 Including an AutoFS Map in Another AutoFS Map on page 52 Creating a Hierarchy of AutoFS Maps on page 53 Turning Off an AutoFS Map on page 55 Support for HP CIFS Client on page 56 Verifying the AutoFS Conguration on page 60
20
Chapter 3
On-Demand Mounting
In previous versions, AutoFS mounted an entire set of le systems if they were hierarchically related. In contrast, Enhanced AutoFS mounts only those le systems that users access; other le systems that are hierarchically related to these le systems are mounted when they are needed. For example:
# /etc/auto_master file # local mount point /map name /etc/auto_direct remote server:directory mount options
# /etc/auto_direct file # local mount point mount options /auto/project/specs -nosuid /auto/project/budget -nosuid
thyme:/export/project/specs basil:/export/FY99/proj1
If you have the preceding AutoFS master and direct maps on the NFS client, sage, and if a user on this NFS client types the following command:
cd /auto/project/specs
Chapter 3
21
Conguring and Administering AutoFS Using the New Features Figure 3-1 shows the automounted le structure after the users command is issued. Figure 3-1 Automounted Directories for On-Demand Mounting NFS server "thyme" / /export /project /specs /specs /reqmnts /designs /reqmnts /designs NFS client "sage" / /auto /project
On-Demand mounting
22
Chapter 3
remote server:directory
thyme:/export/project/test basil:/export/apps
Considering that you have the preceding AutoFS master and indirect maps on the NFS client, sage, issue the following commands:
cd /nfs/desktop ls
The ls command displays this output because the test and apps subdirectories are the potential mount points (browsability), but are not mounted currently. However, if you issue the following commands, both the test and apps subdirectories are mounted.
cd /nfs/desktop/test cd /nfs/desktop/apps
Chapter 3
23
Command-Line Options
This section includes information on the command-line options available for Enhanced AutoFS.
-t duration
-v
24
Chapter 3
-n
-T
-v -L
Chapter 3
25
The ampersand (&) character takes the value of the user name in each line. In the previous example, user sammys home directory is physically located on the thyme host in /export/home/sammy. If you are using NIS to manage your AutoFS maps, add the line into the /etc/auto_home le on the NIS master server. See the Conguring and Administering NIS chapter of NFS Services Administrators Guide. 4. If you are using local les for your AutoFS maps, add the following line to AutoFS master map, /etc/auto_master, on the NFS clients:
/home /etc/auto_home
If you are using NIS to manage your AutoFS maps, add the line into the /etc/auto_master le on the NIS master server. 5. If you are using NIS to manage your AutoFS maps, issue the following commands on the NIS master server to rebuild the maps and push them to slave servers:
cd /var/yp /usr/ccs/bin/make auto_master
26
Chapter 3
Conguring and Administering AutoFS Automounting Home Directories 6. To force AutoFS to reread the maps, issue the following command on each NFS client that will use these AutoFS maps:
/usr/sbin/automount
Before you can automount home directories, you must enable AutoFS. See Enabling Enhanced AutoFS on page 13.
When Howard logs on to any NFS client, AutoFS recognizes /home as an AutoFS mount point because it is congured in the master map as follows:
/home auto_home
AutoFS reads the auto_home map to determine how to mount Howards home directory. It nds the following line:
howard basil:/export/home/& -nosuid
AutoFS substitutes howard with the ampersand (&) character in that line:
howard basil:/export/home/howard -nosuid
Chapter 3
27
Conguring and Administering AutoFS Automounting Home Directories AutoFS mounts /export/home/howard from the basil server to the local mount point /home/howard on the NFS client. Figure 3-2 illustrates this conguration. Figure 3-2 Home Directories Automounted with Wildcards NFS server "basil" / /export /home /howard .profile mystuff local NFS client / /home /howard .profile mystuff
28
Chapter 3
Conguring and Administering AutoFS Automounting All Exported Directories Using the -hosts Map
If you are using NIS to manage your AutoFS maps, add the line to the master map le on the NIS master server. See the Conguring and Administering NIS chapter of NFS Services Administrators Guide. Next, issue the following commands to rebuild the map, and push it out to slave servers:
cd /var/yp /usr/ccs/bin/make auto_master
WARNING
HP recommends you to modify your /net map entry with the nobrowse option when you upgrade from the current AutoFS on HP-UX 11i to Enhanced AutoFS. By default, the local default master map le for a newly installed system has the nobrowse option set for the /net map entry.
2. On each host that will use the map you have modied, issue the following command to force AutoFS to read the modied map:
/usr/sbin/automount
You must enable AutoFS before any directory is automounted. The -hosts map is a built-in AutoFS map; you do not have to create it. The -hosts map causes AutoFS to mount exported directories from any NFS server found in the hosts database whenever a user or process requests access to one of the exported directories from that server.
Chapter 3
29
Conguring and Administering AutoFS Automounting All Exported Directories Using the -hosts Map
WARNING
Because the -hosts map allows NFS access to any reachable remote system, a user may inadvertently cause an NFS mount over X.25 or SLIP, which is unsupported, or through a slow router or gateway. Mounts over slow links may cause excessive retransmissions and degrade performance for all users.
When a user or process requests a directory from an NFS server, AutoFS creates a subdirectory, named after the NFS server, under the local mount point you congured in the AutoFS master map. (The conventional mount point for the -hosts map is /net.) Then, AutoFS mounts the exported directories (that are accessed with on-demand mounting) from that server. Directories will stay mounted until they are left idle for 10 minutes. You can change the 10-minute default time by adding the -t duration option to the AUTOMOUNT_OPTIONS variable in the /etc/rc.config.d/nfsconf le or by running the automount command with the -t option from the command line. The -hosts map is an indirect map. It uses the hosts database (the /etc/hosts le, the NIS hosts map, or BIND [DNS]) to nd a host on the network. The Name Service Switch conguration determines which name services will be searched for the host information. See the Conguring the Name Service Switch chapter of NFS Services Administrators Guide. For example, if the sage server exports /opt and /apps, and a user on your NFS client types the following command: cd /net/sage/opt/frame the /sage subdirectory is created under /net, and /opt is mounted under /sage using on-demand mounting.
30
Chapter 3
Conguring and Administering AutoFS Automounting All Exported Directories Using the -hosts Map Figure 3-3 shows the automounted le structure after the users command. Figure 3-3 Automounted Directories from the -hosts MapOne Server /net /sage /opt If the thyme server exports the /exports/proj1 directory, and a user types the following command: more /net/thyme/exports/proj1/readme the /thyme subdirectory is created under /net, and /exports/proj1 is mounted under /thyme using on-demand mounting. Figure 3-4 shows the automounted directory structure after the users second command. Figure 3-4 Automounted Directories from the -hosts MapTwo Servers /net /sage /opt /thyme /exports /proj1
Chapter 3
31
Conguring and Administering AutoFS Deciding Between Direct and Indirect NFS Automounts
Advantage: Direct-mounted automounted directories can share the same parent directory with local or standard-mounted les and directories.
32
Chapter 3
Conguring and Administering AutoFS Deciding Between Direct and Indirect NFS Automounts Table 3-3 Direct Versus Indirect AutoFS Map (Continued) Direct Map Disadvantage: If you add or remove mounts in a direct map, or if you change the local mount point for an existing mount in a direct map, you have to force AutoFS to reread its maps. Disadvantage: When automount reads a direct map, it creates an entry for each automounted directory in the internal mount table, /etc/mnttab. This can cause the mount table to become very large. Indirect Map Advantage: If you modify an indirect map, the changes are visible when AutoFS mounts the directory next time. Therefore, you do not have to force AutoFS to reread its maps. Advantage: When automount reads an indirect map, it creates only one entry for the entire map in the internal mount table, /etc/mnttab. Additional entries are created when directories are actually mounted. The mount table does not occupy unnecessary space because only mounted directories appear in it.
Chapter 3
33
Conguring and Administering AutoFS Deciding Between Direct and Indirect NFS Automounts Figure 3-5 shows the difference between direct mounts and indirect mounts on an NFS client. Figure 3-5 Difference Between Direct Mounts and Indirect Mounts Mounts in a Direct Map / Mounts in an Indirect Map /
= Automounted Directory
34
Chapter 3
For CIFS le system mount entries in AutoFS direct map les, set the mount option for the fstype le system type to cifs. The remote server must be a CIFS server, and the remote directory must be a CIFS share. If you are using NIS to manage your AutoFS maps, add the line to the direct map on the NIS master server. See the Conguring and Administering NIS chapter of NFS Services Administrators Guide. 2. If you are using local les for your AutoFS maps, use an editor to open or create the AutoFS master map in the /etc directory. You need to name the master map as /etc/auto_master. If you are using NIS, open the master map on the NIS master server. If the direct map you just modied is not listed in the AutoFS master map, add the following line to the master map:
/-
direct_map_name
[mount_options]
3. If you are using NIS to manage your AutoFS maps, issue the following commands on the NIS master server to rebuild the maps, and push them to the slave servers:
cd /var/yp /usr/ccs/bin/make auto_master auto_direct
4. On each host that will use the map you have modied, issue the following command to force AutoFS to read the modied map:
Chapter 3
35
The local directory that you congure as the mount point should be empty or non-existent. AutoFS creates the non-existent directories between the root directory and the congured mount point. If the local directory that you congured as the mount point is not empty, the local les or directories in it are hidden and inaccessible while the automounted le system is mounted over it.
WARNING
Do not automount a remote directory on a local directory that is a symbolic link. If you are using NIS to manage your AutoFS maps, you need to be careful of situations where the NIS server is also a server from which le systems are automounted. If the mount point specied by the NIS map is the same as the actual source directory on the server, AutoFS may attempt to mount the source directory over itself when a user accesses the mount point on the NIS server. This may cause the directory to become unavailable.
The mount options that you can specify in the AutoFS maps are the same ones that you use for the type of le system you attempt to automount. For more information on the mount options, see the Changing the Default Mount Options section of NFS Services Administrators Guide. You cannot use the bg option for an automounted directory. The mount options congured in the direct map override the options in the master map if there is a conict. You can congure all your direct automounts in the same map. Many users use the le name, /etc/auto_direct, for their direct map. If you plan to use NIS to manage your AutoFS maps, you can have only one direct map in your conguration. If you plan to use NIS to manage your AutoFS maps, and your le system does not allow le names longer than 14 characters, restrict the map name to 10 characters or fewer. If the direct map name in the AutoFS master map begins with a slash (/), it is a local le for AutoFS. If the direct map does not contain a slash, AutoFS uses the Name Service Switch to determine whether it is a le or an NIS map. See the Conguring the Name Service Switch chapter of NFS Services Administrators Guide.
36
Chapter 3
Conguring and Administering AutoFS Mounting a Remote Directory Before you can mount a remote directory on your system, ensure that you congure the remote system where the directory is located as an NFS server. In addition, ensure that you export the directory. You must enable AutoFS before any directory is automounted. Automounted directories stay mounted until they are idle for 10 minutes. You can change the 10-minute default time by adding the -t duration option to the AUTOMOUNT_OPTIONS variable in the /etc/rc.config.d/nfsconf le or by running the automount command with the -t option from the command line. If you change the mount options, the remote server name, or the remote directory name for an existing direct mount, while AutoFS is running, the changes you made will take effect the next time the directory is mounted. However, if you change the local directory name in the direct map, or if you change the master map, these changes will not take effect until you issue the automount command to force AutoFS to reread its maps. For more information on AutoFS conguration, see the automount(1M) man page.
WARNING
File systems under the management of AutoFS must always be maintained through AutoFS utilities, automountd and automount. Manually mounting and unmounting AutoFS managed le systems can lead to disruptive or unpredictable results, including but not limited to the following: Commands hang or do not return expected results. Applications fail due to their dependencies on these mounted le systems.
Sample File Entries for NFS Direct Automounts The following example contains sample lines from an AutoFS direct map on the NFS client, sage. The sharp sign (#) indicates a comment line.
# /etc/auto_direct file # local mount point mount options /auto/project/specs -nosuid /auto/project/budget -nosuid remote server:directory
thyme:/export/project/specs basil:/export/FY94/proj1
Chapter 3
37
Conguring and Administering AutoFS Mounting a Remote Directory The following example contains sample lines from the AutoFS master map on the NFS client, sage.
# /etc/auto_master file # local mount point /map name /etc/auto_direct mount options
Figure 3-6 illustrates how AutoFS sets up the direct mounts for this conguration. Figure 3-6 Example of Direct Mounts NFS server "thyme" / /export /project /specs /specs /targets /ytd /reqmnts /designs /reqmnts /designs /targets /ytd /budget NFS client "sage" / /auto /project
NFS mounts
38
Chapter 3
Conguring and Administering AutoFS Mounting a Remote Directory For CIFS le system mount entries in AutoFS indirect map les, you must set the mount option for the fstype le system type to cifs.The remote server must be a CIFS server, and the remote directory must be a CIFS share. If you are using NIS to manage your AutoFS maps, add the line to an indirect map on the NIS master server. See the "Conguring and Administering NIS" chapter of NFS Services Administrators Guide. 2. If you are using local les for your AutoFS maps, use an editor to open or create the AutoFS master map in the /etc directory. You need to name the master map as /etc/auto_master. If you are using NIS, open the master map on the NIS master server. If the indirect map you modied is not listed in the AutoFS master map, add the following line to the master map:
local_parent_directory indirect_map_name [mount_options]
3. If you are using NIS to manage your AutoFS maps, issue the following commands on the NIS master server to rebuild the maps, and push them to the slave servers:
cd /var/yp /usr/ccs/bin/make auto_master indirect_mapname
4. If you modied the AutoFS master map, issue the following command on each host that will use the map. This forces AutoFS to read the modied master map:
/usr/sbin/automount
The local_subdirectory specied in the indirect map is the deepest subdirectory in the local directory path name. For example, if you were mounting a remote directory on /nfs/apps/draw, the local_subdirectory specied in the indirect map is draw. The local_parent_directory specied in the master map is all but the deepest subdirectory in the local directory path name. For example, if you were mounting a remote directory on /nfs/apps/draw, the local_parent_directory specied in the master map is /nfs/apps. The local_parent_directory and local_subdirectory should not exist; AutoFS creates them when it mounts the remote directory. If the local_parent_directory or local_subdirectory contains les or directories, they are hidden beneath the remote directory when it is mounted.
Chapter 3
39
WARNING
The local_subdirectory and local_parent_directory must not be symbolic links. If you are using NIS to manage your AutoFS maps, make sure the local mount point is different from the exported directory on the server. If they are same, the server may attempt to mount its exported directory over itself, and the directory will become unavailable.
The mount options that you can specify in the AutoFS maps are the same ones that you use for the type of lesystem you attempt to automount. For a list of mount options, see the Changing the Default Mount Options section of NFS Services Administrators Guide. You cannot use the bg option for an automounted directory. The mount options congured in the indirect map override the ones in the master map if there is a conict. You can congure indirect automounts in the same indirect map only if their local_parent_directory, as specied in the AutoFS master map, is the same. For example, you can congure indirect mounts with the local mount points, /nfs/apps/draw and /nfs/apps/word, in the same indirect map. Indirect maps are usually called /etc/auto_name, where name helps you in identifying what is congured in the map. If you plan to use NIS to manage your AutoFS maps, and if your le system does not support le names longer than 14 characters, restrict your indirect map names to 10 characters or fewer. If the indirect map name in the AutoFS master map begins with a slash (/), then it is a local le for AutoFS. If it does not contain a slash, AutoFS uses the Name Service Switch to determine whether it is a le or an NIS map. See Conguring the Name Service Switch chapter of NFS Services Administrators Guide. Before you can mount a remote directory on your system, ensure to congure the remote system where the directory is located as an NFS server. In addition, make sure to export the directory.
40
Chapter 3
Conguring and Administering AutoFS Mounting a Remote Directory Automounted directories stay mounted until they are idle for ten minutes. You can change the ten-minute default time by adding the -t duration option to the AUTOMOUNT_OPTIONS variable in the /etc/rc.config.d/nfsconf le or by running the automount command with the -t option from the command line. You must enable AutoFS before any directory is automounted. See Enabling Enhanced AutoFS on page 13. If AutoFS is already running when you add an indirect mount to your conguration, you do not have to run the automount command unless you change the master map. The changes you make to an existing indirect map take effect when AutoFS mounts the directory the next time. However, changes to the master map will not take effect until you issue the automount command to force AutoFS to reread its maps. For more information on the AutoFS conguration, see the automount(1M) man page.
WARNING
File systems under the management of AutoFS must always be maintained through AutoFS utilities, automountd and automount. Manually mounting and unmounting AutoFS managed le systems can lead to disruptive or unpredictable results, including but not limited to the following: Commands hang or do not return expected results. Applications fail due to their dependencies on these mounted le systems.
Sample File Entries for NFS Indirect Automounts The following example contains sample lines from an AutoFS indirect map on the NFS client, sage. The sharp sign (#) indicates a comment. AutoFS ignores everything from the sharp sign to the end of the line.
# /etc/auto_desktop file # local mount point mount options draw raw write -nosuid -nosuid remote server:directory thyme:/export/apps/d basil:/export/write
Chapter 3
41
Conguring and Administering AutoFS Mounting a Remote Directory The following example contains sample lines from the AutoFS master map on the NFS client, sage. The master map also includes an entry for the direct map, /etc/auto_direct.
# /etc/auto_master file # local mount point //nfs/desktop map name /etc/auto_direct /etc/auto_desktop mount options
Figure 3-7 illustrates how AutoFS sets up the indirect mounts for this conguration. Figure 3-7 Example of Indirect Mounts NFS server "thyme" / /export /apps /draw readme /wordtool /pics /bin /pics /bin readme /wordtool /draw /write NFS client "sage" / /nfs /desktop
NFS mounts
42
Chapter 3
Executable Maps
An executable map has its entries generated dynamically by a program or a script. AutoFS determines whether a map is executable by checking whether the execute bit is set in its permissions string. If a map is not executable, make sure its execute bit is not set. When the AutoFS daemon locates a map and detects that its execute bit is set, then instead of opening the le and searching for an entry, the AutoFS daemon executes the le as a program and passes the key to be located within the map as an argument. The executable AutoFS map returns a map entry on the standard output. If they cannot supply a map entry for the key, they should return nothing. You can list executable AutoFS maps in the master map or include them in local AutoFS map les. For example, the following executable map, implemented as a shell script, emulates the AutoFS built-in -hosts map for /net. It obtains a list of exported le systems from an NFS server (its name given as the key argument), formats the path names into a multiple-mount map entry, and sorts the list to order the mounts correctly into a top-down hierarchy:
# ! /bin/sh Server=$1 showmount -e $1 | awk {print $1 \t$Server: $1 \\} | sort
Chapter 3
43
(Create the map, if necessary, and add it to the AutoFS master map.) AutoFS ignores line breaks if lines end with the backslash (\) character. Therefore, the previous entry is effectively a one-line entry. Map entries with this format cause all the remote directories on the line to be mounted at the same time. For example, the following entry from a direct map mounts the source code and the data les for a project whenever anyone requests access to both of them; they are mounted for on-demand mounting.
/our_project /source -ro broccoli:/opt/proj1/src \ /datafiles cauliflower:/opt/proj1/samples/data
In this example, the same mount option (nosuid) applies to all three automounted directories.
44
Chapter 3
Conguring and Administering AutoFS Conguring Multiple Servers for an AutoFS Directory
AutoFS reads this entry as one line. The line has been broken for readability, and the backslash (\) character indicates that the line continues after the line break. If the remote directory has the same name on every server, use a syntax like the following example from an indirect map:
man -ro broccoli,cabbage,cauliflower:/usr/share/man
You can assign weights to the various servers by specifying a number in parentheses after each server name. If the weight number is lower, the server is more likely to be selected.
man -ro\ broccoli(1),cabbage(2),cauliflower(3):/usr/share/man
Servers with no weight specied have a default weight of zero (most likely to be selected). Server proximity is more important than the weights you assign. A server on the same network segment as the client is more likely to be selected than a server on another network segment, regardless of the weights you assign. The weight has effect only when selecting between servers with the same network proximity.
Chapter 3
45
Conguring and Administering AutoFS Conguring Multiple Servers for an AutoFS Directory 3. AutoFS needs the /etc/netmasks le to determine the local clients subnets in the replicated servers environment. You must manually create and congure the /etc/netmasks le for the replicated servers functionality to work properly. The /etc/netmasks le contains Internet Protocol (IP) address masks with IP network numbers. It supports both standard subnetting as specied in RFC 950 and variable length subnetting as specied in RFC 1519. When using the standard subnetting, there should be a single line for each network with the network number and the network mask to use on that network. You can specify the network number and mask in the conventional IP .(dot) notation. The network number is restricted to be a class A, B, or C network number. Consider the following example:
# network number 128.32.0.0 netmask 255.255.255.0
The format is identical for variable length subnetting. However, there should be a line for each subnet with the rst eld being the subnet and the second eld being the netmask. The following example shows how AutoFS uses the /etc/netmasks le to determine the local clients subnets in the replicated servers environment. In this example, the sage and thyme servers export /nfs/mount. The IP address for the sage server is 15.43.232.30, and the IP address for the thyme server is 15.244.10.20.
# /etc/auto_direct file /nfs/mount sage,thyme:/user
#/etc/netmasks file on the client basil: #network number 15.43.234.210 netmask 255.255.248.0
AutoFS uses the /etc/netmasks le to determine the local clients subnets and mounts /nfs/mount from the sage server on the local subnet. To ensure that versions remain the same on all the servers, you need to mount directories with multiple servers as read-only.
46
Chapter 3
Conguring and Administering AutoFS Conguring Multiple Servers for an AutoFS Directory The server chosen for the mount is the one with the strongest preference based on a sorting order. The sorting order used gives strongest preference to servers on the same local subnet; servers on the local net are given the second strongest preference. Therefore, if you congure multiple servers on both sides of a gateway, a server on the same side of the gateway as the NFS client is always used. Among servers that are equally far away, response time determines the order, if no weighting factors are used. Multiple servers give users reliable access to a mounted directory because if one server is down, the directory can be mounted from another. In addition, multiple servers provide some load balancing across the network; a server that is not busy responds more quickly to AutoFS poll than the one that is heavily loaded. Therefore, the directory is mounted from a server that is not busy. If the list of multiple servers contains some servers using the NFS Version 2 Protocol and some servers using the NFS Version 3 Protocol, AutoFS chooses a subset of the list having only servers with the same protocol. This subset is formed of servers using the NFS Version 3 Protocol, unless there are no such servers on the list, or there is a server using NFS Version 2 Protocol that has the strongest preference.
Chapter 3
47
This command lists the process IDs and user names of all the users using the mounted directory. Warn any user to cd out of the directory, and kill any process that are using the directory, or wait until the processes terminate. You can issue the following command to kill all the processes using the mounted directory:
/usr/sbin/fuser -ck local_mount_point
Use an editor to make your changes to the direct or indirect map. If you removed all of the entries in the direct or indirect map, remove that maps entry in the AutoFS master map. If you made changes to the master map, or if you added or modied a local mount point in a direct map, issue the following command to force AutoFS to reread its maps:
/usr/sbin/automount
WARNING
File systems under the management of AutoFS must always be maintained through AutoFS utilities, automountd and automount. Manually mounting and unmounting AutoFS managed le systems can lead to disruptive or unpredictable results, including but not limited to the following: Commands hang or do not return expected results. Applications fail due to their dependencies on these mounted le systems.
48
Chapter 3
Environment Variables
You can use an environment variable anywhere in a direct or indirect AutoFS map, except the rst eld, which species the local mount point. You must precede an environment variable by a dollar sign ($), or enclose it in curly braces {}. The following direct map uses a variable called HOST:
/private_files sage:/export/private_files/$HOST
To assign a value to the variable, add the -D option to the AUTOMOUNTD_OPTIONS variable in the /etc/rc.config.d/nfsconf le; see the following example:
AUTOMOUNTD_OPTIONS=-D HOST='hostname'
In the preceding example, the NFS server, sage, has subdirectories in its /export/private_files directory that are named after the hosts in its network. Every host in the network can use the same AutoFS map and the same AUTOMOUNTD_OPTIONS denition to mount its private les from the sage server. For example, when AutoFS starts up on the basil host, it assigns the value basil to the HOST variable. Then, when someone requests access to the local /private_files directory on basil, AutoFS mounts /export/private_files/basil from the sage server. You can use any environment variable that is set to a value in an AutoFS map. If you do not set the variable with the -D option in /etc/rc.config.d/nfsconf, AutoFS uses the current value of the environment variable on the local host.
NOTE
Chapter 3
49
Wildcard Characters
You can use asterisk (*) in an indirect map as a wildcard character to represent the local subdirectory when you want the local subdirectory to be the same as the remote system name or the remote subdirectory. You can use ampersand (&) in a direct or indirect map as the remote system name or the remote subdirectory. Whatever is in the local directory name eld replaces the ampersand character. If you have used asterisk to represent the local subdirectory, then whatever replaces asterisk (*) in the local subdirectory eld also replaces ampersand (&) in the remote system name or remote subdirectory eld.
NOTE
The following example automounts users home directories. The home directories are physically located on the NFS server, basil, under the remote directory, /export/home. On the local NFS client, the home directories are mounted under /home. The following example contains a line from the AutoFS master map, /etc/auto_master, that lists the indirect map, /etc/auto_home:
# /etc/auto_master file # local mount point /home map name /etc/auto_home mount options -nosuid
The following example contains the line from the AutoFS indirect map, /etc/auto_home that mounts users home directories on demand.
# /etc/auto_home file # local mount point mount options * remote server:directory basil:/export/home/&
A users home directory is congured in the /etc/passwd le as /home/username. For example, the home directory of user terry is /home/terry. When Terry logs on, AutoFS looks into the /etc/auto_home map and substitutes terry for both asterisk and ampersand. AutoFS then mounts Terrys home directory from /export/home/terry on the basil server to /home/terry on the local NFS client.
50
Chapter 3
Conguring and Administering AutoFS Shortcuts for AutoFS Maps You can use the ampersand character to represent both the remote server and the remote subdirectory in the same line of the indirect map. For example, if users home directories are physically located on many different servers, but the directory under which the home directories are located is called /export/home/servername on all the servers, the following line in the /etc/auto_home map mounts all users home directories from any server:
* &:/export/home/&
Consider that the home directory of user terry is congured in the /etc/passwd le as /home/basil/terry. When Terry logs on, AutoFS mounts the remote directory /export/home/basil from the basil server on the local directory, /home/basil. The line with the asterisk and ampersand characters should be the last line in an indirect map. AutoFS reads the lines in the indirect map sequentially until it nds a match for the requested local subdirectory. The asterisk (*) character matches any subdirectory. Therefore, AutoFS stops reading at the line with the asterisk character because it nds a match. The lines in the map after the line with the asterisk character are never read. Consider the following example:
* charlie basil:/export/home/& thyme:/export/home/charlie
If the /etc/auto_home map contains the preceding lines, AutoFS attempts to mount /export/home/charlie from the basil host. The asterisk character is a match for charlie; therefore, AutoFS does not read the second line. Now, consider the following example:
charlie * thyme:/export/home/charlie basil:/export/home/&
If the /etc/auto_home map contains the preceding lines, AutoFS mounts Charlies home directory from the thyme host and everyone elses home directory from the basil host. For more information on the AutoFS conguration, see the automount(1M) man page.
Chapter 3
51
Conguring and Administering AutoFS Including an AutoFS Map in Another AutoFS Map
Assume that the /etc/auto_home map is listed in the master map with the following line:
/home /etc/auto_home
This example causes the following: If a user whose home directory is in /home/basil logs on, AutoFS mounts the /export/home/basil directory from the basil host. If a user whose home directory is in /home/sage, /home/thyme, or any subdirectory of /home other than basil logs on, AutoFS checks the auto_home NIS map for information on mounting the users home directory.
The plus sign (+) indicates that AutoFS must look into a different map for the information it needs to mount the directory. If the map name following the plus sign begins with a slash, it is a local le for AutoFS. If the map name contains no slashes, AutoFS uses the Name Service Switch to determine whether it is a le or an NIS map. For more information, see the "Conguring the Name Service Switch" chapter of NFS Services Administrators Guide.
NOTE
You can include an AutoFS map inside a local le but not inside an NIS map.
For more information, see the following man pages: automount(1M) or nsswitch.conf(4).
52
Chapter 3
-fstype=autofs -fstype=autofs
A user in the blackhole project within engineering may use the following path:
/org/eng/projects/blackhole
Beginning with the AutoFS mount at /org, the evaluation of this path dynamically creates additional AutoFS mounts at /org/eng and /org/eng/projects. As AutoFS mounts are created only when needed, changes to maps require no action to become visible at the users workstation.
NOTE
You need to run the automount command if you make changes to the master map or a direct map.
Chapter 3
53
Conguring and Administering AutoFS Creating a Hierarchy of AutoFS Maps Hierarchical AutoFS maps provide a framework within which large shared le systems can be organized. Together with NIS, which allows you to share information across administrative domains, the maintenance of the shared namespace can be effectively decentralized.
54
Chapter 3
2. If AutoFS is running, and you want to force it to reread its maps, issue the following command on each client that will use the map:
/usr/sbin/automount
The -null option turns off the map that is mounted on local_directory. For example, if the NIS auto_master map mounts the auto_home map on /home, and you include the following line in your local /etc/auto_master le, the auto_home NIS map is not used on your system:
/home -null
The -null option is useful for turning off NIS AutoFS maps that do not apply to your host. You can also replace NIS maps with local maps; see the following example from /etc/auto_master:
/home /etc/auto_ourhome
As AutoFS reads the local /etc/auto_master le before the auto_master NIS map, this entry causes AutoFS to look for mount information in the local le, /etc/auto_ourhome, instead of the auto_home NIS map. To use a local AutoFS master map, make sure the AUTOMOUNT_OPTIONS variable in /etc/rc.config.d/nfsconf includes the -f $AUTO_MASTER string. In addition, make sure the AUTO_MASTER variable is set to the name of your local AutoFS master map le. For more information, see the automount(1M) man page.
Chapter 3
55
56
Chapter 3
The following example includes sample lines from the AutoFS master map on the CIFS client, mammoth:
# /etc/auto_master file # local mount point /map name mount options
/etc/auto_direct_cifs
Figure 3-8 illustrates how AutoFS sets up the direct mounts for this conguration. Figure 3-8 Example of CIFS Direct Mounts CIFS Client "mammoth" / /cifs /mnt1 /tools /design /tools
/design
CIFS Mounts
Chapter 3
57
NOTE
AutoFS ignores everything from the sharp sign to the end of the line.
The following example includes sample lines from the AutoFS master map on the CIFS client, mammoth. The master map also includes an entry for the direct map, /etc/auto_direct.
# /etc/auto_master file # local mount point /cifs/desktop map name mount options /etc/auto_indirect_cifs
58
Chapter 3
Conguring and Administering AutoFS Support for HP CIFS Client Figure 3-9 illustrates how AutoFS sets up the indirect mounts for this conguration. Figure 3-9 Example of CIFS Indirect Mounts CIFS Server WinSrv1 / /cifs-share1 CIFS Client "mammoth" / /cifs /desktop
/cifs_mnt1
/cifs_mnt2 /pub
/bin /usr
CIFS Mounts
Chapter 3
59
In the preceding command, local_directory is the congured mount point in the AutoFS map. 2. To verify that the contents of the remote directory have been mounted under the local mount point, issue the following command:
/usr/bin/ls
If the directory is congured in an indirect map, issuing the ls command from the parent directory displays potential mount points (browsability). When you change to a subdirectory congured in the indirect map, or issue the ls subdirectory command, the subdirectory is mounted. Consider that you have the following indirect map conguration:
# /etc/auto_master file # local mount point /nfs/desktop map name /etc/auto_desktop mount options
# /etc/auto_desktop file # local mount point mount options remote server:directory draw write -nosuid -nosuid thyme:/export/apps/draw basil:/export/write
Considering that you have the preceding conguration, issue the following commands:
cd /nfs/desktop ls
60
Chapter 3
Conguring and Administering AutoFS Verifying the AutoFS Conguration The ls command displays this output because the draw and write subdirectories are the potential mount points (browsability), but not mounted currently. However, if you issue the following commands, both the draw and write subdirectories are mounted (on-demand mounting):
cd /nfs/desktop/write cd /nfs/desktop/draw
If AutoFS does not mount your congured directories, see Troubleshooting AutoFS on page 63.
Chapter 3
61
62
Chapter 3
Troubleshooting AutoFS
This chapter describes the tools and procedures for troubleshooting AutoFS.
Chapter 4
63
Troubleshooting AutoFS
This chapter includes the following sections: AutoFS Logging on page 65 AutoFS Tracing on page 67
64
Chapter 4
AutoFS Logging
AutoFS logs messages through /usr/sbin/syslogd. By default, syslogd writes messages to the /var/adm/syslog/syslog.log le. For more information, see the syslogd (1M) man page.
3. For every automounted directory listed by the grep command, issue the following command to determine whether the directory is currently in use:
/usr/sbin/fuser -cu local_mount_point
This command lists the process IDs and user names of all the users using the mounted directory. 4. Warn the users to cd out of the directory, and kill the processes that are using the directory, or wait until the processes terminate. You can issue the following command to kill all the processes using the mounted directory:
/usr/sbin/fuser -ck local_mount_point
Chapter 4
65
WARNING
Do not kill the automountd daemon with the kill command because it does not die gracefully. Moreover, it does not unmount AutoFS mount points before it dies. Use the nfs.client stop script to make sure automountd dies cleanly.
6. Add -v to the AUTOMOUNTD_OPTIONS variable in the /etc/rc.config.d/nfsconf le, as shown in the following example: AUTOMOUNTD_OPTIONS = -v This change enables AutoFS logging. 7. To start AutoFS, issue the following command: /sbin/init.d/nfs.client start
66
Chapter 4
AutoFS Tracing
Two levels of AutoFS tracing are available: Detailed (level 3) Includes traces of all AutoFS requests and replies, mount attempts, timeouts, and unmount attempts. You can start level 3 tracing while AutoFS is running. Basic (level 1) Includes traces of all AutoFS requests and replies. You must restart AutoFS to start level 1 tracing.
where PID is the process ID returned by the ps command. Level 3 tracing is appended to the /var/adm/automount.log le.
NOTE
The command, kill -SIGUSR2 PID, works if tracing is not already on.
Chapter 4
67
Troubleshooting AutoFS AutoFS Tracing 1. Log on as root to the NFS client. 2. Add -T to the AUTOMOUNTD_OPTIONS variable in the /etc/rc.config.d/nfsconf le, as in the following example:
AUTOMOUNTD_OPTIONS=-T
This change puts AutoFS basic tracing messages into the /var/adm/automount.log le. 3. To get a list of all the automounted directories on the client, issue the following command:
for FS in $(grep autofs /etc/mnttab | awk {print $2}) do grep nfs /etc/mnttab | awk {print $2} | grep ^${FS} done
4. For every automounted directory listed by the grep command, issue the following command to determine whether the directory is currently in use:
/usr/sbin/fuser -cu local_mount_point
This command lists the process IDs and user names of all the users using the mounted directory. 5. Warn the users to cd out of the directory, and kill the processes that are using the directory, or wait until the processes terminate. You can issue the following command to kill all the processes using the mounted directory:
/usr/sbin/fuser -ck local_mount_point
WARNING
Do not kill the automountd daemon with the kill command because it does not die gracefully. Moreover, it does not unmount AutoFS mount points before it dies. Use the nfs.client stop script to make sure automountd dies cleanly.
68
Chapter 4
Chapter 4
69
/tmp hpnfs127:/t
/n2ktmp_8264/nfs127/tmp hpnfs127:/tmp
nfsmount: input: hpnfs127[other] nfsmount: standard mount on /n2ktmp_8264/nfs127/tmp : hpnfs127:/tmp nfsmount: v3=1[0],v2=0[0] => v3. nfsmount: Get mount version: request vers=3 min=3 nfsmount: mount version=3 Port numbers are 937, 937 Port match mount hpnfs127:/tmp /n2ktmp_8264/nfs127/tmp() nfs_args: hpnfs127, , 0x2004060, 0, 0, 0, 0, 0, 0, 0, args_temp: hpnfs127, , 0x3004060, 0, 0, 0, 0, 0, 0, 0, mount hpnfs127:/tmp dev=44000004 rdev=0 OK MOUNT REPLY: status=0, AUTOFS_DONE
Unmount Event Tracing Output The general format of an unmount event trace is as follows: UNMOUNT REQUEST: <time stamp> <other tracing> ... <other tracing> UNMOUNT REPLY: <status>=unmount status The unmount status in the unmount reply contains 0 if the unmount is successful; it has a non-zero value when the unmount is not successful. The following is an example of a typical unmount trace event:
May May May May 13 13 13 13 18:46:27 18:46:27 18:46:27 18:46:27 t1 t1 t1 t1 UNMOUNT REQUEST: Tue May 13 18:46:27 2003 dev=44000004 rdev=0 direct ping: hpnfs127 request vers=3 min=2 pingnfs OK: nfs version=3
70
Chapter 4
Chapter 4
71
72
Chapter 4
Index
Symbols & (ampersand) AutoFS maps, 50 * (asterisk) AutoFS maps, 50 + (plus sign) AutoFS maps, 52 A ampersand (&) AutoFS maps, 50 asterisk (*) AutoFS maps, 50 auto_direct map, 36 auto_master map, 29, 35, 39 AUTO_MASTER variable, 13 AutoFS components, 3 direct vs. indirect, 32 duration of mounts, 30, 37, 41 hierarchical mounts, 44 -hosts map, 29 included les, 52 logging, 65, 66 mounting home directories, 26, 50 multiple servers, 45 new features, 6 -null map, 55 replicated servers, 45 restarting, 15, 65, 68 simultaneous mounts, 44 starting, 13 tracing, 67, 68 unmounting directories, 48 verifying conguration, 60 AutoFS maps environment variables, 49 wildcard characters, 26, 50 autofskd, 3 AUTOMOUNT_OPTIONS variable, 30, 37, AUTOMOUNTD_OPTIONS variable, 49 B bg option AutoFS maps, 36, 40
41
C components AutoFS, 3 D direct map, 35 advantages, 32 environment variables, 49 examples, 37, 57 modifying, 37, 41 disabling Enhanced AutoFS, 14 E enabling Enhanced AutoFS, 13 Enhanced AutoFS command line options, 24 disabling, 14 enabling, 13 installing, 11 overview, 3 restarting, 15 verifying installation, 11 environment variables AutoFS maps, 49 /etc/auto_direct le see auto_direct map, 36 /etc/auto_master le see auto_master map, 29 F fuser, 15, 65, 68 H hierarchical mounts, AutoFS, 44 home directories, automounting, 26, 50 -hosts map, 29 examples, 31 I included les AutoFS maps, 52 indirect map, 39 advantages, 32
73
Index
environment variables, 49 examples, 41, 58 modifying, 41 wildcard characters, 26, 50 installing Enhanced AutoFS, 11 L logging AutoFS, 65, 66 ls AutoFS, 60 M master map, 35, 39 mount options changing, 37, 41, 57 nosuid, 29 mounting directories with AutoFS, 36, 39 multiple mounts, AutoFS, 45 multiple servers, for automounted directories, 45 N Name Service Switch, 30, 36, 40, 52 /net directory, 29 NFS starting, 13 nfs.client script, 13 NFS_CLIENT variable, 13 nfsconf le, 13, 30, 37, 41, 49, 68 nosuid mount option, 29 -null map, 55 O overview Enhanced AutoFS, 3 P PAM NTLM secure storage integration, 56 plus sign (+) AutoFS maps, 52 R replicated servers, for automounted directories, 45 restarting Enhanced AutoFS, 15 S SIGUSR2 signal to automount, 67 simultaneous mounts, AutoFS, 44 syslog, 65 T tracing AutoFS, 67, 68 troubleshooting, 63 U unmounting directories, 48 V verifying installation Enhanced AutoFS, 11 W wildcard characters AutoFS maps, 26, 50
74