Sie sind auf Seite 1von 88

Enhanced AutoFS Administrators Guide

HP-UX 11i v1
Edition 1

Manufacturing Part Number: 5990-7199 March 2004

United States Copyright 2004 Hewlett-Packard Development Company, L.P.

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

2. Installing Enhanced AutoFS


Installation and Verication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Installing Enhanced AutoFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Verifying Enhanced AutoFS Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Enabling Enhanced AutoFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Disabling Enhanced AutoFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Restarting Enhanced AutoFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Updating from Automounter to Enhanced AutoFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 11 11 13 14 15 17

3. Conguring and Administering AutoFS


Using the New Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . On-Demand Mounting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Browsability for Indirect Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . NFS Loopback Mount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Command-Line Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Automount Command-Line Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Automountd Command-Line Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Automounting Home Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example of Automounting a Users Home Directory . . . . . . . . . . . . . . . . . . . . . . . . . Automounting All Exported Directories Using the -hosts Map. . . . . . . . . . . . . . . . . . . Deciding Between Direct and Indirect NFS Automounts . . . . . . . . . . . . . . . . . . . . . . . How AutoFS Sets Up Direct and Indirect Mounts . . . . . . . . . . . . . . . . . . . . . . . . . . . Mounting a Remote Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using a Direct AutoFS Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sample File Entries for NFS Direct Automounts . . . . . . . . . . . . . . . . . . . . . . . . . . Using an Indirect AutoFS Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sample File Entries for NFS Indirect Automounts. . . . . . . . . . . . . . . . . . . . . . . . . 21 21 22 23 24 24 25 26 27 29 32 33 35 35 37 38 41

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

About This Document


This document describes how to install, congure, and troubleshoot the AutoFS product on HP-UX platforms. The latest version of this document is available at http://docs.hp.com. The document printing date and part number indicate the documents current edition. The printing date will change when a new edition is printed. Minor changes may be made at reprint without changing the printing date. The document part number will change when extensive changes are made. Document updates may be issued between editions to correct errors or document product changes. To ensure that you receive the updated or new editions, subscribe to the appropriate product support service. See your HP sales representative for details.

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.

HP-UX Release Name and Release Identier


Each HP-UX 11i release has an associated release name and release identier. The uname(1) command with the -r option returns the release identier. Table 1 shows the releases available for HP-UX 11i. Table 1 HP-UX 11i Releases Release Identier B.11.11 B.11.20 B.11.22 B.11.23 Release Name HP-UX 11i v1 HP-UX 11i v1.5 HP-UX 11i v1.6 HP-UX 11i v2.0 Supported Processor Architecture PA-RISC Intel Itanium Intel Itanium Intel Itanium

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

Publication Date March 2004

What Is in This Document


This manual describes how to install, congure, and troubleshoot the AutoFS product. The organization of this manual is as follows: Table 3 Document Organization Chapter An Introduction to AutoFS Installing Enhanced AutoFS Description Use this chapter to know about AutoFS. Use this chapter to learn how to install, enable, disable, and restart the Enhanced AutoFS product on an HP-UX system. Use this chapter to learn how to congure and administer AutoFS. Use this chapter to understand detailed procedures and tools for troubleshooting the AutoFS product.

Conguring and Administering AutoFS Troubleshooting AutoFS

New and Changed Documentation in This Edition


This is the rst version of Enhanced AutoFS Administrators Guide.

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.

HP Welcomes Your Comments


HP welcomes your comments and suggestions on this manual. You can send your comments in the following ways: Internet electronic mail: netinfo_feedback@cup.hp.com Using a feedback form located at the following URL: http://docs.hp.com/assistance/feedback.html Please include the following information along with your comments: The complete title of the manual and the part number. The part number appears on the title page of printed and PDF versions of a manual. The section numbers and page numbers of the information on which you are commenting. The version of HP-UX that you are using.

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

An Introduction to AutoFS Overview of AutoFS

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.

How AutoFS Works


AutoFS consists of the following components: The automount command It installs AutoFS mount points and associates an automount map with each mount point. The AutoFS le system monitor attempts to access directories within it and noties the automountd daemon. The daemon uses the map to locate a le system and then mounts this le system at the point of reference within the AutoFS le system. The automount map determines the location of all the AutoFS mount points.

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

An Introduction to AutoFS New Features of AutoFS

New Features of AutoFS


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. The new features introduced with Enhanced AutoFS are as follows: On-demand mounting In previous versions, AutoFS mounted an entire set of le systems if they were hierarchically related. However, Enhanced AutoFS mounts only those le systems that users access; other le systems that are hierarchically related to these le systems are mounted as needed. This increases the performance by preventing unnecessary mounting and unmounting. Browsability Enhanced AutoFS allows a user to view the directories that can be mounted for indirect maps, without having to actually mount each le system. Device ID Enhanced AutoFS uses the device id of a mounted le system stored in the /etc/mnttab le as a reference for a future unmount. This increases the performance because during unmounting, Enhanced AutoFS does not have to retrieve the device id from the remote le system. Concurrent mount or unmount Enhanced AutoFS performs concurrent mounts and unmounts using a multithreaded automountd daemon. This results in a performance enhancement, which prevents services from hanging if a server is unavailable. Reliable NFS ping Enhanced AutoFS supports a -retry=n mount option for an NFS map entry to congure the ping timeout value based on the network setup. CIFS Client support Enhanced AutoFS has the ability to support HP CIFS Client. NFS loopback mount By default, Enhanced AutoFS uses LOFS mounts for locally mounted le systems. Enhanced AutoFS provides an option to allow loopback NFS mounts for the local mount. You need to use this option in the High Availability NFS environments.

Chapter 1

An Introduction to AutoFS Comparing AutoFS with Automounter

Comparing AutoFS with Automounter


Starting with the HP-UX Extension Pack release, August 1998 (for HP-UX 11.0), the new automounting utility, AutoFS, was available. Now, AutoFS has been enhanced to include the features of the SUN ONC+ 2.3 AutoFS. Automounter will become obsolete from the HP-UX release 11i version 2. AutoFS mounts directories automatically when users or processes request access to them. It unmounts them automatically if they have been idle for a congured period of time (10 minutes, by default). AutoFS has the following advantages over old Automounter: With AutoFS, the congured mount points are the actual mount points. You do not have to stop AutoFS to change your AutoFS maps. The AutoFS daemon, automountd, runs continuously. When you make a change to an AutoFS map, you run the automount command, which reads the maps and then exits. AutoFS can support different types of le systems, including NFS (protocol versions 2 and 3), HFS, CacheFS, VxFS, and the HP CIFS Client le system.

Chapter 1

An Introduction to AutoFS Comparing AutoFS with Automounter

Chapter 1

Installing Enhanced AutoFS


This chapter includes information on how to install, enable, disable, and restart Enhanced AutoFS. In addition, it includes information on how to update from the Automounter conguration to Enhanced AutoFS.

Chapter 2

Installing Enhanced AutoFS

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

Installing Enhanced AutoFS Installation and Verication

Installation and Verication


This section provides information on installing Enhanced AutoFS and verifying the Enhanced AutoFS installation.

Installing Enhanced AutoFS


To install Enhanced AutoFS on your system, perform the following steps: 1. Download the software depot to a directory, for example, /tmp/EnhancedAuto.depot. 2. Use swinstall to install Enhanced AutoFS; run the following command: swinstall -x autoreboot=true -s /tmp/EnhancedAuto.depot The system reboots automatically if the swinstall execution completes without errors.

Verifying Enhanced AutoFS Installation


You can verify the Enhanced AutoFS installation as follows: To verify that Enhanced AutoFS is successfully installed, run the following command: swlist -l bundle ENHAUTO If Enhanced AutoFS is successfully installed, the following message appears: ENHAUTO B.11.11.0402.1 Enhanced AutoFS, February 2004 To verify that there were no errors during the Enhanced AutoFS installation, run the following command: swverify ENHAUTO If Enhanced AutoFS is successfully installed, the following message appears: Verification succeeded

Chapter 2

11

Installing Enhanced AutoFS Installation and Verication

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

Installing Enhanced AutoFS Enabling Enhanced AutoFS

Enabling Enhanced AutoFS


To enable Enhanced AutoFS, perform the following steps: 1. In the /etc/rc.config.d/nfsconf le, make sure the values for the NFS_CLIENT, AUTOMOUNT, and AUTOFS variables are set to 1; see the following:
NFS_CLIENT=1 AUTOMOUNT=1 AUTOFS=1

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

Installing Enhanced AutoFS Disabling Enhanced AutoFS

Disabling Enhanced AutoFS


To disable Enhanced AutoFS, perform the following steps: 1. To stop AutoFS, issue the following command:
/sbin/init.d/nfs.client stop

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

Installing Enhanced AutoFS Restarting Enhanced AutoFS

Restarting Enhanced AutoFS


You rarely need to restart Enhanced AutoFS. If there is a need to restart Enhanced AutoFS, use the following procedure: 1. To nd a list of all the automounted directories on the client, issue the following script:
for FS in $(grep autofs /etc/mnttab | awk {print $2}) do grep nfs /etc/mnttab | awk {print $2} | grep ^${FS} done

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

4. To kill Enhanced AutoFS, issue the following command:


/sbin/init.d/nfs.client stop

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

Installing Enhanced AutoFS Updating from Automounter to Enhanced AutoFS

Updating from Automounter to Enhanced AutoFS


This section includes information on how to update from the Automounter conguration to Enhanced AutoFS. To update from Automounter to Enhanced AutoFS, perform the following steps: 1. In the /etc/rc.config.d/nfsconf le, set the AUTOFS variable to 1. 2. Copy the options specied in the AUTO_OPTIONS variable to the AUTOMOUNT_OPTIONS or AUTOMOUNTD_OPTIONS variable. In addition, remove the obsolete options. Table 2-1 lists the options of the old automount command and the equivalent AutoFS command options. It also indicates which automount options are obsolete with AutoFS. Table 2-1 Old automount Command-Line Options Old automount Option -D variable=value Equivalent AutoFS Command Option automountd -D variable=value automount -f master_file Obsolete with AutoFS.

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

Obsolete with AutoFS.

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

Conguring and Administering AutoFS


This chapter includes information on the tasks involved in conguring AutoFS. Before conguring AutoFS, see Deciding Between Direct and

Chapter 3

19

Conguring and Administering AutoFS

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

Conguring and Administering AutoFS Using the New Features

Using the New Features


This section includes information on using the new features introduced with Enhanced AutoFS.

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

Only /auto/project/specs subdirectories are mounted using on-demand mounting.

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

Browsability for Indirect Maps


Enhanced AutoFS allows a user to view the potential mount points for indirect maps, without having to actually mount each le system. By default, browsing is enabled for all indirect AutoFS maps. To disable browsing, you can specify the -nobrowse option for each indirect map that you do not want to be browseable. The automountd command with -n option is used to disable browsing for all indirect maps without having to specify the -nobrowse option for each indirect map. Consider the following example:
# /etc/auto_master file # local mount point /nfs/desktop map name /etc/auto_indirect mount options

22

Chapter 3

Conguring and Administering AutoFS Using the New Features


# /etc/auto_indirect file # local mount point mount options /test /apps -nosuid -nosuid

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 output of the last command (ls) is as follows:


test apps

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

NFS Loopback Mount


By default, AutoFS uses LOFS mounts for locally mounted le systems. Enhanced AutoFS provides an option to enable loopback NFS mounts for the local mount. You can use the automountd command with the -L option to enable the loopback NFS mounts for locally mounted le systems. You need to use this option in the High Availability NFS environments.

Chapter 3

23

Conguring and Administering AutoFS Command-Line Options

Command-Line Options
This section includes information on the command-line options available for Enhanced AutoFS.

Automount Command-Line Options


Table 3-1 lists the automount command-line options available for Enhanced AutoFS. Table 3-1 Automount Command-Line Options Option -f master file Purpose Specify a local master le for initialization. If you use the -f option, and the specied master le is not found, automount uses the switch policy for automount in /etc/nsswitch.conf. If it fails to access the nsswitch.conf le, or if the switch policy for automount does not exist, automount rst defaults to /etc/auto_master, and then it defaults to the NIS auto_master map. Specify time in seconds so that AutoFS can unmount a le system that is not accessed within this interval. The default value is 10 minutes. Verbose mode. Notify about AutoFS mounts, unmounts, or other non-essential information.

-t duration

-v

24

Chapter 3

Conguring and Administering AutoFS Command-Line Options

Automountd Command-Line Options


Table 2-6 lists the automountd command-line options available for Enhanced AutoFS. Table 3-2 Automountd Command-Line Options Option -D variable = value Purpose Assign value to the indicated AutoFS map substitution variable. You cannot use these assignments to substitute variables in the master map. Turn off browsing for all AutoFS mount points. It gives an easy way to disable browsing of all maps without having to specify the nobrowse option for each indirect AutoFS map. Enable tracing and display tracing information to the /var/adm/automount.log le. Verbose mode. Logs status messages to the /var/adm/syslog/syslog.log le. Force all mounts to the local host to be NFS mounts instead of the default LOFS mounts.

-n

-T

-v -L

Chapter 3

25

Conguring and Administering AutoFS Automounting Home Directories

Automounting Home Directories


To automount home directories, you need to perform the following steps: 1. Make sure the machines where users home directories are located are set up as NFS servers. In addition, make sure the machines are exporting the home directories. See the Conguring and Administering an NFS Server section of NFS Services Administrators Guide. 2. In the /etc/passwd le on the NFS clients, or in the NIS passwd map or the NIS+ passwd table, congure the home directory of each user as the NFS mount point where the users home directory will be mounted. For example, if home directories are mounted under /home, Claires home directory will be congured as /home/claire in the /etc/passwd le. 3. If you are using local les for your AutoFS maps, create a le called /etc/auto_home on the NFS clients, and add a line into the le for each user; see the following example:
sammy thyme:/export/home/& -nosuid

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.

Example of Automounting a Users Home Directory


User Howards home directory is located on the NFS server, basil, where it is called /export/home/howard. On all the machines in the network, Howard has the following entry in the /etc/passwd le:
howard:*:700:70:Howard:/home/howard:/usr/bin/ksh

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

Automounting All Exported Directories Using the -hosts Map


To automount all exported directories from any host using the -hosts map, perform the following steps: 1. If you are using local les for your AutoFS maps, use an editor to add the following line to the AutoFS master map le, /etc/auto_master:
/net -host -nosuid,soft,nobrowse

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

Deciding Between Direct and Indirect NFS Automounts


Before you automount a remote directory, decide whether you want to use a direct or an indirect AutoFS map. Table 3-3 lists the advantages and disadvantages of each type of map. An indirect map is better than a direct map because it is easier to modify while AutoFS is running. In addition, it does not cause mount storms in directories with many AutoFS mount points. However, if your automounted directory must share the same parent directory with local or standard-mounted directories, you need to choose a direct map. Table 3-3 lists the advantages and disadvantages of direct and indirect AutoFS maps. Table 3-3 Direct Versus Indirect AutoFS Map Direct Map Advantage: A user can see the contents of a direct-mounted directory with the ls command. If the contents are not mounted, ls causes them to mount. Indirect Map Advantage: Enhanced AutoFS allows a user to view the available mount points for indirect maps, without having to actually mount each le system when browsability is enabled by default. Disadvantage: An indirect map hides any local, standard-mounted, or direct-mounted les or directories underneath the mount point for the map.

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.

How AutoFS Sets Up Direct and Indirect Mounts


The automounts congured in a direct map may be mounted in various places in the local le system; they do not have to be located under the same parent directory. The automounts congured in an indirect map are all mounted under the same local parent directory.

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

Conguring and Administering AutoFS Mounting a Remote Directory

Mounting a Remote Directory


This section provides detailed information on how to mount a remote directory using both the direct and indirect AutoFS maps.

Using a Direct AutoFS Map


To mount a remote directory using a direct AutoFS map, perform the following steps: 1. If you are using local les for your AutoFS maps, use an editor to open or create a direct map in the /etc directory. The direct map is commonly called /etc/auto_direct. Add a line to the direct map with the following syntax:
local_directory [mount_options] server:remote_directory

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

Conguring and Administering AutoFS Mounting a Remote Directory


/usr/sbin/automount

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 server "basil" / /export /FY94 /proj1

NFS mounts

Using an Indirect AutoFS Map


To mount a remote directory using an indirect AutoFS map, perform the following steps: 1. If you are using local les for your AutoFS maps, use an editor to open or create an indirect map in the /etc directory. Add a line with the following syntax to the indirect map:
local_subdirectory [mount_options] server:remote_directory

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

Conguring and Administering AutoFS Mounting a Remote Directory

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 server "basil" / /export /write

NFS mounts

42

Chapter 3

Conguring and Administering AutoFS Executable Maps

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

Conguring and Administering AutoFS Automounting Multiple Directories

Automounting Multiple Directories


AutoFS enables you to automount multiple directories simultaneously (hierarchical mounts). Use an editor to create an entry with the following format in a direct or indirect AutoFS map:
local_dir /local_subdirectory [-options] \ server:remote_directory \ /local_subdirectory [-options] server:remote_directory \ ..

(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

The following is another example from an indirect map:


chap2 -nosuid /text /graphics /old sage:/our_book/chap2 \ basil:/our_book/artwork/chap2 \ sage:/our_book/oldfiles/chap2

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

Conguring Multiple Servers for an AutoFS Directory


To congure multiple (replicated) servers for an AutoFS directory, perform the following steps: 1. Follow the instructions mentioned in Using a Direct AutoFS Map on page 35 or Using an Indirect AutoFS Map on page 38. 2. In the direct or indirect map, modify the line that mounts the remote directory so that multiple servers are listed. If the remote directory has a different name on different servers, use a syntax like the following example from a direct map:
/nfs/proj2/schedule -ro \ broccoli:/export/proj2/schedule\ cauliflower:/proj2/FY94/schedule

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

Conguring and Administering AutoFS Modifying or Removing an Automounted Directory

Modifying or Removing an Automounted Directory


If you are planning to remove an automounted directory, 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. 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

Conguring and Administering AutoFS Shortcuts for AutoFS Maps

Shortcuts for AutoFS Maps


This section includes information on the elements that you can use as shortcuts in AutoFS maps. You can use environment variables and wildcard characters as shortcuts in AutoFS maps.

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

You cannot use environment variables in the AutoFS master map.

Chapter 3

49

Conguring and Administering AutoFS Shortcuts for AutoFS Maps

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

You cannot use the asterisk (*) wildcard in a direct map.

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

Including an AutoFS Map in Another AutoFS Map


To include the contents of an AutoFS map in another AutoFS map, add a plus sign (+) before the map name; see the following example:
# /etc/auto_home file # local mount point mount options remote server:directory basil -nosuid +auto_home basil:/export/home/basil

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

Conguring and Administering AutoFS Creating a Hierarchy of AutoFS Maps

Creating a Hierarchy of AutoFS Maps


An organization made up of many departments may want to organize a shared automounted directory structure. In the following example, the shared top-level directory is called /org. The /org directory contains several subdirectories, listed in the auto_org AutoFS map. Each department administers its own AutoFS map for its subdirectory. The AutoFS master map needs only a single entry for /org.
# auto_master map # Directory /org Map Name auto_org

The auto_org map is as follows:


finance marketing legal research eng -fstype=autofs -fstype=autofs -fstype=autofs -fstype=autofs -fstype=autofs auto_finance auto_marketing auto_legal auto_research auto_eng

The engineering departments map, auto_eng, is as follows:


releases tools source projects bigiron:/export/releases mickey,minnie:/export/tools auto_eng_source auto_eng_projects

-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

Conguring and Administering AutoFS Turning Off an AutoFS Map

Turning Off an AutoFS Map


To turn off an AutoFS map using the -null map, perform the following steps: 1. Add a line with the following syntax to the AutoFS master map:
local_directory -null

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

Conguring and Administering AutoFS Support for HP CIFS Client

Support for HP CIFS Client


To enable the automatic mounting and unmounting of CIFS le systems, Enhanced AutoFS supports integration with HP CIFS Client. To enable this feature, you must install and congure HP CIFS Client on the system along with Enhanced AutoFS. For more information on the CIFS Client installation and conguration, see HP CIFS Client Administrators Guide. Enhanced AutoFS supports only the automatic mounting of the CIFS le systems with the direct and indirect maps; it does not support CIFS le system mounts with special or executable map les, or with multiple (replicated) servers. To use AutoFS with HP CIFS Client, perform the following steps: 1. Set the le system type mount option, fstype, to cifs in all the CIFS le system mount entries of the AutoFS direct and indirect map les. 2. The remote system and directory of the CIFS le system mount entries must be a CIFS server and a share exported by the CIFS server, for example, cifsSrv:/share. 3. Enable the user authentication to the CIFS Server so that users can have access to the mounted CIFS le systems. The options for authentication methods are as follows: Supply a user name and password in the CIFS mount entry of the direct or indirect map le. Enable one of the following CIFS Client automatic login options: Store CIFS user password in the CIFS Client database. Enable guest user support, where all unauthenticated users are automatically logged on as same guest user. Integrate with PAM NTLM cache. Integrate with system Kerberos cache (kinit(1) and PAM Kerberos). For more information on CIFS authentication, see Chapter 3 of HP CIFS Client Administrator s Guide.

56

Chapter 3

Conguring and Administering AutoFS Support for HP CIFS Client

Example File Entries for CIFS Direct Map Automounts


The following example includes sample lines from an AutoFS direct map on the CIFS client, mammoth. The sharp sign (#) indicates a comment line.
# /etc/auto_direct_cifs file # local mount point mount options remote server:directory

/cifs/mnt1 -fstype=cifs,username=user,password=cifs \ WinSrv1: /cifs-share1

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

CIFS Server "WinSrv1 / /cifs-share1

/design

CIFS Mounts

Chapter 3

57

Conguring and Administering AutoFS Support for HP CIFS Client

Example File Entries for CIFS Indirect Map Automounts


The following example includes sample lines from an AutoFS indirect map on the CIFS client, mammoth. The sharp sign (#) indicates a comment.
# /etc/auto_indirect_cifs # local mount point mount options remote server:directory

cifs_mnt1 -fstype=cifs,username=user1,password=cifs\ WinSrv1:/ cifs-share1 cifs_mnt2 -fstype=cifs,username=user2,password=cifs\ WinSrv2:/ cifs-share2

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 Server "WinSrv2 / /cifs-share2

/mail

/pub /bin /usr

/cifs_mnt1

/cifs_mnt2 /pub

/bin /usr

/mail

CIFS Mounts

Chapter 3

59

Conguring and Administering AutoFS Verifying the AutoFS Conguration

Verifying the AutoFS Conguration


To verify that AutoFS has been congured correctly, perform the following steps: 1. To change the current working directory to an automounted directory, issue the following command:
/usr/bin/cd local_directory

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

The output of the last command (ls) is as follows:


draw write

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

Conguring and Administering AutoFS Verifying the AutoFS Conguration

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

Troubleshooting AutoFS AutoFS Logging

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.

Starting AutoFS Logging


To start AutoFS logging, perform the following steps: 1. Log on as root to the NFS client. 2. Issue the following command to get a list of all the automounted directories on the client:
for FS in $(grep autofs /etc/mnttab | awk {print $2}) do grep nfs /etc/mnttab | awk {print $2} | grep ^${FS} done

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

5. To kill AutoFS, issue the following command:


/sbin/init.d/nfs.client stop

Chapter 4

65

Troubleshooting AutoFS AutoFS Logging

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

Stopping AutoFS Logging


To stop AutoFS logging, kill AutoFS and restart it (as described in the preceding section) by removing -v option from the AUTOMOUNTD_OPTIONS variable.

66

Chapter 4

Troubleshooting AutoFS AutoFS Tracing

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.

Starting AutoFS Detailed Tracing


To start detailed (level 3) tracing, perform the following steps: 1. Log on as root to the NFS client. 2. Issue the following commands:
ps -ef | grep automoutd kill -SIGUSR2 PID

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.

Stopping AutoFS Detailed Tracing


To stop detailed tracing, issue the same commands (that start level 3 tracing) to send the SIGUSR2 signal to automountd. The SIGUSR2 signal is a toggle that turns tracing on or off depending on its current state. If you have basic (level 1) tracing turned on when you send the SIGUSR2 signal to automountd, the SIGUSR2 signal turns tracing off.

Starting AutoFS Basic Tracing


To start basic (level 1) tracing, perform the following steps:

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

6. To kill AutoFS, issue the following command:


/sbin/init.d/nfs.client stop

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.

7. To start AutoFS with tracing enabled, issue the following command:


/abin/init.d/nfs.client start

68

Chapter 4

Troubleshooting AutoFS AutoFS Tracing

Stopping AutoFS Basic Tracing


To stop basic tracing, kill AutoFS and restart it (as described in the preceding section) by removing -T from the AUTOMOUNTD_OPTIONS variable.

AutoFS Tracing Output


The most interesting events to users are the tracing output when mounting and unmounting of le systems occur. Mount Event Tracing Output The general format of a mount event trace is as follows: MOUNT REQUEST: <time stamp> <mount information> ... <other tracing> MOUNT REPLY: <status>=mount status The <mount information> trace has the following format: name=<key>[<subdirectory>] <map>= map name <opts>=mount options <path>=mount path <other tracing> where: <key> = the key value from the map <subdirectory> = subdirectory (may be blank) <map> = name of the map <opts> = mount options <path> = mount path <other tracing> = other trace information The mount status in the mount reply contains 0 if the mount is successful; it has a non-zero value when the mount is not successful. The following is an example of a typical mount trace: <other tracing>

Chapter 4

69

Troubleshooting AutoFS AutoFS Tracing


May 13 18:45:09 t5 May 13 18:45:09 t5 _8264/nfs127/tmp direct=1 May 13 18:45:09 t5 May 13 18:45:09 t5 May 13 18:45:09 t5 mp May 13 18:45:09 t5 May 13 18:45:09 t5 penalty=0 May 13 18:45:09 t5 May 13 18:45:09 t5 May 13 18:45:09 t5 May 13 18:45:09 t5 May 13 18:45:09 t5 May 13 18:45:09 t5 May 13 18:45:09 t5 May 13 18:45:09 t5 May 13 18:45:09 t5 May 13 18:45:09 t5 0, May 13 18:45:09 t5 0, hpnfs127:/tmp May 13 18:45:09 t5 May 13 18:45:09 t5 MOUNT REQUEST: Tue May 13 18:45:09 2003 name=nfs127[/tmp] map=auto.indirect opts= path=/n2ktmp PUSH /etc/auto.indirect POP /etc/auto.indirect mapline: hpnfs127:/ do_mount1: (nfs,nfs)

/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

Troubleshooting AutoFS AutoFS Tracing


May May May May May May 13 13 13 13 13 13 18:46:27 18:46:27 18:46:27 18:46:27 18:46:27 18:46:27 t1 t1 t1 t1 t1 t1 nfsunmount: umount /n2ktmp_8264/nfs127/tmp Port numbers are 937, 937 Port match nfsunmount: umount /n2ktmp_8264/nfs127/tmp OK unmount /n2ktmp_8264/nfs127/tmp OK UNMOUNT REPLY: status=0

Chapter 4

71

Troubleshooting AutoFS AutoFS Tracing

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

Das könnte Ihnen auch gefallen