xref: /netbsd-src/external/bsd/am-utils/dist/doc/am-utils.texi (revision 404fbe5fb94ca1e054339640cabb2801ce52dd30)
1\input texinfo          @c -*-texinfo-*-
2@c $NetBSD: am-utils.texi,v 1.2 2009/01/02 16:00:02 christos Exp $
3@c
4@c Copyright (c) 1997-2007 Erez Zadok
5@c Copyright (c) 1989 Jan-Simon Pendry
6@c Copyright (c) 1989 Imperial College of Science, Technology & Medicine
7@c Copyright (c) 1989 The Regents of the University of California.
8@c All rights reserved.
9@c
10@c This code is derived from software contributed to Berkeley by
11@c Jan-Simon Pendry at Imperial College, London.
12@c
13@c Redistribution and use in source and binary forms, with or without
14@c modification, are permitted provided that the following conditions
15@c are met:
16@c 1. Redistributions of source code must retain the above copyright
17@c    notice, this list of conditions and the following disclaimer.
18@c 2. Redistributions in binary form must reproduce the above copyright
19@c    notice, this list of conditions and the following disclaimer in the
20@c    documentation and/or other materials provided with the distribution.
21@c 3. All advertising materials mentioning features or use of this software
22@c    must display the following acknowledgment:
23@c      This product includes software developed by the University of
24@c      California, Berkeley and its contributors.
25@c 4. Neither the name of the University nor the names of its contributors
26@c    may be used to endorse or promote products derived from this software
27@c    without specific prior written permission.
28@c
29@c THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30@c ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31@c IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32@c ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33@c FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34@c DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35@c OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36@c HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37@c LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38@c OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39@c
40@c
41@c File: am-utils/doc/am-utils.texi
42@c
43@setfilename am-utils.info
44
45@include version.texi
46
47@c info directory entry
48@dircategory Administration
49@direntry
50* Am-utils: (am-utils).          The Amd automounter suite of utilities
51@end direntry
52
53@settitle Am-utils (4.4BSD Automounter Utilities)
54@setchapternewpage odd
55
56@titlepage
57@title Am-utils (4.4BSD Automounter Utilities)
58@subtitle For version @value{VERSION}, @value{UPDATED}
59
60@author Erez Zadok
61(Originally by Jan-Simon Pendry and Nick Williams)
62
63@page
64Copyright @copyright{} 1997-2007 Erez Zadok
65@*
66Copyright @copyright{} 1989 Jan-Simon Pendry
67@*
68Copyright @copyright{} 1989 Imperial College of Science, Technology & Medicine
69@*
70Copyright @copyright{} 1989 The Regents of the University of California.
71@sp
72All Rights Reserved.
73@vskip 1ex
74Permission to copy this document, or any portion of it, as
75necessary for use of this software is granted provided this
76copyright notice and statement of permission are included.
77@end titlepage
78@page
79
80@c Define a new index for options.
81@syncodeindex pg cp
82@syncodeindex vr cp
83
84@ifinfo
85
86@c ################################################################
87@node Top, License, , (DIR)
88
89@b{Am-utils (4.4BSD Automounter Utilities) User Manual}
90@*
91For version @value{VERSION}, @value{UPDATED}
92
93@b{Erez Zadok}
94@*
95(Originally by Jan-Simon Pendry and Nick Williams)
96
97Copyright @copyright{} 1997-2007 Erez Zadok
98@*
99Copyright @copyright{} 1989 Jan-Simon Pendry
100@*
101Copyright @copyright{} 1989 Imperial College of Science, Technology & Medicine
102@*
103Copyright @copyright{} 1989 The Regents of the University of California.
104@*
105All Rights Reserved.
106
107Permission to copy this document, or any portion of it, as
108necessary for use of this software is granted provided this
109copyright notice and statement of permission are included.
110
111Am-utils is the 4.4BSD Automounter Tool Suite, which includes the Amd
112automounter, the Amq query and control program, the Hlfsd daemon, and
113other tools.  This Info file describes how to use and understand the
114tools within Am-utils.
115@end ifinfo
116
117@menu
118* License::                  Explains the terms and conditions for using
119                             and distributing Am-utils.
120* Distrib::                  How to get the latest Am-utils distribution.
121* AddInfo::                  How to get additional information.
122* Intro::                    An introduction to Automounting concepts.
123* History::                  History of am-utils' development.
124* Overview::                 An overview of Amd.
125* Supported Platforms::      Machines and Systems supported by Amd.
126* Mount Maps::               Details of mount maps.
127* Amd Command Line Options:: All the Amd command line options explained.
128* Filesystem Types::         The different mount types supported by Amd.
129* Amd Configuration File::   The amd.conf file syntax and meaning.
130* Run-time Administration::  How to start, stop and control Amd.
131* FSinfo::                   The FSinfo filesystem management tool.
132* Hlfsd::                    The Home-Link Filesystem server.
133* Assorted Tools::           Other tools which come with am-utils.
134* Examples::                 Some examples showing how Amd might be used.
135* Internals::                Implementation details.
136* Acknowledgments & Trademarks:: Legal Notes.
137
138Indexes
139* Index::                    An item for each concept.
140@end menu
141
142@iftex
143@unnumbered Preface
144
145This manual documents the use of the 4.4BSD automounter tool suite,
146which includes @i{Amd}, @i{Amq}, @i{Hlfsd}, and other programs.  This is
147primarily a reference manual.  While no tutorial exists, there are
148examples available.  @xref{Examples}.
149
150This manual comes in two forms: the published form and the Info form.
151The Info form is for on-line perusal with the INFO program which is
152distributed along with GNU texinfo package (a version of which is
153available for GNU Emacs).@footnote{GNU packages can be found in
154@url{ftp://ftp.gnu.org/pub/gnu/}.}  Both forms contain substantially
155the same text and are generated from a common source file, which is
156distributed with the @i{Am-utils} source.
157@end iftex
158
159@c ################################################################
160@node License, Distrib, Top, Top
161@unnumbered License
162@cindex License Information
163
164@i{Am-utils} is not in the public domain; it is copyrighted and there are
165restrictions on its distribution.
166
167Redistribution and use in source and binary forms, with or without
168modification, are permitted provided that the following conditions are
169met:
170
171@enumerate
172
173@item
174Redistributions of source code must retain the above copyright notice,
175this list of conditions and the following disclaimer.
176
177@item
178Redistributions in binary form must reproduce the above copyright
179notice, this list of conditions and the following disclaimer in the
180documentation and/or other materials provided with the distribution.
181
182@item
183All advertising materials mentioning features or use of this software
184must display the following acknowledgment:
185
186@cartouche
187``This product includes software developed by the University of
188California, Berkeley and its contributors, as well as the Trustees of
189Columbia University.''
190@end cartouche
191
192@item
193Neither the name of the University nor the names of its contributors may
194be used to endorse or promote products derived from this software
195without specific prior written permission.
196
197@end enumerate
198
199THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
200ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
201IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
202PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
203BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
204CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
205SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
206INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
207CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
208ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
209THE POSSIBILITY OF SUCH DAMAGE.
210
211@c ################################################################
212@node Distrib, AddInfo, License, Top
213@unnumbered Source Distribution
214@cindex Source code distribution
215@cindex Obtaining the source code
216
217The @i{Am-utils} home page is located in
218@example
219@url{http://www.am-utils.org/}
220@end example
221
222You can get the latest distribution version of @i{Am-utils} from
223@example
224@url{ftp://ftp.am-utils.org/pub/am-utils/am-utils.tar.gz}
225@end example
226
227Additional alpha, beta, and release distributions are available in
228@example
229@url{ftp://ftp.am-utils.org/pub/am-utils/}.
230@end example
231
232Revision 5.2 was part of the 4.3BSD Reno distribution.
233
234Revision 5.3bsdnet, a late alpha version of 5.3, was part
235of the BSD network version 2 distribution
236
237Revision 6.0 was made independently by
238Erez Zadok at the Computer Science
239Department of @uref{http://www.cs.columbia.edu/,Columbia University},
240as part of his
241@uref{http://www.fsl.cs.sunysb.edu/docs/zadok-thesis-proposal/,PhD
242thesis work}.  Am-utils (especially version 6.1) continues to be
243developed and maintained at the
244@uref{http://www.cs.sunysb.edu/,Computer Science Department} of
245@uref{http://www.stonybrook.edu/,Stony Brook University}, as a service
246to the user community.
247
248
249@xref{History}, for more details.
250
251@c ################################################################
252@node AddInfo, Intro, Distrib, Top
253@unnumbered Getting Additional Information
254@cindex Getting Additional Information
255
256@unnumberedsec Bug Reports
257@cindex Bug reports
258
259Before reporting a bug, see if it is a known one in the
260@uref{http://www.am-utils.org/docs/am-utils/BUGS.txt,bugs} file.
261
262If you find a problem and hopefully you can reproduce it, please
263describe it in detail and
264@uref{https://bugzilla.filesystems.org/,submit a bug report} via
265@uref{http://www.bugzilla.org/,Bugzilla}.  Alternatively, you can send
266your bug report to the ``am-utils'' list (see
267@url{http://www.am-utils.org/} under ``Mailing Lists'') quoting the details
268of the release and your configuration.  These details can be obtained
269by running the command @samp{amd -v}.  It would greatly help if you
270could provide a reproducible procedure for detecting the bug you are
271reporting.
272
273Providing working patches is highly encouraged.  Every patch
274incorporated, however small, will get its author an honorable mention in
275the @uref{http://www.am-utils.org/docs/am-utils/AUTHORS.txt,authors
276file}.
277
278@unnumberedsec Mailing Lists
279@cindex Mailing lists
280
281There are several mailing lists for people interested in keeping up-to-date
282with developments.
283
284@c ###############
285
286@enumerate
287
288@item
289The users mailing list, @samp{am-utils} is for
290
291@itemize @minus
292@item
293announcements of alpha and beta releases of am-utils
294@item
295reporting of bugs and patches
296@item
297discussions of new features for am-utils
298@item
299implementation and porting issues
300@end itemize
301
302To subscribe, visit @url{http://www.am-utils.org/} under ``Mailing
303Lists.''  After subscribing, you can post a message to this list.  To
304avoid as much spam as possible, only subscribers to this list may post
305to it.
306
307Subscribers of @samp{am-utils} are most helpful if they have the time
308and resources to test new and development versions of amd, on as many
309different platforms as possible.  They should also be prepared to
310learn and use the GNU Autoconf, Automake, and Libtool packages, as
311needed; and of course, become familiar with the complex code in the
312am-utils package.  In other words, subscribers on this list should
313hopefully be able to contribute meaningfully to the development of
314amd.
315
316Note that this @samp{am-utils} list used to be called @samp{amd-dev}
317before January 1st, 2004.  Please use the new name, @samp{am-utils}.
318
319@item
320The announcements mailing list, @samp{am-utils-announce} is for
321announcements only (mostly new releases).  To subscribe, visit
322@url{http://www.am-utils.org/} under ``Mailing Lists.''
323This list is read-only: only am-utils developers may post to it.
324
325@item
326We distribute nightly CVS snapshots in
327@url{ftp://ftp.am-utils.org/pub/am-utils/snapshots/daily/}.  If you
328like to get email notices of commits to the am-utils CVS repository,
329subscribe to the CVS logs mailing list, @samp{am-utils-cvs} at
330@url{http://www.am-utils.org/} under ``Mailing Lists.''
331
332@item
333The older list which was used to user discussions, @samp{amd-workers},
334is defunct as of January 2004.  (Its last address was
335@email{amd-workers AT majordomo.glue.umd.edu}.)  Don't use
336@samp{amd-workers}: use the newer, more active @samp{am-utils} list.
337
338@item
339For completeness, there's a developers-only closed list called
340@samp{am-utils-developers} (see @url{http://www.am-utils.org/} under
341``Mailing Lists'').
342
343@end enumerate
344
345@unnumberedsec Am-utils Book
346@cindex Am-utils book
347@cindex Amd book
348@cindex Automounter book
349@cindex book
350
351@uref{http://www.cs.sunysb.edu/~ezk,Erez Zadok} wrote a
352@uref{http://www.fsl.cs.sunysb.edu/docs/amd-book/,book}, titled @i{Linux NFS and
353Automounter Administration}, ISBN 0-7821-2739-8, (Sybex, 2001).  The
354book is full of details and examples that go beyond what this manual
355has.  The book also covers NFS in great detail.  Although the book is
356geared toward Linux users, it is general enough for any Unix
357administrator and contains specific sections for non-Linux systems.
358
359@c ################################################################
360@node Intro, History, AddInfo, Top
361@unnumbered Introduction
362@cindex Introduction
363
364An @dfn{automounter} maintains a cache of mounted filesystems.
365Filesystems are mounted on demand when they are first referenced,
366and unmounted after a period of inactivity.
367
368@i{Amd} may be used as a replacement for Sun's automounter.  The choice
369of which filesystem to mount can be controlled dynamically with
370@dfn{selectors}.  Selectors allow decisions of the form ``hostname is
371@var{this},'' or ``architecture is not @var{that}.''  Selectors may be
372combined arbitrarily.  @i{Amd} also supports a variety of filesystem
373types, including NFS, UFS and the novel @dfn{program} filesystem.  The
374combination of selectors and multiple filesystem types allows identical
375configuration files to be used on all machines thus reducing the
376administrative overhead.
377
378@i{Amd} ensures that it will not hang if a remote server goes down.
379Moreover, @i{Amd} can determine when a remote server has become
380inaccessible and then mount replacement filesystems as and when they
381become available.
382
383@i{Amd} contains no proprietary source code and has been ported to
384numerous flavors of Unix.
385
386@c ################################################################
387@node History, Overview, Intro, Top
388@unnumbered History
389@cindex History
390
391The @i{Amd} package has been without an official maintainer since 1992.
392Several people have stepped in to maintain it unofficially.  Most
393notable were the `upl' (Unofficial Patch Level) releases of @i{Amd},
394created by me (@uref{http://www.cs.sunysb.edu/~ezk,Erez Zadok}), and available from
395@url{ftp://ftp.am-utils.org/pub/amd/}.  The last such unofficial
396release was `upl102'.
397
398Through the process of patching and aging, it was becoming more and more
399apparent that @i{Amd} was in much need of revitalizing.  Maintaining
400@i{Amd} had become a difficult task.  I took it upon myself to cleanup
401the code, so that it would be easier to port to new platforms, add new
402features, keep up with the many new feature requests, and deal with the
403never ending stream of bug reports.
404
405I have been working on such a release of @i{Amd} on and off since
406January of 1996.  The new suite of tools is currently named "am-utils"
407(AutoMounter Utilities), in line with GNU naming conventions, befitting
408the contents of the package.  In October of 1996 I had received enough
409offers to help me with this task that I decided to make a mailing list
410for this group of people.  Around the same time, @i{Amd} had become a
411necessary part of my PhD thesis work, resulting in more work performed
412on am-utils.
413
414Am-utils version 6.0 was numbered with a major new release number to
415distinguish it from the last official release of @i{Amd} (5.x).  Many
416new features have been added such as a GNU @code{configure} system, NFS
417Version 3, a run-time configuration file (`amd.conf'), many new ports,
418more scripts and programs, as well as numerous bug fixes.  Another
419reason for the new major release number was to alert users of am-utils
420that user-visible interfaces may have changed.  In order to make @i{Amd}
421work well for the next 10 years, and be easier to maintain, it was
422necessary to remove old or unused features, change various syntax files,
423etc.  However, great care was taken to ensure the maximum possible
424backwards compatibility.
425
426Am-utils version 6.1 has autofs support for Linux and Solaris 2.5+ as
427@i{the} major new feature, in addition to several other minor new
428features.  The autofs support is completely transparent to the
429end-user, aside from the fact that @code{/bin/pwd} now always returns
430the correct amd-ified path.  The administrator can easily switch
431between NFS and autofs mounts by changing one parameter in
432@code{amd.conf}.  Autofs support and maintenance was developed in
433conjunction with @email{ionut AT badula.org,Ion Badulescu}.
434
435@c ################################################################
436@node Overview, Supported Platforms, History, Top
437@chapter Overview
438
439@i{Amd} maintains a cache of mounted filesystems.  Filesystems are
440@dfn{demand-mounted} when they are first referenced, and unmounted after
441a period of inactivity.  @i{Amd} may be used as a replacement for Sun's
442@b{automount}(8) program.  It contains no proprietary source code and
443has been ported to numerous flavors of Unix.  @xref{Supported
444Platforms}.@refill
445
446@i{Amd} was designed as the basis for experimenting with filesystem
447layout and management.  Although @i{Amd} has many direct applications it
448is loaded with additional features which have little practical use.  At
449some point the infrequently used components may be removed to streamline
450the production system.
451
452@i{Amd} supports the notion of @dfn{replicated} filesystems by evaluating
453each member of a list of possible filesystem locations one by one.
454@i{Amd} checks that each cached mapping remains valid.  Should a mapping be
455lost -- such as happens when a fileserver goes down -- @i{Amd} automatically
456selects a replacement should one be available.
457
458@menu
459* Fundamentals::
460* Filesystems and Volumes::
461* Volume Naming::
462* Volume Binding::
463* Operational Principles::
464* Mounting a Volume::
465* Automatic Unmounting::
466* Keep-alives::
467* Non-blocking Operation::
468@end menu
469
470@node Fundamentals, Filesystems and Volumes, Overview, Overview
471@comment  node-name,  next,  previous,  up
472@section Fundamentals
473@cindex Automounter fundamentals
474
475The fundamental concept behind @i{Amd} is the ability to separate the
476name used to refer to a file from the name used to refer to its physical
477storage location.  This allows the same files to be accessed with the
478same name regardless of where in the network the name is used.  This is
479very different from placing @file{/n/hostname} in front of the pathname
480since that includes location dependent information which may change if
481files are moved to another machine.
482
483By placing the required mappings in a centrally administered database,
484filesystems can be re-organized without requiring changes to
485configuration files, shell scripts and so on.
486
487@node Filesystems and Volumes, Volume Naming, Fundamentals, Overview
488@comment  node-name,  next,  previous,  up
489@section Filesystems and Volumes
490@cindex Filesystem
491@cindex Volume
492@cindex Fileserver
493@cindex sublink
494
495@i{Amd} views the world as a set of fileservers, each containing one or
496more filesystems where each filesystem contains one or more
497@dfn{volumes}.  Here the term @dfn{volume} is used to refer to a
498coherent set of files such as a user's home directory or a @TeX{}
499distribution.@refill
500
501In order to access the contents of a volume, @i{Amd} must be told in
502which filesystem the volume resides and which host owns the filesystem.
503By default the host is assumed to be local and the volume is assumed to
504be the entire filesystem.  If a filesystem contains more than one
505volume, then a @dfn{sublink} is used to refer to the sub-directory
506within the filesystem where the volume can be found.
507
508@node Volume Naming, Volume Binding, Filesystems and Volumes, Overview
509@comment  node-name,  next,  previous,  up
510@section Volume Naming
511@cindex Volume names
512@cindex Network-wide naming
513@cindex Replicated volumes
514@cindex Duplicated volumes
515@cindex Replacement volumes
516
517Volume names are defined to be unique across the entire network.  A
518volume name is the pathname to the volume's root as known by the users
519of that volume.  Since this name uniquely identifies the volume
520contents, all volumes can be named and accessed from each host, subject
521to administrative controls.
522
523Volumes may be replicated or duplicated.  Replicated volumes contain
524identical copies of the same data and reside at two or more locations in
525the network.  Each of the replicated volumes can be used
526interchangeably.  Duplicated volumes each have the same name but contain
527different, though functionally identical, data.  For example,
528@samp{/vol/tex} might be the name of a @TeX{} distribution which varied
529for each machine architecture.@refill
530
531@i{Amd} provides facilities to take advantage of both replicated and
532duplicated volumes.  Configuration options allow a single set of
533configuration data to be shared across an entire network by taking
534advantage of replicated and duplicated volumes.
535
536@i{Amd} can take advantage of replacement volumes by mounting them as
537required should an active fileserver become unavailable.
538
539@node Volume Binding, Operational Principles, Volume Naming, Overview
540@comment  node-name,  next,  previous,  up
541@section Volume Binding
542@cindex Volume binding
543@cindex Unix namespace
544@cindex Namespace
545@cindex Binding names to filesystems
546
547Unix implements a namespace of hierarchically mounted filesystems.  Two
548forms of binding between names and files are provided.  A @dfn{hard
549link} completes the binding when the name is added to the filesystem.  A
550@dfn{soft link} delays the binding until the name is accessed.  An
551@dfn{automounter} adds a further form in which the binding of name to
552filesystem is delayed until the name is accessed.@refill
553
554The target volume, in its general form, is a tuple (host, filesystem,
555sublink) which can be used to name the physical location of any volume
556in the network.
557
558When a target is referenced, @i{Amd} ignores the sublink element and
559determines whether the required filesystem is already mounted.  This is
560done by computing the local mount point for the filesystem and checking
561for an existing filesystem mounted at the same place.  If such a
562filesystem already exists then it is assumed to be functionally
563identical to the target filesystem.  By default there is a one-to-one
564mapping between the pair (host, filesystem) and the local mount point so
565this assumption is valid.
566
567@node Operational Principles, Mounting a Volume, Volume Binding, Overview
568@comment  node-name,  next,  previous,  up
569@section Operational Principles
570@cindex Operational principles
571
572@i{Amd} operates by introducing new mount points into the namespace.
573These are called @dfn{automount} points.  The kernel sees these
574automount points as NFS filesystems being served by @i{Amd}.  Having
575attached itself to the namespace, @i{Amd} is now able to control the
576view the rest of the system has of those mount points.  RPC calls are
577received from the kernel one at a time.
578
579When a @dfn{lookup} call is received @i{Amd} checks whether the name is
580already known.  If it is not, the required volume is mounted.  A
581symbolic link pointing to the volume root is then returned.  Once the
582symbolic link is returned, the kernel will send all other requests
583direct to the mounted filesystem.
584
585If a volume is not yet mounted, @i{Amd} consults a configuration
586@dfn{mount-map} corresponding to the automount point.  @i{Amd} then
587makes a runtime decision on what and where to mount a filesystem based
588on the information obtained from the map.
589
590@i{Amd} does not implement all the NFS requests; only those relevant
591to name binding such as @dfn{lookup}, @dfn{readlink} and @dfn{readdir}.
592Some other calls are also implemented but most simply return an error
593code; for example @dfn{mkdir} always returns ``read-only filesystem''.
594
595@node Mounting a Volume, Automatic Unmounting, Operational Principles, Overview
596@comment  node-name,  next,  previous,  up
597@section Mounting a Volume
598@cindex Mounting a volume
599@cindex Location lists
600@cindex Alternate locations
601@cindex Mount retries
602@cindex Background mounts
603
604Each automount point has a corresponding mount map.  The mount map
605contains a list of key--value pairs.  The key is the name of the volume
606to be mounted.  The value is a list of locations describing where the
607filesystem is stored in the network.  In the source for the map the
608value would look like
609
610@display
611location1  location2  @dots{}  locationN
612@end display
613
614@i{Amd} examines each location in turn.  Each location may contain
615@dfn{selectors} which control whether @i{Amd} can use that location.
616For example, the location may be restricted to use by certain hosts.
617Those locations which cannot be used are ignored.
618
619@i{Amd} attempts to mount the filesystem described by each remaining
620location until a mount succeeds or @i{Amd} can no longer proceed.  The
621latter can occur in three ways:
622
623@itemize @bullet
624@item
625If none of the locations could be used, or if all of the locations
626caused an error, then the last error is returned.
627
628@item
629If a location could be used but was being mounted in the background then
630@i{Amd} marks that mount as being ``in progress'' and continues with
631the next request; no reply is sent to the kernel.
632
633@item
634Lastly, one or more of the mounts may have been @dfn{deferred}.  A mount
635is deferred if extra information is required before the mount can
636proceed.  When the information becomes available the mount will take
637place, but in the mean time no reply is sent to the kernel.  If the
638mount is deferred, @i{Amd} continues to try any remaining locations.
639@end itemize
640
641Once a volume has been mounted, @i{Amd} establishes a @dfn{volume
642mapping} which is used to satisfy subsequent requests.@refill
643
644@node Automatic Unmounting, Keep-alives, Mounting a Volume, Overview
645@comment  node-name,  next,  previous,  up
646@section Automatic Unmounting
647
648To avoid an ever increasing number of filesystem mounts, @i{Amd} removes
649volume mappings which have not been used recently.  A time-to-live
650interval is associated with each mapping and when that expires the
651mapping is removed.  When the last reference to a filesystem is removed,
652that filesystem is unmounted.  If the unmount fails, for example the
653filesystem is still busy, the mapping is re-instated and its
654time-to-live interval is extended.  The global default for this grace
655period is controlled by the @code{-w} command-line option (@pxref{-w
656Option, -w}) or the @i{amd.conf} parameter @samp{dismount_interval}
657(@pxref{dismount_interval Parameter}).  It is also possible to set this
658value on a per-mount basis (@pxref{opts Option, opts, opts}).
659
660Filesystems can be forcefully timed out using the @i{Amq} command.
661@xref{Run-time Administration}.  Note that on new enough systems that
662support forced unmounts, such as Linux, @i{Amd} can try to use the
663@b{umount2}(2) system call to force the unmount, if the regular
664@b{umount}(2) system call failed in a way that indicates that the
665mount point is hung or stale.  @xref{forced_unmounts Parameter}.
666
667@node Keep-alives, Non-blocking Operation, Automatic Unmounting, Overview
668@comment  node-name,  next,  previous,  up
669@section Keep-alives
670@cindex Keep-alives
671@cindex Server crashes
672@cindex NFS ping
673
674Use of some filesystem types requires the presence of a server on
675another machine.  If a machine crashes then it is of no concern to
676processes on that machine that the filesystem is unavailable.  However,
677to processes on a remote host using that machine as a fileserver this
678event is important.  This situation is most widely recognized when an
679NFS server crashes and the behavior observed on client machines is that
680more and more processes hang.  In order to provide the possibility of
681recovery, @i{Amd} implements a @dfn{keep-alive} interval timer for some
682filesystem types.  Currently only NFS makes use of this service.
683
684The basis of the NFS keep-alive implementation is the observation that
685most sites maintain replicated copies of common system data such as
686manual pages, most or all programs, system source code and so on.  If
687one of those servers goes down it would be reasonable to mount one of
688the others as a replacement.
689
690The first part of the process is to keep track of which fileservers are
691up and which are down.  @i{Amd} does this by sending RPC requests to the
692servers' NFS @code{NullProc} and checking whether a reply is returned.
693While the server state is uncertain the requests are re-transmitted at
694three second intervals and if no reply is received after four attempts
695the server is marked down.  If a reply is received the fileserver is
696marked up and stays in that state for 30 seconds at which time another
697NFS ping is sent.  This interval is configurable and can even be
698turned off using the @i{ping} option.  @xref{opts Option}.
699
700Once a fileserver is marked down, requests continue to be sent every 30
701seconds in order to determine when the fileserver comes back up.  During
702this time any reference through @i{Amd} to the filesystems on that
703server fail with the error ``Operation would block''.  If a replacement
704volume is available then it will be mounted, otherwise the error is
705returned to the user.
706
707@c @i{Amd} keeps track of which servers are up and which are down.
708@c It does this by sending RPC requests to the servers' NFS {\sc NullProc} and
709@c checking whether a reply is returned.  If no replies are received after a
710@c short period, @i{Amd} marks the fileserver @dfn{down}.
711@c RPC requests continue to be sent so that it will notice when a fileserver
712@c comes back up.
713@c ICMP echo packets \cite{rfc:icmp} are not used because it is the availability
714@c of the NFS service that is important, not the existence of a base kernel.
715@c Whenever a reference to a fileserver which is down is made via @i{Amd}, an alternate
716@c filesystem is mounted if one is available.
717@c
718Although this action does not protect user files, which are unique on
719the network, or processes which do not access files via @i{Amd} or
720already have open files on the hung filesystem, it can prevent most new
721processes from hanging.
722@c
723@c With a suitable combination of filesystem management and mount-maps,
724@c machines can be protected against most server downtime.  This can be
725@c enhanced by allocating boot-servers dynamically which allows a diskless
726@c workstation to be quickly restarted if necessary.  Once the root filesystem
727@c is mounted, @i{Amd} can be started and allowed to mount the remainder of
728@c the filesystem from whichever fileservers are available.
729
730@node Non-blocking Operation, , Keep-alives, Overview
731@comment  node-name,  next,  previous,  up
732@section Non-blocking Operation
733@cindex Non-blocking operation
734@cindex Multiple-threaded server
735@cindex RPC retries
736
737Since there is only one instance of @i{Amd} for each automount point,
738and usually only one instance on each machine, it is important that it
739is always available to service kernel calls.  @i{Amd} goes to great
740lengths to ensure that it does not block in a system call.  As a last
741resort @i{Amd} will fork before it attempts a system call that may block
742indefinitely, such as mounting an NFS filesystem.  Other tasks such as
743obtaining filehandle information for an NFS filesystem, are done using a
744purpose built non-blocking RPC library which is integrated with
745@i{Amd}'s task scheduler.  This library is also used to implement NFS
746keep-alives (@pxref{Keep-alives}).
747
748Whenever a mount is deferred or backgrounded, @i{Amd} must wait for it
749to complete before replying to the kernel.  However, this would cause
750@i{Amd} to block waiting for a reply to be constructed.  Rather than do
751this, @i{Amd} simply @dfn{drops} the call under the assumption that the
752kernel RPC mechanism will automatically retry the request.
753
754@c ################################################################
755@node Supported Platforms, Mount Maps, Overview, Top
756@comment  node-name,  next,  previous,  up
757@chapter Supported Platforms
758@cindex Supported Platforms
759@cindex shared libraries
760@cindex NFS V.3 support
761
762@i{Am-utils} has been ported to a wide variety of machines and operating
763systems.  @i{Am-utils}'s code works for little-endian and big-endian
764machines, as well as 32 bit and 64 bit architectures.  Furthermore, when
765@i{Am-utils} ports to an Operating System on one architecture, it is generally
766readily portable to the same Operating System on all platforms on which
767it is available.
768
769See the @file{INSTALL} in the distribution for more specific details on
770building and/or configuring for some systems.
771
772@c ################################################################
773@node Mount Maps, Amd Command Line Options, Supported Platforms, Top
774@comment  node-name,  next,  previous,  up
775@chapter Mount Maps
776@cindex Mount maps
777@cindex Automounter configuration maps
778@cindex Mount information
779
780@i{Amd} has no built-in knowledge of machines or filesystems.
781External @dfn{mount-maps} are used to provide the required information.
782Specifically, @i{Amd} needs to know when and under what conditions it
783should mount filesystems.
784
785The map entry corresponding to the requested name contains a list of
786possible locations from which to resolve the request.  Each location
787specifies filesystem type, information required by that filesystem (for
788example the block special device in the case of UFS), and some
789information describing where to mount the filesystem (@pxref{fs Option}).  A
790location may also contain @dfn{selectors} (@pxref{Selectors}).@refill
791
792@menu
793* Map Types::
794* Key Lookup::
795* Location Format::
796@end menu
797
798@node Map Types, Key Lookup, Mount Maps, Mount Maps
799@comment  node-name,  next,  previous,  up
800@section Map Types
801@cindex Mount map types
802@cindex Map types
803@cindex Configuration map types
804@cindex Types of mount map
805@cindex Types of configuration map
806@cindex Determining the map type
807
808A mount-map provides the run-time configuration information to @i{Amd}.
809Maps can be implemented in many ways.  Some of the forms supported by
810@i{Amd} are regular files, ndbm databases, NIS maps, the @dfn{Hesiod}
811name server, and even the password file.
812
813A mount-map @dfn{name} is a sequence of characters.  When an automount
814point is created a handle on the mount-map is obtained.  For each map
815type configured, @i{Amd} attempts to reference the map of the
816appropriate type.  If a map is found, @i{Amd} notes the type for future
817use and deletes the reference, for example closing any open file
818descriptors.  The available maps are configured when @i{Amd} is built
819and can be displayed by running the command @samp{amd -v}.
820
821When using an @i{Amd} configuration file (@pxref{Amd Configuration File})
822and the keyword @samp{map_type} (@pxref{map_type Parameter}), you may
823force the map used to any type.
824
825By default, @i{Amd} caches data in a mode dependent on the type of map.
826This is the same as specifying @samp{cache:=mapdefault} and selects a
827suitable default cache mode depending on the map type.  The individual
828defaults are described below.  The @var{cache} option can be specified
829on automount points to alter the caching behavior (@pxref{Automount
830Filesystem}).@refill
831
832The following map types have been implemented, though some are not
833available on all machines.  Run the command @samp{amd -v} to obtain a
834list of map types configured on your machine.
835
836@menu
837* File maps::
838* ndbm maps::
839* NIS maps::
840* NIS+ maps::
841* Hesiod maps::
842* Password maps::
843* Union maps::
844* LDAP maps::
845* Executable maps::
846@end menu
847
848@c ----------------------------------------------------------------
849@node File maps, ndbm maps, Map Types, Map Types
850@comment  node-name,  next,  previous,  up
851@subsection File maps
852@cindex File maps
853@cindex Flat file maps
854@cindex File map syntactic conventions
855
856When @i{Amd} searches a file for a map entry it does a simple scan of
857the file and supports both comments and continuation lines.
858
859Continuation lines are indicated by a backslash character (@samp{\}) as
860the last character of a line in the file.  The backslash, newline character
861@emph{and any leading white space on the following line} are discarded.  A maximum
862line length of 2047 characters is enforced after continuation lines are read
863but before comments are stripped.  Each line must end with
864a newline character; that is newlines are terminators, not separators.
865The following examples illustrate this:
866
867@example
868key     valA   valB;   \
869          valC
870@end example
871
872specifies @emph{three} locations, and is identical to
873
874@example
875key     valA   valB;   valC
876@end example
877
878However,
879
880@example
881key     valA   valB;\
882          valC
883@end example
884
885specifies only @emph{two} locations, and is identical to
886
887@example
888key     valA   valB;valC
889@end example
890
891After a complete line has been read from the file, including
892continuations, @i{Amd} determines whether there is a comment on the
893line.  A comment begins with a hash (``@samp{#}'') character and
894continues to the end of the line.  There is no way to escape or change
895the comment lead-in character.
896
897Note that continuation lines and comment support @dfn{only} apply to
898file maps, or ndbm maps built with the @code{mk-amd-map} program.
899
900When caching is enabled, file maps have a default cache mode of
901@code{all} (@pxref{Automount Filesystem}).
902
903@c ----------------------------------------------------------------
904@node ndbm maps, NIS maps, File maps, Map Types
905@comment  node-name,  next,  previous,  up
906@subsection ndbm maps
907@cindex ndbm maps
908
909An ndbm map may be used as a fast access form of a file map.  The program,
910@code{mk-amd-map}, converts a normal map file into an ndbm database.
911This program supports the same continuation and comment conventions that
912are provided for file maps.  Note that ndbm format files may @emph{not}
913be sharable across machine architectures.  The notion of speed generally
914only applies to large maps; a small map, less than a single disk block,
915is almost certainly better implemented as a file map.
916
917ndbm maps have a default cache mode of @samp{all}
918(@pxref{Automount Filesystem}).
919
920@c ----------------------------------------------------------------
921@node NIS maps, NIS+ maps, ndbm maps, Map Types
922@comment  node-name,  next,  previous,  up
923@subsection NIS maps
924@cindex NIS (YP) maps
925
926When using NIS (formerly YP), an @i{Amd} map is implemented directly
927by the underlying NIS map.  Comments and continuation lines are
928@emph{not} supported in the automounter and must be stripped when
929constructing the NIS server's database.
930
931NIS maps have a default cache mode of @code{all} (@pxref{Automount
932Filesystem}).
933
934The following rule illustrates what could be added to your NIS @file{Makefile},
935in this case causing the @file{amd.home} map to be rebuilt:
936@example
937$(YPTSDIR)/amd.home.time: $(ETCDIR)/amd.home
938    -@@sed -e "s/#.*$$//" -e "/^$$/d" $(ETCDIR)/amd.home | \
939      awk '@{  \
940         for (i = 1; i <= NF; i++) \
941             if (i == NF) @{ \
942             if (substr($$i, length($$i), 1) == "\\") \
943                 printf("%s", substr($$i, 1, length($$i) - 1)); \
944             else \
945                 printf("%s\n", $$i); \
946             @} \
947             else \
948             printf("%s ", $$i); \
949         @}' | \
950    $(MAKEDBM) - $(YPDBDIR)/amd.home; \
951    touch $(YPTSDIR)/amd.home.time; \
952    echo "updated amd.home"; \
953    if [ ! $(NOPUSH) ]; then \
954        $(YPPUSH) amd.home; \
955        echo "pushed amd.home"; \
956    else \
957        : ; \
958    fi
959@end example
960
961Here @code{$(YPTSDIR)} contains the time stamp files, and
962@code{$(YPDBDIR)} contains the dbm format NIS files.
963
964@c ----------------------------------------------------------------
965@node NIS+ maps, Hesiod maps, NIS maps, Map Types
966@comment  node-name,  next,  previous,  up
967@subsection NIS+ maps
968@cindex NIS+ maps
969
970NIS+ maps do not support cache mode @samp{all} and, when caching is
971enabled, have a default cache mode of @samp{inc}.
972
973XXX: FILL IN WITH AN EXAMPLE.
974
975@c ----------------------------------------------------------------
976@node Hesiod maps, Password maps, NIS+ maps, Map Types
977@comment  node-name,  next,  previous,  up
978@subsection Hesiod maps
979@cindex Hesiod maps
980
981When the map name begins with the string @samp{hesiod.} lookups are made
982using the @dfn{Hesiod} name server.  The string following the dot is
983used as a name qualifier and is prepended with the key being located.
984The entire string is then resolved in the @code{automount} context, or
985the @i{amd.conf} parameter @samp{hesiod_base} (@pxref{hesiod_base
986Parameter}).  For example, if the key is @samp{jsp} and map name is
987@samp{hesiod.homes} then @dfn{Hesiod} is asked to resolve
988@samp{jsp.homes.automount}.
989
990Hesiod maps do not support cache mode @samp{all} and, when caching is
991enabled, have a default cache mode of @samp{inc} (@pxref{Automount
992Filesystem}).
993
994The following is an example of a @dfn{Hesiod} map entry:
995
996@example
997jsp.homes.automount HS TXT "rfs:=/home/charm;rhost:=charm;sublink:=jsp"
998njw.homes.automount HS TXT "rfs:=/home/dylan/dk2;rhost:=dylan;sublink:=njw"
999@end example
1000
1001@c ----------------------------------------------------------------
1002@node Password maps, Union maps, Hesiod maps, Map Types
1003@comment  node-name,  next,  previous,  up
1004@subsection Password maps
1005@cindex Password file maps
1006@cindex /etc/passwd maps
1007@cindex User maps, automatic generation
1008@cindex Automatic generation of user maps
1009@cindex Using the password file as a map
1010
1011The password map support is unlike the four previous map types.  When
1012the map name is the string @file{/etc/passwd} @i{Amd} can lookup a user
1013name in the password file and re-arrange the home directory field to
1014produce a usable map entry.
1015
1016@i{Amd} assumes the home directory has the format
1017`@t{/}@i{anydir}@t{/}@i{dom1}@t{/../}@i{domN}@t{/}@i{login}'.
1018@c @footnote{This interpretation is not necessarily exactly what you want.}
1019It breaks this string into a map entry where @code{$@{rfs@}} has the
1020value `@t{/}@i{anydir}@t{/}@i{domN}', @code{$@{rhost@}} has the value
1021`@i{domN}@t{.}@i{...}@t{.}@i{dom1}', and @code{$@{sublink@}} has the
1022value @i{login}.@refill
1023
1024Thus if the password file entry was
1025
1026@example
1027/home/achilles/jsp
1028@end example
1029
1030the map entry used by @i{Amd} would be
1031
1032@example
1033rfs:=/home/achilles;rhost:=achilles;sublink:=jsp
1034@end example
1035
1036Similarly, if the password file entry was
1037
1038@example
1039/home/cc/sugar/mjh
1040@end example
1041
1042the map entry used by @i{Amd} would be
1043
1044@example
1045rfs:=/home/sugar;rhost:=sugar.cc;sublink:=mhj
1046@end example
1047
1048@c ----------------------------------------------------------------
1049@node Union maps, LDAP maps, Password maps, Map Types
1050@comment  node-name,  next,  previous,  up
1051@subsection Union maps
1052@cindex Union file maps
1053
1054The union map support is provided specifically for use with the union
1055filesystem, @pxref{Union Filesystem}.
1056
1057It is identified by the string @samp{union:} which is followed by a
1058colon separated list of directories.  The directories are read in order,
1059and the names of all entries are recorded in the map cache.  Later
1060directories take precedence over earlier ones.  The union filesystem
1061type then uses the map cache to determine the union of the names in all
1062the directories.
1063
1064@c ----------------------------------------------------------------
1065@node LDAP maps, Executable maps, Union maps, Map Types
1066@comment  node-name,  next,  previous,  up
1067@subsection LDAP maps
1068@cindex LDAP maps
1069@cindex Lightweight Directory Access Protocol
1070
1071LDAP (Lightweight Directory Access Protocol) maps do not support cache
1072mode @samp{all} and, when caching is enabled, have a default cache mode
1073of @samp{inc}.
1074
1075For example, an @i{Amd} map @samp{amd.home} that looks as follows:
1076
1077@example
1078/defaults    opts:=rw,intr;type:=link
1079
1080zing         -rhost:=shekel \
1081             host==shekel \
1082             host!=shekel;type:=nfs
1083@end example
1084@noindent
1085when converted to LDAP (@pxref{amd2ldif}), will result in the following
1086LDAP database:
1087@example
1088$ amd2ldif amd.home CUCS < amd.home
1089dn: cn=amdmap timestamp, CUCS
1090cn             : amdmap timestamp
1091objectClass    : amdmapTimestamp
1092amdmapTimestamp: 873071363
1093
1094dn: cn=amdmap amd.home[/defaults], CUCS
1095cn          : amdmap amd.home[/defaults]
1096objectClass : amdmap
1097amdmapName  : amd.home
1098amdmapKey   : /defaults
1099amdmapValue : opts:=rw,intr;type:=link
1100
1101dn: cn=amdmap amd.home[], CUCS
1102cn          : amdmap amd.home[]
1103objectClass : amdmap
1104amdmapName  : amd.home
1105amdmapKey   :
1106amdmapValue :
1107
1108dn: cn=amdmap amd.home[zing], CUCS
1109cn          : amdmap amd.home[zing]
1110objectClass : amdmap
1111amdmapName  : amd.home
1112amdmapKey   : zing
1113amdmapValue : -rhost:=shekel host==shekel host!=shekel;type:=nfs
1114@end example
1115
1116@c ----------------------------------------------------------------
1117@node Executable maps, , LDAP maps, Map Types
1118@comment  node-name,  next,  previous,  up
1119@subsection Executable maps
1120@cindex Executable maps
1121
1122An executable map is a dynamic map in which the keys and values for
1123the maps are generated on the fly by a program or script.  The program
1124is expected to take a single parameter argument which is the key to
1125lookup.  If the key is found, the program should print on stdout the
1126key-value pair that were found; if the key was not found, nothing
1127should be printed out.  Below is an sample of such a map script:
1128
1129@example
1130#!/bin/sh
1131# executable map example
1132case "$1" in
1133    "/defaults" )
1134	echo "/defaults   type:=nfs;rfs:=filer"
1135	;;
1136    "a" )
1137	echo "a   type:=nfs;fs:=/tmp"
1138	;;
1139    "b" )
1140	echo "b   type:=link;fs:=/usr/local"
1141	;;
1142    * )  # no match, echo nothing
1143	;;
1144esac
1145@end example
1146
1147@xref{exec_map_timeout Parameter}.
1148
1149@c ----------------------------------------------------------------
1150@c subsection Gdbm
1151@c ----------------------------------------------------------------
1152@node Key Lookup, Location Format, Map Types, Mount Maps
1153@comment  node-name,  next,  previous,  up
1154@section How keys are looked up
1155@cindex Key lookup
1156@cindex Map lookup
1157@cindex Looking up keys
1158@cindex How keys are looked up
1159@cindex Wildcards in maps
1160
1161The key is located in the map whose type was determined when the
1162automount point was first created.  In general the key is a pathname
1163component.  In some circumstances this may be modified by variable
1164expansion (@pxref{Variable Expansion}) and prefixing.  If the automount
1165point has a prefix, specified by the @var{pref} option, then that is
1166prepended to the search key before the map is searched.
1167
1168If the map cache is a @samp{regexp} cache then the key is treated as an
1169egrep-style regular expression, otherwise a normal string comparison is
1170made.
1171
1172If the key cannot be found then a @dfn{wildcard} match is attempted.
1173@i{Amd} repeatedly strips the basename from the key, appends @samp{/*} and
1174attempts a lookup.  Finally, @i{Amd} attempts to locate the special key @samp{*}.
1175
1176For example, the following sequence would be checked if @file{home/dylan/dk2} was
1177being located:
1178
1179@example
1180   home/dylan/dk2
1181   home/dylan/*
1182   home/*
1183   *
1184@end example
1185
1186At any point when a wildcard is found, @i{Amd} proceeds as if an exact
1187match had been found and the value field is then used to resolve the
1188mount request, otherwise an error code is propagated back to the kernel.
1189(@pxref{Filesystem Types}).@refill
1190
1191@node Location Format, , Key Lookup, Mount Maps
1192@comment  node-name,  next,  previous,  up
1193@section Location Format
1194@cindex Location format
1195@cindex Map entry format
1196@cindex How locations are parsed
1197
1198The value field from the lookup provides the information required to
1199mount a filesystem.  The information is parsed according to the syntax
1200shown below.
1201
1202@display
1203@i{location-list}:
1204                  @i{location-selection}
1205                  @i{location-list} @i{white-space} @t{||} @i{white-space} @i{location-selection}
1206@i{location-selection}:
1207                  @i{location}
1208                  @i{location-selection} @i{white-space} @i{location}
1209@i{location}:
1210                  @i{location-info}
1211                  @t{-}@i{location-info}
1212                  @t{-}
1213@i{location-info}:
1214                  @i{sel-or-opt}
1215                  @i{location-info}@t{;}@i{sel-or-opt}
1216                  @t{;}
1217@i{sel-or-opt}:
1218                  @i{selection}
1219                  @i{opt-ass}
1220@i{selection}:
1221                  selector@t{==}@i{value}
1222                  selector@t{!=}@i{value}
1223@i{opt-ass}:
1224                  option@t{:=}@i{value}
1225@i{white-space}:
1226                  space
1227                  tab
1228@end display
1229
1230Note that unquoted whitespace is not allowed in a location description.
1231White space is only allowed, and is mandatory, where shown with non-terminal
1232@i{white-space}.
1233
1234A @dfn{location-selection} is a list of possible volumes with which to
1235satisfy the request.  Each @dfn{location-selection} is tried
1236sequentially, until either one succeeds or all fail.  This, by the
1237way, is different from the historically documented behavior, which
1238claimed (falsely, at least for last 3 years) that @i{Amd} would
1239attempt to mount all @dfn{location-selection}s in parallel and the
1240first one to succeed would be used.
1241
1242@dfn{location-selection}s are optionally separated by the @samp{||}
1243operator.  The effect of this operator is to prevent use of
1244location-selections to its right if any of the location-selections on
1245its left were selected, whether or not any of them were successfully
1246mounted (@pxref{Selectors}).@refill
1247
1248The location-selection, and singleton @dfn{location-list},
1249@samp{type:=ufs;dev:=/dev/xd1g} would inform @i{Amd} to mount a UFS
1250filesystem from the block special device @file{/dev/xd1g}.
1251
1252The @dfn{sel-or-opt} component is either the name of an option required
1253by a specific filesystem, or it is the name of a built-in, predefined
1254selector such as the architecture type.  The value may be quoted with
1255double quotes @samp{"}, for example
1256@samp{type:="ufs";dev:="/dev/xd1g"}.  These quotes are stripped when the
1257value is parsed and there is no way to get a double quote into a value
1258field.  Double quotes are used to get white space into a value field,
1259which is needed for the program filesystem (@pxref{Program Filesystem}).@refill
1260
1261@menu
1262* Map Defaults::
1263* Variable Expansion::
1264* Selectors::
1265* Map Options::
1266@end menu
1267
1268@node Map Defaults, Variable Expansion, Location Format, Location Format
1269@comment  node-name,  next,  previous,  up
1270@subsection Map Defaults
1271@cindex Map defaults
1272@cindex How to set default map parameters
1273@cindex Setting default map parameters
1274
1275A location beginning with a dash @samp{-} is used to specify default
1276values for subsequent locations.  Any previously specified defaults in
1277the location-list are discarded.  The default string can be empty in
1278which case no defaults apply.
1279
1280The location @samp{-fs:=/mnt;opts:=ro} would set the local mount point
1281to @file{/mnt} and cause mounts to be read-only by default.  Defaults
1282specified this way are appended to, and so override, any global map
1283defaults given with @samp{/defaults}).
1284
1285@c
1286@c A @samp{/defaults} value @dfn{gdef} and a location list
1287@c \begin{quote}
1288@c $@samp{-}@dfn{def}_a $\verb*+ +$ @dfn{loc}_{a_1} $\verb*+ +$ @dfn{loc}_{a_2} $\verb*+ +$ @samp{-}@dfn{def}_b $\verb*+ +$ @dfn{loc}_{b_1} \ldots$
1289@c \end{quote}
1290@c is equivalent to
1291@c \begin{quote}
1292@c $@samp{-}@dfn{gdef}@samp{;}@dfn{def}_a $\verb*+ +$ @dfn{loc}_{a_1} $\verb*+ +$ @dfn{loc}_{a_2} $\verb*+ +$ @samp{-}@dfn{gdef}@samp{;}@dfn{def}_b $\verb*+ +$ @dfn{loc}_{b_1} \ldots$
1293@c \end{quote}
1294@c which is equivalent to
1295@c \begin{quote}
1296@c $@dfn{gdef}@samp{;}@dfn{def}_a@samp{;}@dfn{loc}_{a_1} $\verb*+ +$@dfn{gdef}@samp{;}@dfn{def}_a@samp{;}@dfn{loc}_{a_2} $\verb*+ +$@dfn{gdef}@samp{;}@dfn{def}_b@samp{;}@dfn{loc}_{b_1} \ldots$
1297@c \end{quote}
1298
1299@node Variable Expansion, Selectors, Map Defaults, Location Format
1300@comment  node-name,  next,  previous,  up
1301@subsection Variable Expansion
1302@cindex Variable expansion
1303@cindex How variables are expanded
1304@cindex Pathname operators
1305@cindex Domain stripping
1306@cindex Domainname operators
1307@cindex Stripping the local domain name
1308@cindex Environment variables
1309@cindex How to access environment variables in maps
1310
1311To allow generic location specifications @i{Amd} does variable expansion
1312on each location and also on some of the option strings.  Any option or
1313selector appearing in the form @code{$@dfn{var}} is replaced by the
1314current value of that option or selector.  For example, if the value of
1315@code{$@{key@}} was @samp{bin}, @code{$@{autodir@}} was @samp{/a} and
1316@code{$@{fs@}} was `@t{$@{autodir@}}@t{/local/}@t{$@{key@}}' then
1317after expansion @code{$@{fs@}} would have the value @samp{/a/local/bin}.
1318Any environment variable can be accessed in a similar way.@refill
1319
1320Two pathname operators are available when expanding a variable.  If the
1321variable name begins with @samp{/} then only the last component of the
1322pathname is substituted.  For example, if @code{$@{path@}} was
1323@samp{/foo/bar} then @code{$@{/path@}} would be expanded to @samp{bar}.
1324Similarly, if the variable name ends with @samp{/} then all but the last
1325component of the pathname is substituted.  In the previous example,
1326@code{$@{path/@}} would be expanded to @samp{/foo}.@refill
1327
1328Two domain name operators are also provided.  If the variable name
1329begins with @samp{.} then only the domain part of the name is
1330substituted.  For example, if @code{$@{rhost@}} was
1331@samp{swan.doc.ic.ac.uk} then @code{$@{.rhost@}} would be expanded to
1332@samp{doc.ic.ac.uk}.  Similarly, if the variable name ends with @samp{.}
1333then only the host component is substituted.  In the previous example,
1334@code{$@{rhost.@}} would be expanded to @samp{swan}.@refill
1335
1336Variable expansion is a two phase process.  Before a location is parsed,
1337all references to selectors, @i{eg} @code{$@{path@}}, are expanded.  The
1338location is then parsed, selections are evaluated and option assignments
1339recorded.  If there were no selections or they all succeeded the
1340location is used and the values of the following options are expanded in
1341the order given: @var{sublink}, @var{rfs}, @var{fs}, @var{opts},
1342@var{remopts}, @var{mount} and @var{unmount}.
1343
1344Note that expansion of option values is done after @dfn{all} assignments
1345have been completed and not in a purely left to right order as is done
1346by the shell.  This generally has the desired effect but care must be
1347taken if one of the options references another, in which case the
1348ordering can become significant.
1349
1350There are two special cases concerning variable expansion:
1351
1352@enumerate
1353@item
1354before a map is consulted, any selectors in the name received
1355from the kernel are expanded.  For example, if the request from the
1356kernel was for `@t{$@{arch@}}@t{.bin}' and the machine architecture
1357was @samp{vax}, the value given to @code{$@{key@}} would be
1358@samp{vax.bin}.@refill
1359
1360@item
1361the value of @code{$@{rhost@}} is expanded and normalized before the
1362other options are expanded.  The normalization process strips any local
1363sub-domain components.  For example, if @code{$@{domain@}} was
1364@samp{Berkeley.EDU} and @code{$@{rhost@}} was initially
1365@samp{snow.Berkeley.EDU}, after the normalization it would simply be
1366@samp{snow}.  Hostname normalization is currently done in a
1367@emph{case-dependent} manner.@refill
1368@end enumerate
1369
1370@c======================================================================
1371@node Selectors, Map Options, Variable Expansion, Location Format
1372@comment  node-name,  next,  previous,  up
1373@subsection Selectors
1374@cindex Selectors
1375
1376Selectors are used to control the use of a location.  It is possible to
1377share a mount map between many machines in such a way that filesystem
1378location, architecture and operating system differences are hidden from
1379the users.  A selector of the form @samp{arch==sun3;os==sunos4} would only
1380apply on Sun-3s running SunOS 4.x.
1381
1382Selectors can be negated by using @samp{!=} instead of @samp{==}.  For
1383example to select a location on all non-Vax machines the selector
1384@samp{arch!=vax} would be used.
1385
1386Selectors are evaluated left to right.  If a selector fails then that
1387location is ignored.  Thus the selectors form a conjunction and the
1388locations form a disjunction.  If all the locations are ignored or
1389otherwise fail then @i{Amd} uses the @dfn{error} filesystem
1390(@pxref{Error Filesystem}).  This is equivalent to having a location
1391@samp{type:=error} at the end of each mount-map entry.@refill
1392
1393The default value of many of the selectors listed here can be overridden
1394by an @i{Amd} command line switch or in an @i{Amd} configuration file.
1395@xref{Amd Configuration File}.
1396
1397The following selectors are currently implemented.
1398
1399@menu
1400* arch Selector Variable::
1401* autodir Selector Variable::
1402* byte Selector Variable::
1403* cluster Selector Variable::
1404* domain Selector Variable::
1405* dollar Selector Variable::
1406* host Selector Variable::
1407* hostd Selector Variable::
1408* karch Selector Variable::
1409* os Selector Variable::
1410* osver Selector Variable::
1411* full_os Selector Variable::
1412* vendor Selector Variable::
1413
1414* key Selector Variable::
1415* map Selector Variable::
1416* netnumber Selector Variable::
1417* network Selector Variable::
1418* path Selector Variable::
1419* wire Selector Variable::
1420* uid Selector Variable::
1421* gid Selector Variable::
1422
1423* exists Selector Function::
1424* false Selector Function::
1425* netgrp Selector Function::
1426* netgrpd Selector Function::
1427* in_network Selector Function::
1428* true Selector Function::
1429* xhost Selector Function::
1430@end menu
1431
1432@c ----------------------------------------------------------------
1433@node arch Selector Variable, autodir Selector Variable, Selectors, Selectors
1434@comment  node-name,  next,  previous,  up
1435@subsubsection arch Selector Variable
1436@cindex arch Selector Variable
1437@cindex arch, mount selector
1438@cindex Mount selector; arch
1439@cindex Selector; arch
1440
1441The machine architecture which was automatically determined at compile
1442time.  The architecture type can be displayed by running the command
1443@samp{amd -v}.  You can override this value also using the @code{-A}
1444command line option.  @xref{Supported Platforms}.@refill
1445
1446@c ----------------------------------------------------------------
1447@node autodir Selector Variable, byte Selector Variable, arch Selector Variable, Selectors
1448@comment  node-name,  next,  previous,  up
1449@subsubsection autodir Selector Variable
1450@cindex autodir Selector Variable
1451@cindex autodir, mount selector
1452@cindex Mount selector; autodir
1453@cindex Selector; autodir
1454
1455The default directory under which to mount filesystems.  This may be
1456changed by the @code{-a} command line option.  @xref{fs Option}.
1457
1458@c ----------------------------------------------------------------
1459@node byte Selector Variable, cluster Selector Variable, autodir Selector Variable, Selectors
1460@comment  node-name,  next,  previous,  up
1461@subsubsection byte Selector Variable
1462@cindex byte Selector Variable
1463@cindex byte, mount selector
1464@cindex Mount selector; byte
1465@cindex Selector; byte
1466
1467The machine's byte ordering.  This is either @samp{little}, indicating
1468little-endian, or @samp{big}, indicating big-endian.  One possible use
1469is to share @samp{rwho} databases (@pxref{rwho servers}).  Another is to
1470share ndbm databases, however this use can be considered a courageous
1471juggling act.
1472
1473@c ----------------------------------------------------------------
1474@node cluster Selector Variable, domain Selector Variable, byte Selector Variable, Selectors
1475@comment  node-name,  next,  previous,  up
1476@subsubsection cluster Selector Variable
1477@cindex cluster Selector Variable
1478@cindex cluster, mount selector
1479@cindex Mount selector; cluster
1480@cindex Selector; cluster
1481
1482This is provided as a hook for the name of the local cluster.  This can
1483be used to decide which servers to use for copies of replicated
1484filesystems.  @code{$@{cluster@}} defaults to the value of
1485@code{$@{domain@}} unless a different value is set with the @code{-C}
1486command line option.
1487
1488@c ----------------------------------------------------------------
1489@node domain Selector Variable, dollar Selector Variable, cluster Selector Variable, Selectors
1490@comment  node-name,  next,  previous,  up
1491@subsubsection domain Selector Variable
1492@cindex domain Selector Variable
1493@cindex domain, mount selector
1494@cindex Mount selector; domain
1495@cindex Selector; domain
1496
1497The local domain name as specified by the @code{-d} command line option.
1498@xref{host Selector Variable}.
1499
1500@c ----------------------------------------------------------------
1501@node dollar Selector Variable, host Selector Variable, domain Selector Variable, Selectors
1502@comment  node-name,  next,  previous,  up
1503@subsubsection dollar Selector Variable
1504@cindex dollar Selector Variable
1505
1506This is a special variable, whose sole purpose is to produce a literal
1507dollar sign in the value of another variable.  For example, if you have
1508a remote file system whose name is @samp{/disk$s}, you can mount it by
1509setting the remote file system variable as follows:
1510
1511@example
1512rfs:=/disk$@{dollar@}s
1513@end example
1514
1515@c ----------------------------------------------------------------
1516@node host Selector Variable, hostd Selector Variable, dollar Selector Variable, Selectors
1517@comment  node-name,  next,  previous,  up
1518@subsubsection host Selector Variable
1519@cindex host Selector Variable
1520@cindex host, mount selector
1521@cindex Mount selector; host
1522@cindex Selector; host
1523
1524The local hostname as determined by @b{gethostname}(2).  If no domain
1525name was specified on the command line and the hostname contains a
1526period @samp{.} then the string before the period is used as the host
1527name, and the string after the period is assigned to @code{$@{domain@}}.
1528For example, if the hostname is @samp{styx.doc.ic.ac.uk} then
1529@code{host} would be @samp{styx} and @code{domain} would be
1530@samp{doc.ic.ac.uk}.  @code{hostd} would be
1531@samp{styx.doc.ic.ac.uk}.@refill
1532
1533@c ----------------------------------------------------------------
1534@node hostd Selector Variable, karch Selector Variable, host Selector Variable, Selectors
1535@comment  node-name,  next,  previous,  up
1536@subsubsection hostd Selector Variable
1537@cindex hostd Selector Variable
1538@cindex hostd, mount selector
1539@cindex Mount selector; hostd
1540@cindex Selector; hostd
1541
1542This resolves to the @code{$@{host@}} and @code{$@{domain@}}
1543concatenated with a @samp{.} inserted between them if required.  If
1544@code{$@{domain@}} is an empty string then @code{$@{host@}} and
1545@code{$@{hostd@}} will be identical.
1546
1547@c ----------------------------------------------------------------
1548@node karch Selector Variable, os Selector Variable, hostd Selector Variable, Selectors
1549@comment  node-name,  next,  previous,  up
1550@subsubsection karch Selector Variable
1551@cindex karch Selector Variable
1552@cindex karch, mount selector
1553@cindex Mount selector; karch
1554@cindex Selector; karch
1555
1556This is provided as a hook for the kernel architecture.  This is used on
1557SunOS 4 and SunOS 5, for example, to distinguish between different
1558@samp{/usr/kvm} volumes.  @code{$@{karch@}} defaults to the ``machine''
1559value gotten from @b{uname}(2).  If the @b{uname}(2) system call is not
1560available, the value of @code{$@{karch@}} defaults to that of
1561@code{$@{arch@}}.  Finally, a different value can be set with the @code{-k}
1562command line option.
1563
1564@c ----------------------------------------------------------------
1565@node os Selector Variable, osver Selector Variable, karch Selector Variable, Selectors
1566@comment  node-name,  next,  previous,  up
1567@subsubsection os Selector Variable
1568@cindex os Selector Variable
1569@cindex os, mount selector
1570@cindex Mount selector; os
1571@cindex Selector; os
1572
1573The operating system.  Like the machine architecture, this is
1574automatically determined at compile time.  The operating system name can
1575be displayed by running the command @samp{amd -v}.  @xref{Supported
1576Platforms}.@refill
1577
1578@c ----------------------------------------------------------------
1579@node osver Selector Variable, full_os Selector Variable, os Selector Variable, Selectors
1580@comment  node-name,  next,  previous,  up
1581@subsubsection osver Selector Variable
1582@cindex osver Selector Variable
1583@cindex osver, mount selector
1584@cindex Mount selector; osver
1585@cindex Selector; osver
1586
1587The operating system version.  Like the machine architecture, this is
1588automatically determined at compile time.  The operating system name can
1589be displayed by running the command @samp{amd -v}.  @xref{Supported
1590Platforms}.@refill
1591
1592@c ----------------------------------------------------------------
1593@node full_os Selector Variable, vendor Selector Variable, osver Selector Variable, Selectors
1594@comment  node-name,  next,  previous,  up
1595@subsubsection full_os Selector Variable
1596@cindex full_os Selector Variable
1597@cindex full_os, mount selector
1598@cindex Mount selector; full_os
1599@cindex Selector; full_os
1600
1601The full name of the operating system, including its version.  This
1602value is automatically determined at compile time.  The full operating
1603system name and version can be displayed by running the command
1604@samp{amd -v}.  @xref{Supported Platforms}.@refill
1605
1606@c ----------------------------------------------------------------
1607@node vendor Selector Variable, key Selector Variable, full_os Selector Variable, Selectors
1608@comment  node-name,  next,  previous,  up
1609@subsubsection vendor Selector Variable
1610@cindex vendor Selector Variable
1611@cindex vendor, mount selector
1612@cindex Mount selector; vendor
1613@cindex Selector; vendor
1614
1615The name of the vendor of the operating system.  This value is
1616automatically determined at compile time.  The name of the vendor can be
1617displayed by running the command @samp{amd -v}.  @xref{Supported
1618Platforms}.@refill
1619
1620
1621@c ----------------------------------------------------------------
1622@ifhtml
1623<HR>
1624@end ifhtml
1625@sp 3
1626The following selectors are also provided.  Unlike the other selectors,
1627they vary for each lookup.  Note that when the name from the kernel is
1628expanded prior to a map lookup, these selectors are all defined as empty
1629strings.
1630
1631@c ----------------------------------------------------------------
1632@node key Selector Variable, map Selector Variable, vendor Selector Variable, Selectors
1633@comment  node-name,  next,  previous,  up
1634@subsubsection key Selector Variable
1635@cindex key Selector Variable
1636@cindex key, mount selector
1637@cindex Mount selector; key
1638@cindex Selector; key
1639
1640The name being resolved.  For example, if @file{/home} is an automount
1641point, then accessing @file{/home/foo} would set @code{$@{key@}} to the
1642string @samp{foo}.  The key is prefixed by the @var{pref} option set in
1643the parent mount point.  The default prefix is an empty string.  If the
1644prefix was @file{blah/} then @code{$@{key@}} would be set to
1645@file{blah/foo}.@refill
1646
1647@c ----------------------------------------------------------------
1648@node map Selector Variable, netnumber Selector Variable, key Selector Variable, Selectors
1649@comment  node-name,  next,  previous,  up
1650@subsubsection map Selector Variable
1651@cindex map Selector Variable
1652@cindex map, mount selector
1653@cindex Mount selector; map
1654@cindex Selector; map
1655
1656The name of the mount map being used.
1657
1658@c ----------------------------------------------------------------
1659@node netnumber Selector Variable, network Selector Variable, map Selector Variable, Selectors
1660@comment  node-name,  next,  previous,  up
1661@subsubsection netnumber Selector Variable
1662@cindex netnumber Selector Variable
1663@cindex netnumber, mount selector
1664@cindex Mount selector; netnumber
1665@cindex Selector; netnumber
1666
1667This selector is identical to the @samp{in_network} selector function,
1668see @ref{in_network Selector Function}.  It will match either the name
1669or number of @i{any} network interface on which this host is connected
1670to.  The names and numbers of all attached interfaces are available from
1671the output of @samp{amd -v}.
1672
1673@c ----------------------------------------------------------------
1674@node network Selector Variable, path Selector Variable, netnumber Selector Variable, Selectors
1675@comment  node-name,  next,  previous,  up
1676@subsubsection network Selector Variable
1677@cindex network Selector Variable
1678@cindex network, mount selector
1679@cindex Mount selector; network
1680@cindex Selector; network
1681
1682This selector is identical to the @samp{in_network} selector function,
1683see @ref{in_network Selector Function}.  It will match either the name
1684or number of @i{any} network interface on which this host is connected
1685to.  The names and numbers of all attached interfaces are available from
1686the output of @samp{amd -v}.
1687
1688@c ----------------------------------------------------------------
1689@node path Selector Variable, wire Selector Variable, network Selector Variable, Selectors
1690@comment  node-name,  next,  previous,  up
1691@subsubsection path Selector Variable
1692@cindex path Selector Variable
1693@cindex path, mount selector
1694@cindex Mount selector; path
1695@cindex Selector; path
1696
1697The full pathname of the name being resolved.  For example
1698@file{/home/foo} in the example above.
1699
1700@c ----------------------------------------------------------------
1701@node wire Selector Variable, uid Selector Variable, path Selector Variable, Selectors
1702@comment  node-name,  next,  previous,  up
1703@subsubsection wire Selector Variable
1704@cindex wire Selector Variable
1705@cindex wire, mount selector
1706@cindex Mount selector; wire
1707@cindex Selector; wire
1708
1709This selector is identical to the @samp{in_network} selector function,
1710see @ref{in_network Selector Function}.  It will match either the name
1711or number of @i{any} network interface on which this host is connected
1712to.  The names and numbers of all attached interfaces are available from
1713the output of @samp{amd -v}.
1714
1715@c ----------------------------------------------------------------
1716@node uid Selector Variable, gid Selector Variable, wire Selector Variable, Selectors
1717@comment  node-name,  next,  previous,  up
1718@subsubsection uid Selector Variable
1719@cindex uid Selector Variable
1720@cindex uid, mount selector
1721@cindex Mount selector; uid
1722@cindex Selector; uid
1723
1724This selector provides the numeric effective user ID (UID) of the user
1725which last accessed an automounted path name.  This simple example shows
1726how floppy mounting can be assigned only to machine owners:
1727
1728@example
1729floppy  -type:=pcfs \
1730        uid==2301;host==shekel;dev:=/dev/floppy \
1731        uid==6712;host==titan;dev=/dev/fd0 \
1732        uid==0;dev:=/dev/fd0c \
1733        type:=error
1734@end example
1735
1736The example allows two machine owners to mount floppies on their
1737designated workstations, allows the root user to mount on any host, and
1738otherwise forces an error.
1739
1740@c ----------------------------------------------------------------
1741@node gid Selector Variable, exists Selector Function, uid Selector Variable, Selectors
1742@comment  node-name,  next,  previous,  up
1743@subsubsection gid Selector Variable
1744@cindex gid Selector Variable
1745@cindex gid, mount selector
1746@cindex Mount selector; gid
1747@cindex Selector; gid
1748
1749This selector provides the numeric effective group ID (GID) of the user
1750which last accessed an automounted path name.
1751
1752@c ----------------------------------------------------------------
1753@ifhtml
1754<HR>
1755@end ifhtml
1756@sp 2
1757The following boolean functions are selectors which take an argument
1758@i{ARG}.  They return a value of true or false, and thus do not need to
1759be compared with a value.  Each of these may be negated by prepending
1760@samp{!} to their name.
1761
1762@c ----------------------------------------------------------------
1763@node exists Selector Function, false Selector Function, gid Selector Variable, Selectors
1764@comment  node-name,  next,  previous,  up
1765@subsubsection exists Selector Function
1766@cindex exists Selector Function
1767@cindex exists, boolean mount selector
1768@cindex !exists, boolean mount selector
1769@cindex Mount selector; exists
1770@cindex Selector; exists
1771
1772If the file listed by @i{ARG} exists (via @b{lstat}(2)), this function
1773evaluates to true.  Otherwise it evaluates to false.
1774
1775@c ----------------------------------------------------------------
1776@node false Selector Function, netgrp Selector Function, exists Selector Function, Selectors
1777@comment  node-name,  next,  previous,  up
1778@subsubsection false Selector Function
1779@cindex false Selector Function
1780@cindex false, boolean mount selector
1781@cindex !false, boolean mount selector
1782@cindex Mount selector; false
1783@cindex Selector; false
1784
1785Always evaluates to false.  @i{ARG} is ignored.
1786
1787@c ----------------------------------------------------------------
1788@node netgrp Selector Function, netgrpd Selector Function, false Selector Function, Selectors
1789@comment  node-name,  next,  previous,  up
1790@subsubsection netgrp Selector Function
1791@cindex netgrp Selector Function
1792@cindex netgrp, boolean mount selector
1793@cindex !netgrp, boolean mount selector
1794@cindex Mount selector; netgrp
1795@cindex Selector; netgrp
1796
1797The argument @i{ARG} of this selector is a netgroup name followed
1798optionally by a comma and a host name.  If the host name is not
1799specified, it defaults to @code{$@{host@}}.  If the host name (short
1800name) is a member of the netgroup, this selector evaluates to true.
1801Otherwise it evaluates to false.
1802
1803For example, suppose you have a netgroup @samp{ppp-hosts}, and for
1804reasons of performance, these have a local @file{/home} partition,
1805while all other clients on the faster network can access a shared home
1806directory.  A common map to use for both might look like the
1807following:
1808
1809@example
1810home/*  netgrp(ppp-hosts);type:=link;fs:=/local/$@{key@} \
1811        !netgrp(ppp-hosts);type:=nfs;rhost:=serv1;rfs:=/remote/$@{key@}
1812@end example
1813
1814A more complex example that takes advantage of the two argument netgrp
1815mount selector is given in the following scenario.  Suppose one wants
1816to mount the local scratch space from a each host under
1817@file{scratch/<hostname>} and some hosts have their scratch space in a
1818different path than others.  Hosts in the netgroup @samp{apple-hosts}
1819have their scratch space in the @file{/apple} path, where hosts in the
1820netgroup @samp{cherry-hosts} have their scratch space in the
1821@file{/cherry} path.  For hosts that are neither in the
1822@samp{apple-hosts} or @samp{cherry-hosts} netgroups we want to make a
1823symlink pointing to nowhere but provide a descriptive error message in
1824the link destination:
1825
1826@example
1827scratch/*	netgrp(apple-hosts,$@{/key@});type:=nfs;rhost:=$@{/key@};\
1828		    rfs:="/apple" \
1829		netgrp(cherry-hosts,$@{/key@});type:=nfs;rhost:=$@{/key@};\
1830		    rfs:="/cherry" \
1831		type:=link;rfs:="no local partition for $@{/key@}"
1832@end example
1833
1834@c ----------------------------------------------------------------
1835@node netgrpd Selector Function, in_network Selector Function, netgrp Selector Function, Selectors
1836@comment  node-name,  next,  previous,  up
1837@subsubsection netgrpd Selector Function
1838@cindex netgrpd Selector Function
1839@cindex netgrpd, boolean mount selector
1840@cindex !netgrpd, boolean mount selector
1841@cindex Mount selector; netgrpd
1842@cindex Selector; netgrpd
1843
1844The argument @i{ARG} of this selector is a netgroup name followed
1845optionally by a comma and a host name.  If the host name is not
1846specified, it defaults to @code{$@{hostd@}}.  If the host name
1847(fully-qualified name) is a member of the netgroup, this selector
1848evaluates to true.  Otherwise it evaluates to false.
1849
1850The @samp{netgrpd} function uses fully-qualified host names to match
1851netgroup names, while the @samp{netgrp} function (@pxref{netgrp
1852Selector Function}) uses short host names.
1853
1854@c ----------------------------------------------------------------
1855@node in_network Selector Function, true Selector Function, netgrpd Selector Function, Selectors
1856@comment  node-name,  next,  previous,  up
1857@subsubsection in_network Selector Function
1858@cindex in_network Selector Function
1859@cindex in_network, boolean mount selector
1860@cindex !in_network, boolean mount selector
1861@cindex Mount selector; in_network
1862@cindex Selector; in_network
1863
1864This selector matches against any network name or number with an
1865optional netmask.  First, if the current host has any network interface that is
1866locally attached to the network specified in @i{ARG} (either via name or
1867number), this selector evaluates to true.
1868
1869Second, @samp{in_network} supports a network/netmask syntax such as
1870@samp{128.59.16.0/255.255.255.0}, @samp{128.59.16.0/24},
1871@samp{128.59.16.0/0xffffff00}, or @samp{128.59.16.0/}.  Using the last
1872form, @i{Amd} will match the specified network number against the
1873default netmasks of each of the locally attached interfaces.
1874
1875If the selector does not match, it evaluates to false.
1876
1877For example, suppose you have two servers that have an exportable
1878@file{/opt} that smaller clients can NFS mount.  The two servers are
1879say, @samp{serv1} on network @samp{foo-net.site.com} and @samp{serv2} on
1880network @samp{123.4.5.0}.  You can write a map to be used by all clients
1881that will attempt to mount the closest one as follows:
1882
1883@example
1884opt in_network(foo-net.site.com);rhost:=serv1;rfs:=/opt \
1885    in_network(123.4.5.0);rhost:=serv2;rfs:=/opt \
1886    rhost:=fallback-server
1887@end example
1888
1889@c ----------------------------------------------------------------
1890@node true Selector Function, xhost Selector Function, in_network Selector Function, Selectors
1891@comment  node-name,  next,  previous,  up
1892@subsubsection true Selector Function
1893@cindex true Selector Function
1894@cindex true, boolean mount selector
1895@cindex !true, boolean mount selector
1896@cindex Mount selector; true
1897@cindex Selector; true
1898
1899Always evaluates to true.  @i{ARG} is ignored.
1900
1901@c ----------------------------------------------------------------
1902@node xhost Selector Function, , true Selector Function, Selectors
1903@comment  node-name,  next,  previous,  up
1904@subsubsection xhost Selector Function
1905@cindex xhost Selector Function
1906@cindex xhost, boolean mount selector
1907@cindex !xhost, boolean mount selector
1908@cindex Mount selector; xhost
1909@cindex Selector; xhost
1910@cindex CNAMEs
1911
1912This function compares @i{ARG} against the current hostname, similarly
1913to the @ref{host Selector Variable}.  However, this function will
1914also match if @i{ARG} is a CNAME (DNS Canonical Name, or alias) for
1915the current host's name.
1916
1917@c ================================================================
1918@node Map Options,  , Selectors, Location Format
1919@comment  node-name,  next,  previous,  up
1920@subsection Map Options
1921@cindex Map options
1922@cindex Setting map options
1923
1924Options are parsed concurrently with selectors.  The difference is that
1925when an option is seen the string following the @samp{:=} is
1926recorded for later use.  As a minimum the @var{type} option must be
1927specified.  Each filesystem type has other options which must also be
1928specified.  @xref{Filesystem Types}, for details on the filesystem
1929specific options.@refill
1930
1931Superfluous option specifications are ignored and are not reported
1932as errors.
1933
1934The following options apply to more than one filesystem type.
1935
1936@menu
1937* addopts Option::
1938* delay Option::
1939* fs Option::
1940* opts Option::
1941* remopts Option::
1942* sublink Option::
1943* type Option::
1944@end menu
1945
1946@node addopts Option, delay Option, Map Options, Map Options
1947@comment  node-name,  next,  previous,  up
1948@subsubsection addopts Option
1949@cindex Setting additional options on a mount location
1950@cindex Overriding or adding options to a mount
1951@cindex addopts, mount option
1952@cindex Mount option; addopts
1953
1954This option adds additional options to default options normally
1955specified in the @samp{/defaults} entry or the defaults of the key entry
1956being processed (@pxref{opts Option}).  Normally when you specify
1957@samp{opts} in both the @samp{/defaults} and the map entry, the latter
1958overrides the former completely.  But with @samp{addopts} it will append
1959the options and override any conflicting ones.
1960
1961@samp{addopts} also overrides the value of the @samp{remopts} option
1962(@pxref{remopts Option}), which unless specified defaults to the value
1963of @samp{opts}.
1964
1965Options which start with @samp{no} will override those with the same
1966name that do not start with @samp{no} and vice verse.  Special handling
1967is given to inverted options such as @samp{soft} and @samp{hard},
1968@samp{bg} and @samp{fg}, @samp{ro} and @samp{rw}, etc.
1969
1970For example, if the default options specified were
1971@example
1972opts:=rw,nosuid,intr,rsize=1024,wsize=1024,quota,posix
1973@end example
1974
1975and the ones specified in a map entry were
1976
1977@example
1978addopts:=grpid,suid,ro,rsize=2048,quota,nointr
1979@end example
1980
1981then the actual options used would be
1982
1983@example
1984wsize=1024,posix,grpid,suid,ro,rsize=2048,quota,nointr
1985@end example
1986
1987@node delay Option, fs Option, addopts Option, Map Options
1988@comment  node-name,  next,  previous,  up
1989@subsubsection delay Option
1990@cindex Setting a delay on a mount location
1991@cindex Delaying mounts from specific locations
1992@cindex Primary server
1993@cindex Secondary server
1994@cindex delay, mount option
1995@cindex Mount option; delay
1996
1997The delay, in seconds, before an attempt will be made to mount from the
1998current location.  Auxiliary data, such as network address, file handles
1999and so on are computed regardless of this value.
2000
2001A delay can be used to implement the notion of primary and secondary
2002file servers.  The secondary servers would have a delay of a few
2003seconds, thus giving the primary servers a chance to respond first.
2004
2005@node fs Option, opts Option, delay Option, Map Options
2006@comment  node-name,  next,  previous,  up
2007@subsubsection fs Option
2008@cindex Setting the local mount point
2009@cindex Overriding the default mount point
2010@cindex fs, mount option
2011@cindex Mount option; fs
2012
2013The local mount point.  The semantics of this option vary between
2014filesystems.
2015
2016For NFS and UFS filesystems the value of @code{$@{fs@}} is used as the
2017local mount point.  For other filesystem types it has other meanings
2018which are described in the section describing the respective filesystem
2019type.  It is important that this string uniquely identifies the
2020filesystem being mounted.  To satisfy this requirement, it should
2021contain the name of the host on which the filesystem is resident and the
2022pathname of the filesystem on the local or remote host.
2023
2024The reason for requiring the hostname is clear if replicated filesystems
2025are considered.  If a fileserver goes down and a replacement filesystem
2026is mounted then the @dfn{local} mount point @dfn{must} be different from
2027that of the filesystem which is hung.  Some encoding of the filesystem
2028name is required if more than one filesystem is to be mounted from any
2029given host.
2030
2031If the hostname is first in the path then all mounts from a particular
2032host will be gathered below a single directory.  If that server goes
2033down then the hung mount points are less likely to be accidentally
2034referenced, for example when @b{getcwd}(3) traverses the namespace to
2035find the pathname of the current directory.
2036
2037The @samp{fs} option defaults to
2038@code{$@{autodir@}/$@{rhost@}$@{rfs@}}.  In addition,
2039@samp{rhost} defaults to the local host name (@code{$@{host@}}) and
2040@samp{rfs} defaults to the value of @code{$@{path@}}, which is the full
2041path of the requested file; @samp{/home/foo} in the example above
2042(@pxref{Selectors}).  @code{$@{autodir@}} defaults to @samp{/a} but may
2043be changed with the @code{-a} command line option.  Sun's automounter
2044defaults to @samp{/tmp_mnt}.  Note that there is no @samp{/} between
2045the @code{$@{rhost@}} and @code{$@{rfs@}} since @code{$@{rfs@}} begins
2046with a @samp{/}.@refill
2047
2048@node opts Option, remopts Option, fs Option, Map Options
2049@comment  node-name,  next,  previous,  up
2050@subsubsection opts Option
2051@cindex Setting system mount options
2052@cindex Passing parameters to the mount system call
2053@cindex mount system call
2054@cindex mount system call flags
2055@cindex The mount system call
2056@cindex opts, mount option
2057@cindex Mount option; opts
2058
2059The options to pass to the mount system call.  A leading @samp{-} is
2060silently ignored.  The mount options supported generally correspond to
2061those used by @b{mount}(8) and are listed below.  Some additional
2062pseudo-options are interpreted by @i{Amd} and are also listed.
2063
2064Unless specifically overridden, each of the system default mount options
2065applies.  Any options not recognized are ignored.  If no options list is
2066supplied the string @samp{rw,defaults} is used and all the system
2067default mount options apply.  Options which are not applicable for a
2068particular operating system are silently ignored.  For example, only 4.4BSD
2069is known to implement the @code{compress} and @code{spongy} options.
2070
2071@table @code
2072
2073@item acdirmax=@var{n}
2074@cindex Mount flags; acdirmax
2075Set the maximum directory attribute cache timeout to @var{n}.
2076
2077@item acdirmin=@var{n}
2078@cindex Mount flags; acdirmin
2079Set the minimum directory attribute cache timeout to @var{n}.
2080
2081@item acregmax=@var{n}
2082@cindex Mount flags; acregmax
2083Set the maximum file attribute cache timeout to @var{n}.
2084
2085@item acregmin=@var{n}
2086@cindex Mount flags; acregmin
2087Set the minimum file attribute cache timeout to @var{n}.
2088
2089@item actimeo=@var{n}
2090@cindex Mount flags; actimeo
2091Set the overall attribute cache timeout to @var{n}.
2092
2093@item auto
2094@cindex Mount flags; auto
2095@itemx ignore
2096@cindex Mount flags; ignore
2097Ignore this mount by @b{df}(1).
2098
2099@item cache
2100@cindex Mount flags; cache
2101Allow data to be cached from a remote server for this mount.
2102
2103@item compress
2104@cindex Mount flags; compress
2105Use NFS compression protocol.
2106
2107@item defperm
2108@cindex Mount flags; defperm
2109Ignore the permission mode bits, and default file permissions to 0555,
2110UID 0, and GID 0.  Useful for CD-ROMs formatted as ISO-9660.
2111
2112@item dev
2113@cindex Mount flags; dev
2114Allow local special devices on this filesystem.
2115
2116@item dirmask=@var{n}
2117@cindex Mount flags; dirmask
2118For PCFS mounts, specify the maximum file permissions for directories
2119in the file system.  See the @samp{mask} option's description for more
2120details.  The mask value of @var{n} can be specified in decimal,
2121octal, or hexadecimal.
2122
2123@item dumbtimr
2124@cindex Mount flags; dumbtimr
2125Turn off the dynamic retransmit timeout estimator.  This may be useful
2126for UDP mounts that exhibit high retry rates, since it is possible that
2127the dynamically estimated timeout interval is too short.
2128
2129@item extatt
2130@cindex Mount flags; extatt
2131Enable extended attributes in ISO-9660 file systems.
2132
2133@item fsid
2134@cindex Mount flags; fsid
2135Set ID of filesystem.
2136
2137@item gens
2138@cindex Mount flags; gens
2139Enable generations in ISO-9660 file systems.  Generations allow you to
2140see all versions of a given file.
2141
2142@item group=@var{n}
2143@cindex Mount flags; group
2144For PCFS mounts, set the group of the files in the file system to
2145@var{n} (which can either be a group name or a GID number).  The
2146default group is the group of the directory on which the file system
2147is being mounted.
2148
2149@item grpid
2150@cindex Mount flags; grpid
2151Use BSD directory group-id semantics.
2152
2153@item int
2154@cindex Mount flags; int
2155@itemx intr
2156@cindex Mount flags; intr
2157Allow keyboard interrupts on hard mounts.
2158
2159@item lock
2160@cindex Mount flags; lock
2161Use the NFS locking protocol (default)
2162
2163@item longname
2164@cindex Mount Flags; longname
2165For PCFS mounts, force Win95 long names.
2166
2167@item mask=@var{n}
2168@cindex Mount flags; mask
2169For PCFS mounts, specify the maximum file permissions for files in the
2170file system.  For example, a mask of 755 specifies that, by default,
2171the owner should have read, write, and execute permissions for files,
2172but others should only have read and execute permissions.  Only the
2173nine low-order bits of mask are used.  The default mask is taken from
2174the directory on which the file system is being mounted.  The mask
2175value of @var{n} can be specified in decimal, octal, or hexadecimal.
2176
2177@item multi
2178@cindex Mount flags; multi
2179Perform multi-component lookup on files.
2180
2181@item maxgroups
2182@cindex Mount flags; maxgroups
2183Set the maximum number of groups to allow for this mount.
2184
2185@item nfsv3
2186@cindex Mount flags; nfsv3
2187Use NFS Version 3 for this mount.
2188
2189@item noac
2190@cindex Mount flags; noac
2191Turn off the attribute cache.
2192
2193@item noauto
2194@cindex Mount flags; noauto
2195This option is used by the mount command in @samp{/etc/fstab} or
2196@samp{/etc/vfstab} and means not to mount this file system when mount -a
2197is used.
2198
2199@item nocache
2200@cindex Mount flags; nocache
2201Do not allow data to be cached from a remote server for this
2202mount.
2203
2204@item nocasetrans
2205@cindex Mount flags; nocasetrans
2206Don't do case translation. Useful for CD-ROMS formatted as
2207ISO-9660.
2208
2209@item noconn
2210@cindex Mount flags; noconn
2211Don't make a connection on datagram transports.
2212
2213@item nocto
2214@cindex Mount flags; nocto
2215No close-to-open consistency.
2216
2217@item nodefperm
2218@cindex Mount flags; nodefperm
2219Do not ignore the permission mode bits.  Useful for CD-ROMS formatted as
2220ISO-9660.
2221
2222@item nodev
2223@cindex Mount flags; nodev
2224@itemx nodevs
2225@cindex Mount flags; nodevs
2226Don't allow local special devices on this filesystem.
2227
2228@item noexec
2229@cindex Mount flags; noexec
2230Don't allow program execution.
2231
2232@item noint
2233@cindex Mount flags; noint
2234Do not allow keyboard interrupts for this mount
2235
2236@item nojoliet
2237@cindex Mount flags; nojoliet
2238Turn off the Joliet extensions.  Useful for CD-ROMS formatted as ISO-9660.
2239
2240@item nolock
2241@cindex Mount flags; nolock
2242Do not use the NFS locking protocol
2243
2244@item nomnttab
2245@cindex Mount flags; nomnttab
2246This option is used internally to tell Amd that a Solaris 8 system using
2247mntfs is in use.
2248
2249@item norrip
2250@cindex Mount flags; norrip
2251Turn off using of the Rock Ridge Interchange Protocol (RRIP) extensions
2252to ISO-9660.
2253
2254@item nosub
2255@cindex Mount flags; nosub
2256Disallow mounts beneath this mount.
2257
2258@item nosuid
2259@cindex Mount flags; nosuid
2260Don't allow set-uid or set-gid executables on this filesystem.
2261
2262@item noversion
2263@cindex Mount flags; noversion
2264Strip the extension @samp{;#} from the version string of files recorded
2265on an ISO-9660 CD-ROM.
2266
2267@item nowin95
2268@cindex Mount Flags; nowin95
2269For PCFS mounts, completely ignore Win95 entries.
2270
2271@item optionstr
2272@cindex Mount flags; optionstr
2273Under Solaris 8, provide the kernel a string of options to parse and
2274show as part of the special in-kernel mount file system.
2275
2276@item overlay
2277@cindex Mount flags; overlay
2278Overlay this mount on top of an existing mount, if any.
2279
2280@item pgthresh=@var{n}
2281@cindex Mount flags; pgthresh
2282Set the paging threshold to @var{n} kilobytes.
2283
2284@item port=@var{n}
2285@cindex Mount flags; port
2286Set the NFS port to @var{n}.
2287
2288@item posix
2289@cindex Mount flags; posix
2290Turn on POSIX static pathconf for mounts.
2291
2292@item private
2293@cindex Mount flags; private
2294Use local locking instead of the NLM protocol, useful for IRIX 6 only.
2295
2296@item proplist
2297@cindex Mount flags; proplist
2298Support property lists (ACLs) for this mount, useful primarily for Tru64
2299UNIX.
2300
2301@item proto=@var{s}
2302@cindex Mount flags; proto
2303Use transport protocol @var{s} for NFS (can be @code{"tcp"} or @code{"udp"}).
2304
2305@item quota
2306@cindex Mount flags; quota
2307Enable quota checking on this mount.
2308
2309@item rdonly
2310@cindex Mount flags; rdonly
2311@itemx ro
2312@cindex Mount flags; ro
2313Mount this filesystem readonly.
2314
2315@item resvport
2316@cindex Mount flags; resvport
2317Use a reserved port (smaller than 1024) for remote NFS mounts.  Most
2318systems assume that, but some allow for mounts to occur on non-reserved
2319ports.   This causes problems when such a system tries to NFS mount one
2320that requires reserved ports.  It is recommended that this option always
2321be on.
2322
2323@item retrans=@i{n}
2324@cindex Mount flags; retrans
2325The number of NFS retransmits made before a user error is generated by a
2326@samp{soft} mounted filesystem, and before a @samp{hard} mounted
2327filesystem reports @samp{NFS server @dfn{yoyo} not responding still
2328trying}.
2329
2330@item retry
2331@cindex Mount flags; retry
2332Set the NFS retry counter.
2333
2334@item rrcaseins
2335@cindex Mount flags; rrcaseins
2336Enable the Rock Ridge Interchange Protocol (RRIP) case insensitive extensions.
2337Useful for CD-ROMS formatted as ISO-9660.
2338
2339@item rrip
2340@cindex Mount flags; rrip
2341Uses the Rock Ridge Interchange Protocol (RRIP) extensions to ISO-9660.
2342
2343@item rsize=@var{n}
2344@cindex Mount flags; rsize
2345The NFS read packet size.  You may need to set this if you are using
2346NFS/UDP through a gateway or a slow link.
2347
2348@item rw
2349@cindex Mount flags; rw
2350Allow reads and writes on this filesystem.
2351
2352@item shortname
2353@cindex Mount Flags; longname
2354For PCFS mounts, force old DOS short names only.
2355
2356@item soft
2357@cindex Mount flags; soft
2358Give up after @dfn{retrans} retransmissions.
2359
2360@item spongy
2361@cindex Mount flags; spongy
2362Like @samp{soft} for status requests, and @samp{hard} for data transfers.
2363
2364@item suid
2365@cindex Mount flags; suid
2366Allow set-uid programs on this mount.
2367
2368@item symttl
2369@cindex Mount flags; symttl
2370Turn off the symbolic link cache time-to-live.
2371
2372@item sync
2373@cindex Mount flags; sync
2374Perform synchronous filesystem operations on this mount.
2375
2376@item tcp
2377@cindex Mount flags; tcp
2378Use TCP/IP instead of UDP/IP, ignored if the NFS implementation does not
2379support TCP/IP mounts.
2380
2381@item timeo=@var{n}
2382@cindex Mount flags; timeo
2383The NFS timeout, in tenth-seconds, before a request is retransmitted.
2384
2385@item user=@var{n}
2386@cindex Mount flags; user
2387For PCFS mounts, set the owner of the files in the file system to
2388@var{n} (which can either be a user name or a UID number).  The
2389default owner is the owner of the directory on which the file system
2390is being mounted.
2391
2392@item vers=@var{n}
2393@cindex Mount flags; vers
2394Use NFS protocol version number @var{n} (can be 2 or 3).
2395
2396@item wsize=@var{n}
2397@cindex Mount flags; wsize
2398The NFS write packet size.  You may need to set this if you are using
2399NFS/UDP through a gateway or a slow link.
2400
2401@end table
2402
2403The following options are implemented by @i{Amd}, rather than being
2404passed to the kernel.
2405
2406@table @code
2407
2408@item nounmount
2409@cindex Mount flags; nounmount
2410Configures the mount so that its time-to-live will never expire.  This
2411is the default for non-network based filesystem types (such as
2412mounting local disks, floppies, and CD-ROMs).  See also the related
2413@i{unmount} option.
2414@c
2415@c Implementation broken:
2416
2417@item ping=@var{n}
2418@cindex Mount flags; ping
2419The interval, in seconds, between keep-alive pings.  When four
2420consecutive pings have failed the mount point is marked as hung.  This
2421interval defaults to 30 seconds; if the ping interval is set to zero,
2422@i{Amd} will use the default 30-second interval.  If the interval is
2423set to -1 (or any other negative value), no pings are sent and the
2424host is assumed to be always up, which can cause unmounts to hang See
2425the @i{softlookup} option for a better alternative.  Turning pings off
2426can be useful in NFS-HA (High-Availability) sites where the NFS
2427service rarely goes down.  Setting the ping value to a large value can
2428reduce the amount of NFS_NULL chatter on your network considerably,
2429especially in large sites.
2430
2431Note that if you have multiple @i{Amd} entries using the same file
2432server, and each entry sets a different value of N, then each time Amd
2433mounts a new entry, the ping value will be re-evaluated (and updated,
2434turned off, or turned back on as needed).  Finally, note that NFS_NULL
2435pings are sent for both UDP and TCP mounts, because even a hung TCP
2436mount can cause user processes to hang.
2437
2438@item public
2439@cindex Mount flags; public
2440Use WebNFS multi-component lookup on the public file handle instead of
2441the mount protocol to obtain NFS file handles, as documented in the
2442WebNFS Client Specification, RFC 2054.  This means that @i{Amd} will not
2443attempt to contact the remote portmapper or remote mountd daemon, and
2444will only connect to the well-known NFS port 2049 or the port specified
2445with the @i{port} mount option, thus making it easier to use NFS through
2446a firewall.
2447
2448@item retry=@var{n}
2449@cindex Mount flags; retry=@var{n}
2450The number of times to retry the mount system call.
2451
2452@item softlookup
2453@cindex Mount flags; softlookup
2454Configures @i{Amd}'s behavior with respect to already-mounted shares from
2455NFS fileservers that are unreachable.  If softlookup is specified,
2456trying to access such a share will result in an error (EIO, which is
2457changed from the ENOENT 6.0 used to return).  If it is not specified, a
2458regular symlink is provided and the access will probably hang
2459in the NFS filesystem.
2460
2461The default behavior depends on whether the mount is 'soft' or 'hard';
2462softlookup can be used to change this default. This is changed from 6.0
2463which always behaved as if softlookup was specified.
2464
2465@item unmount
2466@cindex Mount flags; unmount
2467Configures the mount so that its time-to-live will indeed expire (and
2468thus may be automatically unmounted).  This is also the default for
2469network-based filesystem types (e.g., NFS).  This option is useful for
2470removable local media such as CD-ROMs, USB drives, etc. so they can
2471expire when not in use, and get unmounted (such drives can get work
2472out when they keep spinning).  See also the related @i{nounmount}
2473option.
2474
2475@item utimeout=@var{n}
2476@cindex Mount flags; utimeout=@var{n}
2477The interval, in seconds, that looked up and mounted map entries are
2478cached.  After that period of time, @i{Amd} will attempt to unmount
2479the entries.  If, however, the unmount fails (with EBUSY), then
2480@i{Amd} will extend the mount's time-to-live by the @i{utimeout} value
2481before the next unmount attempt is made.  In fact the interval is
2482extended before the unmount is attempted, to avoid thrashing.  The
2483default value is 120 seconds (two minutes) or as set by the @code{-w}
2484command line option.
2485
2486@item xlatecookie
2487@cindex Mount flags; xlatecookie
2488Translate directory cookies between 32-long and 64-long lengths.
2489
2490@end table
2491
2492@node remopts Option, sublink Option, opts Option, Map Options
2493@comment  node-name,  next,  previous,  up
2494@subsubsection remopts Option
2495@cindex Setting system mount options for non-local networks
2496@cindex remopts, mount option
2497@cindex Mount option; remopts
2498
2499This option has the same use as @code{$@{opts@}} but applies only when
2500the remote host is on a non-local network.  For example, when using NFS
2501across a gateway it is often necessary to use smaller values for the
2502data read and write sizes.  This can simply be done by specifying the
2503small values in @var{remopts}.  When a non-local host is accessed, the
2504smaller sizes will automatically be used.
2505
2506@i{Amd} determines whether a host is local by examining the network
2507interface configuration at startup.  Any interface changes made after
2508@i{Amd} has been started will not be noticed.  The likely effect will
2509be that a host may incorrectly be declared non-local.
2510
2511Unless otherwise set, the value of @code{$@{remopts@}} is the same as
2512the value of @code{$@{opts@}}.
2513
2514@node sublink Option, type Option, remopts Option, Map Options
2515@comment  node-name,  next,  previous,  up
2516@subsubsection sublink Option
2517@cindex Setting the sublink option
2518@cindex sublink, mount option
2519@cindex Mount option; sublink
2520
2521The subdirectory within the mounted filesystem to which the reference
2522should point.  This can be used to prevent duplicate mounts in cases
2523where multiple directories in the same mounted filesystem are used.
2524
2525@node type Option, , sublink Option, Map Options
2526@comment  node-name,  next,  previous,  up
2527@subsubsection type Option
2528@cindex Setting the filesystem type option
2529@cindex type, mount option
2530@cindex Mount option; type
2531
2532The filesystem type to be used.  @xref{Filesystem Types}, for a full
2533description of each type.@refill
2534
2535@c ################################################################
2536@node Amd Command Line Options, Filesystem Types, Mount Maps, Top
2537@comment  node-name,  next,  previous,  up
2538@chapter @i{Amd} Command Line Options
2539@cindex Command line options, Amd
2540@cindex Amd command line options
2541@cindex Overriding defaults on the command line
2542
2543Many of @i{Amd}'s parameters can be set from the command line.  The
2544command line is also used to specify automount points and maps.
2545
2546The general format of a command line is
2547
2548@example
2549amd [@i{options}] [@{ @i{directory} @i{map-name} [-@i{map-options}] @} ...]
2550@end example
2551
2552For each directory and map-name given or specified in the
2553@file{amd.conf} file, @i{Amd} establishes an automount point.  The
2554@dfn{map-options} may be any sequence of options or
2555selectors---@pxref{Location Format}.  The @dfn{map-options} apply only
2556to @i{Amd}'s mount point.
2557
2558@samp{type:=toplvl;cache:=mapdefault;fs:=$@{map@}} is the default value for the
2559map options.  Default options for a map are read from a special entry in
2560the map whose key is the string @samp{/defaults}.  When default options
2561are given they are prepended to any options specified in the mount-map
2562locations as explained in @ref{Map Defaults}.
2563
2564The @dfn{options} are any combination of those listed below.
2565
2566Once the command line has been parsed, the automount points are mounted.
2567The mount points are created if they do not already exist, in which case they
2568will be removed when @i{Amd} exits.
2569Finally, @i{Amd} disassociates itself from its controlling terminal and
2570forks into the background.
2571
2572Note: Even if @i{Amd} has been built with @samp{-DDEBUG} (via
2573@code{configure --enable-debug}), it will still background itself and
2574disassociate itself from the controlling terminal.  To use a debugger it
2575is necessary to specify @samp{-D daemon} on the command line.
2576However, even with all of this, mounts and unmounts are performed in the
2577background, and @i{Amd} will always fork before doing them.  Therefore,
2578debugging what happens closely during un/mounts is more challenging.
2579
2580@emph{All} of @i{Amd}'s command options (save @code{-F} and @code{-T})
2581can be specified in the @file{amd.conf} file. @xref{Amd Configuration
2582File}.  If @i{Amd} is invoked without any command line options, it will
2583default to using the configuration file @file{/etc/amd.conf}, if one
2584exists.
2585
2586@menu
2587* -a Option::   Automount directory.
2588* -c Option::   Cache timeout interval.
2589* -d Option::   Domain name.
2590* -k Option::   Kernel architecture.
2591* -l Option::   Log file.
2592* -n Option::   Hostname normalization.
2593* -o Option::   Operating system version.
2594* -p Option::   Output process id.
2595* -r Option::   Restart existing mounts.
2596* -t Option::   Kernel RPC timeout.
2597* -v Option::   Version information.
2598* -w Option::   Wait interval after failed unmount.
2599* -x Option::   Log options.
2600* -y Option::   NIS domain.
2601* -A Option::   Operating system Architecture.
2602* -C Option::   Cluster name.
2603* -D Option::   Debug flags.
2604* -F Option::   Amd configuration file.
2605* -H Option::   Show brief help.
2606* -O Option::   Operating system name.
2607* -S Option::   Lock executable pages in memory.
2608* -T Option::   Set tag for configuration file.
2609@end menu
2610
2611@c ----------------------------------------------------------------
2612@node -a Option, -c Option, Amd Command Line Options, Amd Command Line Options
2613@comment  node-name,  next,  previous,  up
2614@section @code{-a} @var{directory}
2615@cindex Automount directory
2616@cindex Setting the default mount directory
2617
2618Specifies the default mount directory.  This option changes the variable
2619@code{$@{autodir@}} which otherwise defaults to @file{/a}.  For example,
2620some sites prefer @file{/amd} or @file{/n}.
2621
2622@example
2623amd -a /amd ...
2624@end example
2625
2626@c ----------------------------------------------------------------
2627@node -c Option, -d Option, -a Option, Amd Command Line Options
2628@comment  node-name,  next,  previous,  up
2629@section @code{-c} @var{cache-interval}
2630@cindex Cache interval
2631@cindex Interval before a filesystem times out
2632@cindex Setting the interval before a filesystem times out
2633@cindex Changing the interval before a filesystem times out
2634
2635Selects the period, in seconds, for which a name is cached by @i{Amd}.
2636If no reference is made to the volume in this period, @i{Amd} discards
2637the volume name to filesystem mapping.
2638
2639Once the last reference to a filesystem has been removed, @i{Amd}
2640attempts to unmount the filesystem.  If the unmount fails the interval
2641is extended by a further period as specified by the @samp{-w} command
2642line option or by the @samp{utimeout} mount option.
2643
2644The default @dfn{cache-interval} is 300 seconds (five minutes).
2645
2646@c ----------------------------------------------------------------
2647@node -d Option, -k Option, -c Option, Amd Command Line Options
2648@comment  node-name,  next,  previous,  up
2649@section @code{-d} @var{domain}
2650@cindex Domain name
2651@cindex Setting the local domain name
2652@cindex Overriding the local domain name
2653
2654Specifies the host's domain.  This sets the internal variable
2655@code{$@{domain@}} and affects the @code{$@{hostd@}} variable.
2656
2657If this option is not specified and the hostname already contains the
2658local domain then that is used, otherwise the default value of
2659@code{$@{domain@}} is @samp{unknown.domain}.
2660
2661For example, if the local domain was @samp{doc.ic.ac.uk}, @i{Amd} could
2662be started as follows:
2663
2664@example
2665amd -d doc.ic.ac.uk ...
2666@end example
2667
2668@c ----------------------------------------------------------------
2669@node -k Option, -l Option, -d Option, Amd Command Line Options
2670@comment  node-name,  next,  previous,  up
2671@section @code{-k} @var{kernel-architecture}
2672@cindex Setting the Kernel architecture
2673
2674Specifies the kernel architecture of the system.  This is usually the
2675output of @samp{uname -m} (the ``machine'' value gotten from
2676@b{uname}(2)).  If the @b{uname}(2) system call is not available, the
2677value of @code{$@{karch@}} defaults to that of @code{$@{arch@}}.
2678
2679The only effect of this option is to set the variable @code{$@{karch@}}.
2680
2681This option would be used as follows:
2682
2683@example
2684amd -k `arch -k` ...
2685@end example
2686
2687@c ----------------------------------------------------------------
2688@node -l Option, -n Option, -k Option, Amd Command Line Options
2689@comment  node-name,  next,  previous,  up
2690@section @code{-l} @var{log-option}
2691@cindex Log filename
2692@cindex Setting the log file
2693@cindex Using syslog to log errors
2694@cindex syslog
2695
2696Selects the form of logging to be made.  Several special @dfn{log-options}
2697are recognized.
2698
2699@enumerate
2700@item
2701If @dfn{log-option} is the string @samp{syslog}, @i{Amd} will use the
2702@b{syslog}(3) mechanism.  If your system supports syslog facilities, then
2703the default facility used is @samp{LOG_DAEMON}.
2704
2705@item
2706@cindex syslog facility; specifying an alternate
2707When using syslog, if you wish to change the facility, append its name
2708to the log option name, delimited by a single colon.  For example, if
2709@dfn{log-options} is the string @samp{syslog:local7} then @b{Amd} will
2710log messages via @b{syslog}(3) using the @samp{LOG_LOCAL7} facility.  If
2711the facility name specified is not recognized, @i{Amd} will default to
2712@samp{LOG_DAEMON}.  Note: while you can use any syslog facility
2713available on your system, it is generally a bad idea to use those
2714reserved for other services such as @samp{kern}, @samp{lpr},
2715@samp{cron}, etc.
2716
2717@item
2718If @dfn{log-option} is the string @samp{/dev/stderr}, @i{Amd} will use
2719standard error, which is also the default target for log messages.  To
2720implement this, @i{Amd} simulates the effect of the @samp{/dev/fd}
2721driver.
2722@end enumerate
2723
2724Any other string is taken as a filename to use for logging.  Log
2725messages are appended to the file if it already exists, otherwise a new
2726file is created.  The file is opened once and then held open, rather
2727than being re-opened for each message.
2728
2729Normally, when long-running daemons hold an open file descriptor on a
2730log file, it is impossible to ``rotate'' the log file and compress older
2731logs on a daily basis.  The daemon needs to be told to discard (via
2732@b{close}(2)) its file handle, and re-open the log file.  This is done
2733using @code{amq -l} @i{log-option}. @xref{Amq -l option}.
2734
2735If the @samp{syslog} option is specified but the system does not support
2736syslog or if the named file cannot be opened or created, @i{Amd} will
2737use standard error.  Error messages generated before @i{Amd} has
2738finished parsing the command line are printed on standard error.
2739
2740Since @i{Amd} tends to generate a lot of logging information (especially
2741if debugging was turned on), and due to it being an important program
2742running on the system, it is usually best to log to a separate disk
2743file.  In that case @i{Amd} would be started as follows:
2744
2745@example
2746amd -l /var/log/amd ...
2747@end example
2748
2749@c ----------------------------------------------------------------
2750@node -n Option, -o Option, -l Option, Amd Command Line Options
2751@comment  node-name,  next,  previous,  up
2752@section @code{-n}
2753@cindex Hostname normalization
2754@cindex Aliased hostnames
2755@cindex Resolving aliased hostnames
2756@cindex Normalizing hostnames
2757
2758Normalizes the remote hostname before using it.  Normalization is done
2759by replacing the value of @code{$@{rhost@}} with the (generally fully
2760qualified) primary name returned by a hostname lookup.
2761
2762This option should be used if several names are used to refer to a
2763single host in a mount map.
2764
2765@c ----------------------------------------------------------------
2766@node -o Option, -p Option, -n Option, Amd Command Line Options
2767@comment  node-name,  next,  previous,  up
2768@section @code{-o} @var{op-sys-ver}
2769@cindex Operating System version
2770@cindex Setting the Operating System version
2771
2772Overrides the compiled-in version number of the operating system, with
2773@var{op-sys-ver}.  Useful when the built-in version is not desired for
2774backward compatibility reasons.  For example, if the built-in version is
2775@samp{2.5.1}, you can override it to @samp{5.5.1}, and use older maps
2776that were written with the latter in mind.
2777
2778@c ----------------------------------------------------------------
2779@node -p Option, -r Option, -o Option, Amd Command Line Options
2780@comment  node-name,  next,  previous,  up
2781@section @code{-p}
2782@cindex Process id
2783@cindex Displaying the process id
2784@cindex process id of Amd daemon
2785@cindex pid file, creating with -p option
2786@cindex Creating a pid file
2787
2788Causes @i{Amd}'s process id to be printed on standard output.
2789This can be redirected to a suitable file for use with kill:
2790
2791@example
2792amd -p > /var/run/amd.pid ...
2793@end example
2794
2795This option only has an affect if @i{Amd} is running in daemon mode.
2796If @i{Amd} is started with the @code{-D daemon} debug flag, this
2797option is ignored.
2798
2799@c ----------------------------------------------------------------
2800@node -r Option, -t Option, -p Option, Amd Command Line Options
2801@comment  node-name,  next,  previous,  up
2802@section @code{-r}
2803@cindex Restarting existing mounts
2804@cindex Picking up existing mounts
2805
2806Tells @i{Amd} to restart existing mounts (@pxref{Inheritance Filesystem}).
2807@c @dfn{This option will be made the default in the next release.}
2808
2809@c ----------------------------------------------------------------
2810@node -t Option, -v Option, -r Option, Amd Command Line Options
2811@comment  node-name,  next,  previous,  up
2812@section @code{-t} @var{timeout.retransmit}
2813@cindex Setting Amd's RPC parameters
2814
2815Specifies the RPC @dfn{timeout} interval and the @dfn{retransmit}
2816counter used by the kernel to communicate to @i{Amd}.  These are used to
2817set the @samp{timeo} and @samp{retrans} mount options, respectively.
2818The default timeout is 0.8 seconds, and the default number of
2819retransmissions is 11.
2820
2821@i{Amd} relies on the kernel RPC retransmit mechanism to trigger mount
2822retries.  The values of these parameters change the overall retry
2823interval.  Too long an interval gives poor interactive response; too
2824short an interval causes excessive retries.
2825
2826@c ----------------------------------------------------------------
2827@node -v Option, -w Option, -t Option, Amd Command Line Options
2828@comment  node-name,  next,  previous,  up
2829@section @code{-v}
2830@cindex Version information
2831@cindex Discovering version information
2832@cindex How to discover your version of Amd
2833
2834Print version information on standard error and then exit.  The output
2835is of the form:
2836
2837@example
2838Copyright (c) 1997-1999 Erez Zadok
2839Copyright (c) 1990 Jan-Simon Pendry
2840Copyright (c) 1990 Imperial College of Science, Technology & Medicine
2841Copyright (c) 1990 The Regents of the University of California.
2842am-utils version 6.0a15 (build 61).
2843Built by ezk@@example.com on date Wed Oct 22 15:21:03 EDT 1997.
2844cpu=sparc (big-endian), arch=sun4, karch=sun4u.
2845full_os=solaris2.5.1, os=sos5, osver=5.5.1, vendor=sun.
2846Map support for: root, passwd, union, nisplus, nis, ndbm, file, error.
2847AMFS: nfs, link, nfsx, nfsl, host, linkx, program, union, inherit,
2848      ufs, lofs, hsfs, pcfs, auto, direct, toplvl, error.
2849FS: autofs, cachefs, cdfs, lofs, nfs, nfs3, pcfs, tfs, tmpfs, ufs.
2850Network 1: wire="mcl-lab-net.cs.columbia.edu" (netnumber=128.59.13).
2851Network 2: wire="14-net.cs.columbia.edu" (netnumber=128.59.14).
2852Network 3: wire="old-net.cs.columbia.edu" (netnumber=128.59.16).
2853@end example
2854
2855The information includes the version number, number of times @i{Amd} was
2856compiled on the local system, release date and name of the release.
2857Following come the cpu type, byte ordering, and the architecture and
2858kernel architecture as @code{$@{arch@}} and @code{$@{karch@}},
2859respectively.  The next line lists the operating system full name, short
2860name, version, and vendor.  These four values correspond to the
2861variables @code{$@{full_os@}}, @code{$@{os@}}, @code{$@{osver@}}, and
2862@code{$@{vendor@}}, respectively.  @xref{Supported Platforms}.
2863
2864Then come a list of map types supported, filesystems internally
2865supported by @i{Amd} (AMFS), and generic filesystems available (FS).
2866Finally all known networks (if any) of this host are listed by name
2867and number.  They are available via the variables
2868@code{$@{wire@}} or @code{$@{network@}}, and
2869@code{$@{netnumber@}} (@pxref{Selectors}) or the @samp{in_network}
2870selector function (@pxref{in_network Selector Function}).
2871
2872@c ----------------------------------------------------------------
2873@node -w Option, -x Option, -v Option, Amd Command Line Options
2874@comment  node-name,  next,  previous,  up
2875@section @code{-w} @var{wait-timeout}
2876@cindex Setting the interval between unmount attempts
2877@cindex unmount attempt backoff interval
2878
2879Selects the interval in seconds between unmount attempts after the
2880initial time-to-live has expired.
2881
2882This defaults to 120 seconds (two minutes).
2883
2884@c ----------------------------------------------------------------
2885@node -x Option, -y Option, -w Option, Amd Command Line Options
2886@comment  node-name,  next,  previous,  up
2887@section @code{-x} @var{opts}
2888@cindex Log message selection
2889@cindex Selecting specific log messages
2890@cindex How to select log messages
2891@cindex syslog priorities
2892
2893Specifies the type and verbosity of log messages.  @dfn{opts} is
2894a comma separated list selected from the following options:
2895
2896@table @code
2897@item fatal
2898Fatal errors (cannot be turned off)
2899@item error
2900Non-fatal errors (cannot be turned off)
2901@item user
2902Non-fatal user errors
2903@item warn
2904Recoverable errors
2905@item warning
2906Alias for @code{warn}
2907@item info
2908Information messages
2909@item map
2910Mount map usage
2911@item stats
2912Additional statistics
2913@item all
2914All of the above
2915@item defaults
2916An alias for "fatal,error,user,warning,info".
2917@end table
2918
2919Initially a set of default logging flags is enabled.  This is as if
2920@samp{-x defaults}
2921or
2922@samp{-x fatal,error,user,warning,info}
2923had been selected.  The command line is
2924parsed and logging is controlled by the @code{-x} option.  The very first
2925set of logging flags is saved and can not be subsequently disabled using
2926@i{Amq}.  This default set of options is useful for general production
2927use.@refill
2928
2929The @samp{info} messages include details of what is mounted and
2930unmounted and when filesystems have timed out.  If you want to have the
2931default set of messages without the @samp{info} messages then you simply
2932need @samp{-x noinfo}.  The messages given by @samp{user} relate to
2933errors in the mount maps, so these are useful when new maps are
2934installed.  The following table lists the syslog priorities used for each
2935of the message types.@refill
2936
2937@table @code
2938@item fatal
2939@samp{LOG_CRIT}
2940@item error
2941@samp{LOG_ERR}
2942@item user
2943@samp{LOG_WARNING}
2944@item warning
2945@samp{LOG_WARNING}
2946@item info
2947@samp{LOG_INFO}
2948@item debug
2949@samp{LOG_DEBUG}
2950@item map
2951@samp{LOG_DEBUG}
2952@item stats
2953@samp{LOG_INFO}
2954@end table
2955
2956The options can be prefixed by the string @samp{no} to indicate
2957that this option should be turned off.  For example, to obtain all
2958but @samp{info} messages the option @samp{-x all,noinfo} would be used.
2959
2960If @i{Amd} was built with debugging enabled the @code{debug} option is
2961automatically enabled regardless of the command line options.
2962
2963@c ----------------------------------------------------------------
2964@node -y Option, -A Option, -x Option, Amd Command Line Options
2965@comment  node-name,  next,  previous,  up
2966@section @code{-y} @var{NIS-domain}
2967@cindex NIS (YP) domain name
2968@cindex Overriding the NIS (YP) domain name
2969@cindex Setting the NIS (YP) domain name
2970@cindex YP domain name
2971
2972Selects an alternate NIS domain.  This is useful for debugging and
2973cross-domain shared mounting.  If this flag is specified, @i{Amd}
2974immediately attempts to bind to a server for this domain.
2975@c @i{Amd} refers to NIS maps when it starts, unless the @code{-m} option
2976@c is specified, and whenever required in a mount map.
2977
2978@c ----------------------------------------------------------------
2979@node -A Option, -C Option, -y Option, Amd Command Line Options
2980@comment  node-name,  next,  previous,  up
2981@section @code{-A} @var{architecture}
2982@cindex Setting the operating system architecture
2983
2984Specifies the OS architecture of the system.
2985The only effect of this option is to set the variable @code{$@{arch@}}.
2986
2987This option would be used as follows:
2988
2989@example
2990amd -A i386 ...
2991@end example
2992
2993@c ----------------------------------------------------------------
2994@node -C Option, -D Option, -A Option, Amd Command Line Options
2995@comment  node-name,  next,  previous,  up
2996@section @code{-C} @var{cluster-name}
2997@cindex Cluster names
2998@cindex Setting the cluster name
2999
3000Specifies the name of the cluster of which the local machine is a member.
3001The only effect is to set the variable @code{$@{cluster@}}.
3002The @dfn{cluster-name} is will usually obtained by running another command which uses
3003a database to map the local hostname into a cluster name.
3004@code{$@{cluster@}} can then be used as a selector to restrict mounting of
3005replicated data.
3006If this option is not given, @code{$@{cluster@}} has the same value as @code{$@{domain@}}.
3007This would be used as follows:
3008
3009@example
3010amd -C `clustername` ...
3011@end example
3012
3013@c ----------------------------------------------------------------
3014@node -D Option, -F Option, -C Option, Amd Command Line Options
3015@comment  node-name,  next,  previous,  up
3016@section @code{-D} @var{opts}
3017@cindex Debug options
3018@cindex Setting debug flags
3019
3020Controls the verbosity and coverage of the debugging trace; @dfn{opts}
3021is a comma separated list of debugging options.  The @code{-D} option is
3022only available if @i{Amd} was compiled with @samp{-DDEBUG}, or
3023configured with @code{configure --enable-debug}.  The memory debugging
3024facilities (@samp{mem}) are only available if @i{Amd} was compiled with
3025@samp{-DDEBUG_MEM} (in addition to @samp{-DDEBUG}), or configured with
3026@code{configure --enable-debug=mem}.
3027
3028The most common options to use are @samp{-D trace} and @samp{-D test}
3029(which turns on all the useful debug options).  As usual, every option
3030can be prefixed with @samp{no} to turn it off.
3031
3032@table @code
3033@item all
3034all options (excluding hrtime and mtab)
3035@item defaults
3036``sensible'' default options (all--excluding hrtime, mtab, and xdrtrace)
3037@item test
3038full debug options plus mtab,nodaemon,nofork,noamq
3039@item amq
3040register @i{Amd} with the RPC portmapper, for @i{Amq}
3041@item daemon
3042enter daemon mode
3043@item fork
3044fork child worker (hlfsd only)
3045@item full
3046program trace
3047@item hrtime
3048print high resolution time stamps (only if @b{syslog}(3) is not used)
3049@item info
3050@cindex debugging hesiod resolver service
3051@cindex Hesiod; turning on RES_DEBUG
3052info service specific debugging (hesiod, nis, etc.)  In the case of
3053hesiod maps, turns on the hesiod RES_DEBUG internal debugging option.
3054@item mem
3055trace memory allocations.  Needs to be explicitly enabled at compile
3056time with --enable-debug=mem.
3057@item mtab
3058use local mount-table file (defaults to @file{/tmp/mtab}, @pxref{debug_mtab_file Parameter})
3059@item readdir
3060show readdir progress
3061@item str
3062debug string munging
3063@item trace
3064trace RPC protocol and NFS mount arguments
3065@item xdrtrace
3066trace XDR routines
3067@end table
3068
3069You may also refer to the program source for a more detailed explanation
3070of the available options.
3071
3072@c ----------------------------------------------------------------
3073@node -F Option, -H Option, -D Option, Amd Command Line Options
3074@comment  node-name,  next,  previous,  up
3075@section @code{-F} @var{conf-file}
3076@cindex Amd configuration file; specifying name
3077@cindex Amd configuration file
3078@cindex amd.conf file
3079
3080Specify an @i{Amd} configuration file @var{conf-file} to use.  For a
3081description of the format and syntax, @pxref{Amd Configuration File}.
3082This configuration file is used to specify any options in lieu of typing
3083many of them on the command line.  The @file{amd.conf} file includes
3084directives for every command line option @i{Amd} has, and many more that
3085are only available via the configuration file facility.  The
3086configuration file specified by this option is processed after all other
3087options had been processed, regardless of the actual location of this
3088option on the command line.
3089
3090@c ----------------------------------------------------------------
3091@node -H Option, -O Option, -F Option, Amd Command Line Options
3092@comment  node-name,  next,  previous,  up
3093@section @code{-H}
3094@cindex Displaying brief help
3095@cindex Help; showing from Amd
3096
3097Print a brief help and usage string.
3098
3099@c ----------------------------------------------------------------
3100@node -O Option, -S Option, -H Option, Amd Command Line Options
3101@comment  node-name,  next,  previous,  up
3102@section @code{-O} @var{op-sys-name}
3103@cindex Operating System name
3104@cindex Setting the Operating System name
3105
3106Overrides the compiled-in name of the operating system, with
3107@var{op-sys-name}.  Useful when the built-in name is not desired for
3108backward compatibility reasons.  For example, if the build in name is
3109@samp{sunos5}, you can override it to the old name @samp{sos5}, and use
3110older maps which were written with the latter in mind.
3111
3112@c ----------------------------------------------------------------
3113@node -S Option, -T Option, -O Option, Amd Command Line Options
3114@comment  node-name,  next,  previous,  up
3115@section @code{-S}
3116@cindex plock; using
3117@cindex mlockall; using
3118@cindex locking executable pages in memory
3119
3120Do @emph{not} lock the running executable pages of @i{Amd} into memory.
3121To improve @i{Amd}'s performance, systems that support the @b{plock}(3)
3122or @b{mlockall}(2)
3123call lock the @i{Amd} process into memory.  This way there is less
3124chance the operating system will schedule, page out, and swap the
3125@i{Amd} process as needed.  This tends to improve @i{Amd}'s performance,
3126at the cost of reserving the memory used by the @i{Amd} process (making
3127it unavailable for other processes).  If this behavior is not desired,
3128use the @code{-S} option.
3129
3130@c ----------------------------------------------------------------
3131@node -T Option, , -S Option, Amd Command Line Options
3132@comment  node-name,  next,  previous,  up
3133@section @code{-T} @var{tag}
3134@cindex Tags for Amd configuration file
3135@cindex Configuration file; tags
3136
3137Specify a tag to use with @file{amd.conf}.  All map entries tagged with
3138@var{tag} will be processed.  Map entries that are not tagged are always
3139processed.  Map entries that are tagged with a tag other than @var{tag}
3140will not be processed.
3141
3142@c ################################################################
3143@node Filesystem Types, Amd Configuration File, Amd Command Line Options, Top
3144@comment  node-name,  next,  previous,  up
3145@chapter Filesystem Types
3146@cindex Filesystem types
3147@cindex Mount types
3148@cindex Types of filesystem
3149
3150To mount a volume, @i{Amd} must be told the type of filesystem to be
3151used.  Each filesystem type typically requires additional information
3152such as the fileserver name for NFS.
3153
3154From the point of view of @i{Amd}, a @dfn{filesystem} is anything that
3155can resolve an incoming name lookup.  An important feature is support
3156for multiple filesystem types.  Some of these filesystems are
3157implemented in the local kernel and some on remote fileservers, whilst
3158the others are implemented internally by @i{Amd}.@refill
3159
3160The two common filesystem types are UFS and NFS.  Four other user
3161accessible filesystems (@samp{link}, @samp{program}, @samp{auto} and
3162@samp{direct}) are also implemented internally by @i{Amd} and these are
3163described below.  There are two additional filesystem types internal to
3164@i{Amd} which are not directly accessible to the user (@samp{inherit}
3165and @samp{error}).  Their use is described since they may still have an
3166effect visible to the user.@refill
3167
3168@menu
3169* Network Filesystem::          A single NFS filesystem.
3170* Network Host Filesystem::     NFS mount a host's entire export tree.
3171* Network Filesystem Group::    An atomic group of NFS filesystems.
3172* Unix Filesystem::             Native disk filesystem.
3173* Caching Filesystem::          Caching from remote server filesystem.
3174* CD-ROM Filesystem::           ISO9660 CD ROM.
3175* Loopback Filesystem::         Local loopback-mount filesystem.
3176* Memory/RAM Filesystem::       A memory or RAM-based filesystem.
3177* Null Filesystem::             4.4BSD's loopback-mount filesystem.
3178* Floppy Filesystem::           MS-DOS Floppy filesystem.
3179* Translucent Filesystem::      The directory merging filesystem.
3180* Shared Memory+Swap Filesystem:: Sun's tmpfs filesystem.
3181* User ID Mapping Filesystem::  4.4BSD's umapfs filesystem.
3182* Program Filesystem::          Generic Program mounts.
3183* Symbolic Link Filesystem::    Local link.
3184* Symbolic Link Filesystem II:: Local link referencing existing filesystem.
3185* NFS-Link Filesystem::         Link if path exists, NFS otherwise.
3186* Automount Filesystem::
3187* Direct Automount Filesystem::
3188* Union Filesystem::
3189* Error Filesystem::
3190* Top-level Filesystem::
3191* Root Filesystem::
3192* Inheritance Filesystem::
3193@end menu
3194
3195@c ----------------------------------------------------------------
3196@node Network Filesystem, Network Host Filesystem, Filesystem Types, Filesystem Types
3197@comment  node-name,  next,  previous,  up
3198@section Network Filesystem (@samp{nfs})
3199@cindex NFS
3200@cindex Mounting an NFS filesystem
3201@cindex How to mount and NFS filesystem
3202@cindex nfs, filesystem type
3203@cindex Filesystem type; nfs
3204
3205The @dfn{nfs} (@samp{type:=nfs}) filesystem type provides access to Sun's NFS.
3206
3207@noindent
3208The following options must be specified:
3209
3210@table @code
3211@cindex rhost, mount option
3212@cindex Mount option; rhost
3213@item rhost
3214the remote fileserver.  This must be an entry in the hosts database.  IP
3215addresses are not accepted.  The default value is taken
3216from the local host name (@code{$@{host@}}) if no other value is
3217specified.
3218
3219@cindex rfs, mount option
3220@cindex Mount option; rfs
3221@item rfs
3222the remote filesystem.
3223If no value is specified for this option, an internal default of
3224@code{$@{path@}} is used.
3225@end table
3226
3227NFS mounts require a two stage process.  First, the @dfn{file handle} of
3228the remote file system must be obtained from the server.  Then a mount
3229system call must be done on the local system.  @i{Amd} keeps a cache
3230of file handles for remote file systems.  The cache entries have a
3231lifetime of a few minutes.
3232
3233If a required file handle is not in the cache, @i{Amd} sends a request
3234to the remote server to obtain it.
3235@c  @i{Amd} @dfn{does not} wait for
3236@c a response; it notes that one of the locations needs retrying, but
3237@c continues with any remaining locations.  When the file handle becomes
3238@c available, and assuming none of the other locations was successfully
3239@c mounted, @i{Amd} will retry the mount.  This mechanism allows several
3240@c NFS filesystems to be mounted in parallel.
3241@c @footnote{The mechanism
3242@c is general, however NFS is the only filesystem
3243@c for which the required hooks have been written.}
3244@c The first one which responds with a valid file handle will be used.
3245
3246Historically, this documentation has maintained that @i{Amd} will try
3247all the locations in parallel and use the first one which responds
3248with a valid file handle. This has not been the case for quite some
3249time, however. Instead, @i{Amd} will go through each location, one by
3250one, and will only skip to the next one if the previous one either
3251fails or times out.
3252
3253@noindent
3254An NFS entry might be:
3255
3256@example
3257jsp  host!=charm;type:=nfs;rhost:=charm;rfs:=/home/charm;sublink:=jsp
3258@end example
3259
3260The mount system call and any unmount attempts are always done
3261in a new task to avoid the possibility of blocking @i{Amd}.
3262
3263@c ----------------------------------------------------------------
3264@node Network Host Filesystem, Network Filesystem Group, Network Filesystem, Filesystem Types
3265@comment  node-name,  next,  previous,  up
3266@section Network Host Filesystem (@samp{host})
3267@cindex Network host filesystem
3268@cindex Mounting entire export trees
3269@cindex How to mount all NFS exported filesystems
3270@cindex host, filesystem type
3271@cindex Filesystem type; host
3272
3273@c NOTE: the current implementation of the @dfn{host} filesystem type
3274@c sometimes fails to maintain a consistent view of the remote mount tree.
3275@c This happens when the mount times out and only some of the remote mounts
3276@c are successfully unmounted.  To prevent this from occurring, use the
3277@c @samp{nounmount} mount option.
3278
3279The @dfn{host} (@samp{type:=host}) filesystem allows access to the entire export tree of an
3280NFS server.  The implementation is layered above the @samp{nfs}
3281implementation so keep-alives work in the same way.  The only option
3282which needs to be specified is @samp{rhost} which is the name of the
3283fileserver to mount.
3284
3285The @samp{host} filesystem type works by querying the mount daemon on
3286the given fileserver to obtain its export list.  @i{Amd} then obtains
3287filehandles for each of the exported filesystems.  Any errors at this
3288stage cause that particular filesystem to be ignored.  Finally each
3289filesystem is mounted.  Again, errors are logged but ignored.  One
3290common reason for mounts to fail is that the mount point does not exist.
3291Although @i{Amd} attempts to automatically create the mount point, it
3292may be on a remote filesystem to which @i{Amd} does not have write
3293permission.
3294
3295When an attempt to unmount a @samp{host} filesystem mount fails, @i{Amd}
3296remounts any filesystems which had successfully been unmounted.  To do
3297this @i{Amd} queries the mount daemon again and obtains a fresh copy of
3298the export list.  @i{Amd} then tries to mount any exported filesystems
3299which are not currently mounted.
3300
3301Sun's automounter provides a special @samp{-hosts} map.  To achieve the
3302same effect with @i{Amd} requires two steps.  First a mount map must
3303be created as follows:
3304
3305@example
3306*       type:=host;rhost:=$@{key@};fs:=$@{autodir@}/$@{rhost@}/root
3307@end example
3308
3309@noindent
3310and then start @i{Amd} with the following command
3311
3312@example
3313amd /net net.map
3314@end example
3315
3316@noindent
3317where @samp{net.map} is the name of map described above.  Note that the
3318value of @code{$@{fs@}} is overridden in the map.  This is done to avoid
3319a clash between the mount tree and any other filesystem already mounted
3320from the same fileserver.
3321
3322If different mount options are needed for different hosts then
3323additional entries can be added to the map, for example
3324
3325@example
3326host2       opts:=ro,nosuid,soft
3327@end example
3328
3329@noindent
3330would soft mount @samp{host2} read-only.
3331
3332@c ----------------------------------------------------------------
3333@node Network Filesystem Group, Unix Filesystem, Network Host Filesystem, Filesystem Types
3334@comment  node-name,  next,  previous,  up
3335@section Network Filesystem Group (@samp{nfsx})
3336@cindex Network filesystem group
3337@cindex Atomic NFS mounts
3338@cindex Mounting an atomic group of NFS filesystems
3339@cindex How to mount an atomic group of NFS filesystems
3340@cindex nfsx, filesystem type
3341@cindex Filesystem type; nfsx
3342
3343The @dfn{nfsx} (@samp{type:=nfsx}) filesystem allows a group of filesystems to be mounted
3344from a single NFS server.  The implementation is layered above the
3345@samp{nfs} implementation so keep-alives work in the same way.
3346
3347@emph{WARNING}: @samp{nfsx} is meant to be a ``last resort'' kind of
3348solution. It is racy and poorly supported. The authors @emph{highly}
3349recommend that other solutions be considered before relying on it.
3350
3351The options are the same as for the @samp{nfs} filesystem with one
3352difference for @samp{rfs}, as explained below.
3353
3354@noindent
3355The following options should be specified:
3356
3357@table @code
3358@item rhost
3359the remote fileserver.  The default value is taken from the local
3360host name (@code{$@{host@}}) if no other value is specified.
3361
3362@item rfs
3363is a list of filesystems to mount, and must be specified.
3364The list is in the form of a comma separated strings.
3365@end table
3366
3367@noindent
3368For example:
3369
3370@example
3371pub  type:=nfsx;rhost:=gould;\
3372     rfs:=/public,/,graphics,usenet;fs:=$@{autodir@}/$@{rhost@}/root
3373@end example
3374
3375The first string defines the root of the tree, and is applied as a
3376prefix to the remaining members of the list which define the individual
3377filesystems.  The first string is @emph{not} used as a filesystem name.
3378A serial operation is used to determine the local mount points to
3379ensure a consistent layout of a tree of mounts.
3380
3381Here, the @emph{three} filesystems, @samp{/public},
3382@samp{/public/graphics} and @samp{/public/usenet}, would be mounted.@refill
3383
3384A local mount point, @code{$@{fs@}}, @emph{must} be specified.  The
3385default local mount point will not work correctly in the general case.
3386A suggestion is to use @samp{fs:=$@{autodir@}/$@{rhost@}/root}.@refill
3387
3388@c ----------------------------------------------------------------
3389@node Unix Filesystem, Caching Filesystem, Network Filesystem Group, Filesystem Types
3390@comment  node-name,  next,  previous,  up
3391@section Unix Filesystem (@samp{ufs}, @samp{xfs}, or @samp{efs})
3392@cindex Unix filesystem
3393@cindex UFS
3394@cindex XFS
3395@cindex EFS
3396@cindex Mounting a UFS filesystem
3397@cindex Mounting a local disk
3398@cindex How to mount a UFS filesystems
3399@cindex How to mount a local disk
3400@cindex Disk filesystems
3401@cindex ufs, filesystem type
3402@cindex Filesystem type; ufs
3403@cindex xfs, filesystem type
3404@cindex Filesystem type; xfs
3405@cindex efs, filesystem type
3406@cindex Filesystem type; efs
3407
3408The @dfn{ufs} (@samp{type:=ufs}) filesystem type provides access to the system's standard
3409disk filesystem---usually a derivative of the Berkeley Fast Filesystem.
3410
3411@noindent
3412The following option must be specified:
3413
3414@table @code
3415@cindex dev, mount option
3416@cindex Mount option; dev
3417@item dev
3418the block special device to be mounted.
3419@end table
3420
3421A UFS entry might be:
3422
3423@example
3424jsp   host==charm;type:=ufs;dev:=/dev/sd0d;sublink:=jsp
3425@end example
3426
3427UFS is the default Unix disk-based file system, which Am-utils picks up
3428during the autoconfiguration phase.  Some systems have more than one
3429type, such as IRIX, that comes with EFS (Extent File System) and XFS
3430(Extended File System).  In those cases, you may explicitly set the file
3431system type, by using entries such:
3432
3433@example
3434ez1   type:=efs;dev:=/dev/xd0a
3435ez2   type:=xfs;dev:=/dev/sd3c
3436@end example
3437
3438The UFS/XFS/EFS filesystems are never timed out by default, i.e. they
3439will never be unmounted by @i{Amd}. If automatic unmounting is
3440desired, the ``unmount'' option should be added to the mount options
3441for the entry.
3442
3443@c ----------------------------------------------------------------
3444@node Caching Filesystem, CD-ROM Filesystem, Unix Filesystem, Filesystem Types
3445@comment  node-name,  next,  previous,  up
3446@section Caching Filesystem (@samp{cachefs})
3447@cindex Caching Filesystem
3448@cindex cachefs, filesystem type
3449@cindex Filesystem type; cachefs
3450
3451The @dfn{cachefs} (@samp{type:=cachefs}) filesystem caches files from
3452one location onto another, presumably providing faster access.  It is
3453particularly useful to cache from a larger and remote (slower) NFS
3454partition to a smaller and local (faster) UFS directory.
3455
3456@noindent
3457The following options must be specified:
3458
3459@table @code
3460@cindex cachedir, mount option
3461@cindex Mount option; cachedir
3462@item cachedir
3463the directory where the cache is stored.
3464@item rfs
3465the path name to the ``back file system'' to be cached from.
3466@item fs
3467the ``front file system'' mount point to the cached files, where @i{Amd}
3468will set a symbolic link pointing to.
3469@end table
3470
3471A CacheFS entry for, say, the @file{/import} @i{Amd} mount point, might
3472be:
3473
3474@example
3475copt  type:=cachefs;cachedir:=/cache;rfs:=/import/opt;fs:=/n/import/copt
3476@end example
3477
3478Access to the pathname @file{/import/copt} will follow a symbolic link
3479to @file{/n/import/copt}.  The latter is the mount point for a caching
3480file system, that caches from @file{/import/opt} to @file{/cache}.
3481
3482The cachefs filesystem is never timed out by default, i.e. it will
3483never be unmounted by @i{Amd}. If automatic unmounting is desired, the
3484``unmount'' option should be added to the mount options for the entry.
3485
3486@b{Caveats}:
3487@enumerate
3488@item This file system is currently only implemented for Solaris 2.x!
3489@item Before being used for the first time, the cache directory @i{must} be
3490initialized with @samp{cfsadmin -c @var{cachedir}}.  See the manual page for
3491@b{cfsadmin}(1M) for more information.
3492@item The ``back file system'' mounted must be a complete file system, not
3493a subdirectory thereof; otherwise you will get an error ``Invalid Argument''.
3494@item If @i{Amd} aborts abnormally, the state of the cache may be
3495inconsistent, requiring running the command @file{fsck -F cachefs
3496@var{cachedir}}.  Otherwise you will get the error ``No Space Left on Device''.
3497@end enumerate
3498
3499@c ----------------------------------------------------------------
3500@node CD-ROM Filesystem, Loopback Filesystem, Caching Filesystem, Filesystem Types
3501@comment  node-name,  next,  previous,  up
3502@section CD-ROM Filesystem (@samp{cdfs})
3503@cindex CD-ROM Filesystem
3504@cindex cdfs, filesystem type
3505@cindex Filesystem type; cdfs
3506
3507The @dfn{cdfs} (@samp{type:=cdfs}) filesystem mounts a CD-ROM with an
3508ISO9660 format filesystem on it.
3509
3510@noindent
3511The following option must be specified:
3512
3513@table @code
3514@cindex dev, mount option
3515@cindex Mount option; dev
3516@item dev
3517the block special device to be mounted.
3518@end table
3519
3520Some operating systems will fail to mount read-only CDs unless the
3521@samp{ro} option is specified.  A cdfs entry might be:
3522
3523@example
3524cdfs      os==sunos4;type:=cdfs;dev:=/dev/sr0 \
3525          os==sunos5;addopts:=ro;type:=cdfs;dev:=/dev/dsk/c0t6d0s2
3526@end example
3527
3528@c ----------------------------------------------------------------
3529@node Loopback Filesystem, Memory/RAM Filesystem, CD-ROM Filesystem, Filesystem Types
3530@comment  node-name,  next,  previous,  up
3531@section Loopback Filesystem (@samp{lofs})
3532@cindex Loopback Filesystem
3533@cindex lofs, filesystem type
3534@cindex Filesystem type; lofs
3535
3536The @dfn{lofs} (@samp{type:=lofs}) filesystem is also called the
3537loopback filesystem.  It mounts a local directory on another, thus
3538providing mount-time binding to another location (unlike symbolic
3539links).
3540
3541The loopback filesystem is particularly useful within the context of a
3542chroot-ed directory (via @b{chroot}(2)), to provide access to
3543directories otherwise inaccessible.
3544
3545@noindent
3546The following option must be specified:
3547
3548@table @code
3549@cindex rfs, mount option
3550@cindex Mount option; rfs
3551@item rfs
3552the pathname to be mounted on top of @code{$@{fs@}}.
3553@end table
3554
3555Usually, the FTP server runs in a chroot-ed environment, for security
3556reasons.  In this example, lofs is used to provide a subdirectory within
3557a user's home directory, also available for public ftp.
3558
3559@example
3560lofs      type:=lofs;rfs:=/home/ezk/myftpdir;fs:=/usr/ftp/pub/ezk
3561@end example
3562
3563@c ----------------------------------------------------------------
3564@node Memory/RAM Filesystem, Null Filesystem, Loopback Filesystem, Filesystem Types
3565@comment  node-name,  next,  previous,  up
3566@section Memory/RAM Filesystem (@samp{mfs})
3567@cindex Memory/RAM Filesystem
3568@cindex mfs, filesystem type
3569@cindex Filesystem type; mfs
3570
3571The @dfn{mfs} (@samp{type:=mfs}) filesystem is available in 4.4BSD,
3572Linux, and other systems.  It creates a filesystem in a portion of the
3573system's memory, thus providing very fast file (volatile) access.
3574
3575XXX: THIS FILESYSTEM IS NOT IMPLEMENTED YET!
3576
3577@c ----------------------------------------------------------------
3578@node Null Filesystem, Floppy Filesystem, Memory/RAM Filesystem, Filesystem Types
3579@comment  node-name,  next,  previous,  up
3580@section Null Filesystem (@samp{nullfs})
3581@cindex Null Filesystem
3582@cindex nullfs, filesystem type
3583@cindex Filesystem type; nullfs
3584
3585The @dfn{nullfs} (@samp{type:=nullfs}) filesystem is available from 4.4BSD,
3586and is very similar to the loopback filesystem, @dfn{lofs}.
3587
3588XXX: THIS FILESYSTEM IS NOT IMPLEMENTED YET!
3589
3590@c ----------------------------------------------------------------
3591@node Floppy Filesystem, Translucent Filesystem, Null Filesystem, Filesystem Types
3592@comment  node-name,  next,  previous,  up
3593@section Floppy Filesystem (@samp{pcfs})
3594@cindex Floppy Filesystem
3595@cindex pcfs, filesystem type
3596@cindex Filesystem type; pcfs
3597
3598The @dfn{pcfs} (@samp{type:=pcfs}) filesystem mounts a floppy previously
3599formatted for the MS-DOS format.
3600
3601@noindent
3602The following option must be specified:
3603
3604@table @code
3605@cindex dev, mount option
3606@cindex Mount option; dev
3607@item dev
3608the block special device to be mounted.
3609@end table
3610
3611A pcfs entry might be:
3612
3613@example
3614pcfs      os==sunos4;type:=pcfs;dev:=/dev/fd0 \
3615          os==sunos5;type:=pcfs;dev:=/dev/diskette
3616@end example
3617
3618@c ----------------------------------------------------------------
3619@node Translucent Filesystem, Shared Memory+Swap Filesystem, Floppy Filesystem, Filesystem Types
3620@comment  node-name,  next,  previous,  up
3621@section Translucent Filesystem (@samp{tfs})
3622@cindex Translucent Filesystem
3623@cindex tfs, filesystem type
3624@cindex Filesystem type; tfs
3625
3626The @dfn{tfs} (@samp{type:=tfs}) filesystem is an older version of the
36274.4BSD @dfn{unionfs}.
3628
3629XXX: THIS FILESYSTEM IS NOT IMPLEMENTED YET!
3630
3631@c ----------------------------------------------------------------
3632@node Shared Memory+Swap Filesystem, User ID Mapping Filesystem, Translucent Filesystem, Filesystem Types
3633@comment  node-name,  next,  previous,  up
3634@section Shared Memory+Swap Filesystem (@samp{tmpfs})
3635@cindex Shared Memory and Swap Filesystem
3636@cindex tmpfs, filesystem type
3637@cindex Filesystem type; tmpfs
3638
3639The @dfn{tmpfs} (@samp{type:=tmpfs}) filesystem shares memory between a
3640the swap device and the rest of the system.  It is generally used to
3641provide a fast access @file{/tmp} directory, one that uses memory that
3642is otherwise unused.  This filesystem is available in SunOS 4.x and 5.x.
3643
3644XXX: THIS FILESYSTEM IS NOT IMPLEMENTED YET!
3645
3646@c ----------------------------------------------------------------
3647@node User ID Mapping Filesystem, Program Filesystem, Shared Memory+Swap Filesystem, Filesystem Types
3648@comment  node-name,  next,  previous,  up
3649@section User ID Mapping Filesystem (@samp{umapfs})
3650@cindex User ID Mapping Filesystem
3651@cindex umapfs, filesystem type
3652@cindex Filesystem type; umapfs
3653
3654The @dfn{umapfs} (@samp{type:=umapfs}) filesystem maps User IDs of file
3655ownership, and is available from 4.4BSD.
3656
3657XXX: THIS FILESYSTEM IS NOT IMPLEMENTED YET!
3658
3659@c ----------------------------------------------------------------
3660@node Program Filesystem, Symbolic Link Filesystem, User ID Mapping Filesystem, Filesystem Types
3661@comment  node-name,  next,  previous,  up
3662@section Program Filesystem (@samp{program})
3663@cindex Program filesystem
3664@cindex Mount a filesystem under program control
3665@cindex program, filesystem type
3666@cindex Filesystem type; program
3667
3668The @dfn{program} (@samp{type:=program}) filesystem type allows a
3669program to be run whenever a mount or unmount is required.  This allows
3670easy addition of support for other filesystem types, such as MIT's
3671Remote Virtual Disk (RVD) which has a programmatic interface via the
3672commands @samp{rvdmount} and @samp{rvdunmount}.
3673
3674@noindent
3675Both of the following options must be specified:
3676
3677@table @code
3678@cindex mount, mount option
3679@cindex Mount option; mount
3680@item mount
3681the program which will perform the mount.
3682
3683@cindex unmount, mount option
3684@cindex umount, mount option
3685@cindex Mount option; unmount
3686@cindex Mount option; umount
3687@item unmount
3688@item umount
3689the program which will perform the unmount.  For convenience, you may
3690use either @samp{unmount} or @samp{umount} but not both.  If neither
3691is defined, @i{Amd} will default to @samp{umount $@{fs@}} (the actual
3692unmount program pathname will be automatically determined at the time
3693GNU @code{configure} runs.)
3694@end table
3695
3696The exit code from these two programs is interpreted as a Unix error
3697code.  As usual, exit code zero indicates success.  To execute the
3698program, @i{Amd} splits the string on whitespace to create an array of
3699substrings.  Single quotes @samp{'} can be used to quote whitespace
3700if that is required in an argument.  There is no way to escape or change
3701the single quote character.
3702
3703To run e.g. the program @samp{rvdmount} with a host name and filesystem as
3704arguments, it would be specified by
3705@samp{fs:=$@{autodir@}$@{path@};type:=program;mount:="/etc/rvdmount
3706rvdmount fserver $@{fs@}";unmount:="/etc/rdvumount rvdumount $@{fs@}"}.
3707
3708The first element in the array is taken as the pathname of the program
3709to execute.  The other members of the array form the argument vector
3710to be passed to the program, @dfn{including argument zero}.  The array
3711is exactly the same as the array passed to the execv() system call
3712(man execv for details).  The split string must have at least two
3713elements.  The programs are directly executed by @i{Amd}, not via a
3714shell.  Therefore, if a script is to be used as a mount/umount
3715program, it @dfn{must} begin with a @code{#!} interpreter specification.
3716
3717Often, this program mount type is used for Samba mounts, where you
3718need a double slash in pathnames.  However, @i{Amd} normalizes
3719sequences of slashes into one slash.  Therefore, you must use an
3720escaped slash, preceded by an escaped backslash.  So to get a double
3721slash in the mount command, you need the eight character sequence
3722@samp{\\\/\\\/} in your map.  For example:
3723
3724@samp{mount="/sbin/mount mount -r -t smbfs -o-N,-Ihostname \\\/\\\/guest@@venus/mp3"}
3725
3726If a filesystem type is to be heavily used, it may be worthwhile adding
3727a new filesystem type into @i{Amd}, but for most uses the program
3728filesystem should suffice.
3729
3730When the program is run, standard input and standard error are inherited
3731from the current values used by @i{Amd}.  Standard output is a
3732duplicate of standard error.  The value specified with the @code{-l}
3733command line option has no effect on standard error.
3734
3735@i{Amd} guarantees that the mountpoint will be created before calling
3736the mount program, and that it will be removed after the umount
3737program returns success.
3738
3739@c ----------------------------------------------------------------
3740@node Symbolic Link Filesystem, Symbolic Link Filesystem II, Program Filesystem, Filesystem Types
3741@comment  node-name,  next,  previous,  up
3742@section Symbolic Link Filesystem (@samp{link})
3743@cindex Symbolic link filesystem
3744@cindex Referencing part of the local name space
3745@cindex Mounting part of the local name space
3746@cindex How to reference part of the local name space
3747@cindex link, filesystem type
3748@cindex symlink, link filesystem type
3749@cindex Filesystem type; link
3750
3751Each filesystem type creates a symbolic link to point from the volume
3752name to the physical mount point.  The @samp{link} filesystem does the
3753same without any other side effects.  This allows any part of the
3754machines name space to be accessed via @i{Amd}.
3755
3756One common use for the symlink filesystem is @file{/homes} which can be
3757made to contain an entry for each user which points to their
3758(auto-mounted) home directory.  Although this may seem rather expensive,
3759it provides a great deal of administrative flexibility.
3760
3761@noindent
3762The following option must be defined:
3763
3764@table @code
3765@item fs
3766The value of @var{fs} option specifies the destination of the link, as
3767modified by the @var{sublink} option.  If @var{sublink} is non-null, it
3768is appended to @code{$@{fs@}}@code{/} and the resulting string is used
3769as the target.
3770@end table
3771
3772The @samp{link} filesystem can be thought of as identical to the
3773@samp{ufs} filesystem but without actually mounting anything.
3774
3775An example entry might be:
3776
3777@example
3778jsp   host==charm;type:=link;fs:=/home/charm;sublink:=jsp
3779@end example
3780which would return a symbolic link pointing to @file{/home/charm/jsp}.
3781
3782@c ----------------------------------------------------------------
3783@node Symbolic Link Filesystem II, NFS-Link Filesystem, Symbolic Link Filesystem, Filesystem Types
3784@comment  node-name,  next,  previous,  up
3785@section Symbolic Link Filesystem II (@samp{linkx})
3786@cindex Symbolic link filesystem II
3787@cindex Referencing an existing part of the local name space
3788@cindex Mounting an existing part of the local name space
3789@cindex How to reference an existing part of the local name space
3790@cindex linkx, filesystem type
3791@cindex symlink, linkx filesystem type
3792@cindex Filesystem type; linkx
3793
3794The @dfn{linkx} (@samp{type:=linkx}) filesystem type is identical to @samp{link} with the
3795exception that the target of the link must exist.  Existence is checked
3796with the @b{lstat}(2) system call.
3797
3798The @samp{linkx} filesystem type is particularly useful for wildcard map
3799entries.  In this case, a list of possible targets can be given and
3800@i{Amd} will choose the first one which exists on the local machine.
3801
3802@c ----------------------------------------------------------------
3803@node NFS-Link Filesystem, Automount Filesystem, Symbolic Link Filesystem II, Filesystem Types
3804@comment  node-name,  next,  previous,  up
3805@section NFS-Link Filesystem (@samp{nfsl})
3806@cindex NFS-Link filesystem II
3807@cindex Referencing an existing part of the name space if target exists
3808@cindex Mounting a remote part of the name space if target is missing
3809@cindex Symlink if target exists, NFS otherwise
3810@cindex nfsl, filesystem type
3811@cindex symlink, nfsl filesystem type
3812@cindex Filesystem type; nfsl
3813
3814The @dfn{nfsl} (@samp{type:=nfsl}) filesystem type is a combination of two others:
3815@samp{link} and @samp{nfs}.  If the local host name is equal to the
3816value of @code{$@{rhost@}} @emph{and} the target pathname listed in
3817@code{$@{fs@}} exists, @samp{nfsl} will behave exactly as
3818@samp{type:=link}, and refer to the target as a symbolic link.  If the
3819local host name is not equal to the value of @code{$@{rhost@}}, or if
3820the target of the link does not exist, @i{Amd} will treat it as
3821@samp{type:=nfs}, and will mount a remote pathname for it.
3822
3823The @samp{nfsl} filesystem type is particularly useful as a shorthand
3824for the more cumbersome and yet one of the most popular @i{Amd}
3825entries.  For example, you can simplify all map entries that look like:
3826
3827@example
3828zing    -fs:=/n/shekel/u/zing \
3829        host!=shekel;type:=nfs;rhost:=shekel;rfs:=$@{fs@} \
3830        host==shekel;type:=link
3831@end example
3832
3833or
3834
3835@example
3836zing    -fs:=/n/shekel/u/zing \
3837        exists($@{fs@});type:=link \
3838        !exists($@{fs@});type:=nfs;rhost:=shekel;rfs:=$@{fs@}
3839@end example
3840
3841into a shorter form
3842
3843@example
3844zing    type:=nfsl;fs:=/n/shekel/u/zing;rhost:=shekel;rfs:=$@{fs@}
3845@end example
3846
3847Not just does it make the maps smaller and simpler, but it avoids
3848possible mistakes that often happen when forgetting to set up the two
3849entries (one for @samp{type:=nfs} and the other for @samp{type:=link})
3850necessary to perform transparent mounts of existing or remote mounts.
3851
3852@c ----------------------------------------------------------------
3853@node Automount Filesystem, Direct Automount Filesystem, NFS-Link Filesystem, Filesystem Types
3854@comment  node-name,  next,  previous,  up
3855@section Automount Filesystem (@samp{auto})
3856@cindex Automount filesystem
3857@cindex Map cache types
3858@cindex Setting map cache parameters
3859@cindex How to set map cache parameters
3860@cindex How to start an indirect automount point
3861@cindex auto, filesystem type
3862@cindex Filesystem type; auto
3863@cindex SIGHUP signal
3864@cindex Map cache synchronizing
3865@cindex Synchronizing the map cache
3866@cindex Map cache options
3867@cindex Regular expressions in maps
3868
3869The @dfn{auto} (@samp{type:=auto}) filesystem type creates a new automount point below an
3870existing automount point.  Top-level automount points appear as system
3871mount points.  An automount mount point can also appear as a
3872sub-directory of an existing automount point.  This allows some
3873additional structure to be added, for example to mimic the mount tree of
3874another machine.
3875
3876The following options may be specified:
3877
3878@table @code
3879@cindex cache, mount map option
3880@cindex Mount map option; cache
3881@item cache
3882specifies whether the data in this mount-map should be
3883cached.  The default value is @samp{none}, in which case
3884no caching is done in order to conserve memory.
3885
3886However, better performance and reliability can be obtained by caching
3887some or all of a mount-map.
3888
3889If the cache option specifies @samp{all},
3890the entire map is enumerated when the mount point is created.
3891
3892If the cache option specifies @samp{inc}, caching is done incrementally
3893as and when data is required.
3894Some map types do not support cache mode @samp{all}, in which case @samp{inc}
3895is used whenever @samp{all} is requested.
3896
3897Caching can be entirely disabled by using cache mode @samp{none}.
3898
3899If the cache option specifies @samp{regexp} then the entire map will be
3900enumerated and each key will be treated as an egrep-style regular
3901expression.  The order in which a cached map is searched does not
3902correspond to the ordering in the source map so the regular expressions
3903should be mutually exclusive to avoid confusion.
3904
3905Each mount map type has a default cache type, usually @samp{inc}, which
3906can be selected by specifying @samp{mapdefault}.
3907
3908The cache mode for a mount map can only be selected on the command line.
3909Starting @i{Amd} with the command:
3910
3911@example
3912amd /homes hesiod.homes -cache:=inc
3913@end example
3914
3915will cause @samp{/homes} to be automounted using the @dfn{Hesiod} name
3916server with local incremental caching of all successfully resolved names.
3917
3918All cached data is forgotten whenever @i{Amd} receives a @samp{SIGHUP}
3919signal and, if cache @samp{all} mode was selected, the cache will be
3920reloaded.  This can be used to inform @i{Amd} that a map has been
3921updated.  In addition, whenever a cache lookup fails and @i{Amd} needs
3922to examine a map, the map's modify time is examined.  If the cache is
3923out of date with respect to the map then it is flushed as if a
3924@samp{SIGHUP} had been received.
3925
3926An additional option (@samp{sync}) may be specified to force @i{Amd} to
3927check the map's modify time whenever a cached entry is being used.  For
3928example, an incremental, synchronized cache would be created by the
3929following command:
3930
3931@example
3932amd /homes hesiod.homes -cache:=inc,sync
3933@end example
3934
3935@item fs
3936specifies the name of the mount map to use for the new mount point.
3937
3938Arguably this should have been specified with the @code{$@{rfs@}} option but
3939we are now stuck with it due to historical accident.
3940
3941@c %If the string @samp{.} is used then the same map is used;
3942@c %in addition the lookup prefix is set to the name of the mount point followed
3943@c %by a slash @samp{/}.
3944@c %This is the same as specifying @samp{fs:=\$@{map@};pref:=\$@{key@}/}.
3945@c
3946
3947@item pref
3948alters the name that is looked up in the mount map.  If
3949@code{$@{pref@}}, the @dfn{prefix}, is non-null then it is prepended
3950to the name requested by the kernel @dfn{before} the map is
3951searched. The default prefix is the prefix of the parent map (if any)
3952with name of the auto node appended to it. That means if you want no
3953prefix you must say so in the map: @samp{pref:=null}.
3954
3955@item opts
3956Normally, @samp{auto} style maps are not browsable even if you turn on
3957directory browsability (@pxref{browsable_dirs Parameter}).  To enable
3958browsing entries in @samp{auto} maps, specify @samp{opts:=browsable}
3959or @samp{opts:=fullybrowsable} in
3960the description of this map.
3961
3962@end table
3963
3964The server @samp{dylan.doc.ic.ac.uk} has two user disks:
3965@samp{/dev/dsk/2s0} and @samp{/dev/dsk/5s0}.  These are accessed as
3966@samp{/home/dylan/dk2} and @samp{/home/dylan/dk5} respectively.  Since
3967@samp{/home} is already an automount point, this naming is achieved with
3968the following map entries:@refill
3969
3970@example
3971dylan        type:=auto;fs:=$@{map@};pref:=$@{key@}/
3972dylan/dk2    type:=ufs;dev:=/dev/dsk/2s0
3973dylan/dk5    type:=ufs;dev:=/dev/dsk/5s0
3974@end example
3975
3976@c ----------------------------------------------------------------
3977@node Direct Automount Filesystem, Union Filesystem, Automount Filesystem, Filesystem Types
3978@comment  node-name,  next,  previous,  up
3979@section Direct Automount Filesystem (@samp{direct})
3980@cindex Direct automount filesystem
3981@cindex How to start a direct automount point
3982@cindex direct, filesystem type
3983@cindex Filesystem type; direct
3984
3985The @dfn{direct} (@samp{type:=direct}) filesystem is almost identical to
3986the automount filesystem.  Instead of appearing to be a directory of
3987mount points, it appears as a symbolic link to a mounted filesystem.
3988The mount is done at the time the link is accessed.  @xref{Automount
3989Filesystem}, for a list of required options.
3990
3991Direct automount points are created by specifying the @samp{direct}
3992filesystem type on the command line:
3993
3994@example
3995amd ... /usr/man auto.direct -type:=direct
3996@end example
3997
3998where @samp{auto.direct} would contain an entry such as:
3999
4000@example
4001usr/man    -type:=nfs;rfs:=/usr/man \
4002           rhost:=man-server1  rhost:=man-server2
4003@end example
4004
4005In this example, @samp{man-server1} and @samp{man-server2} are file
4006servers which export copies of the manual pages.  Note that the key
4007which is looked up is the name of the automount point without the
4008leading @samp{/}.
4009
4010Note that the implementation of the traditional @dfn{direct} filesystem is
4011essentially a hack (pretending that the root of an NFS filesystem is a
4012symlink) and many modern operating systems get very unhappy about
4013it. For example, Linux kernel 2.4+ completely disallows it, and Solaris
40142.8 fails to unmount it when @i{Amd} shuts down. Therefore, the use of
4015the traditional @dfn{direct} filesystem is strongly discouraged; it is
4016only semi-supported, at best.
4017
4018The autofs implementations that permit direct mounts are fully
4019supported, however. That currently includes all versions of
4020Solaris. Linux autofs does NOT support direct mounts at all.
4021
4022@c ----------------------------------------------------------------
4023@node Union Filesystem, Error Filesystem, Direct Automount Filesystem, Filesystem Types
4024@comment  node-name,  next,  previous,  up
4025@section Union Filesystem (@samp{union})
4026@cindex Union filesystem
4027@cindex union, filesystem type
4028@cindex Filesystem type; union
4029
4030The @dfn{union} (@samp{type:=union}) filesystem type allows the contents of several
4031directories to be merged and made visible in a single directory.  This
4032can be used to overcome one of the major limitations of the Unix mount
4033mechanism which only allows complete directories to be mounted.
4034
4035For example, supposing @file{/tmp} and @file{/var/tmp} were to be merged
4036into a new directory called @file{/mtmp}, with files in @file{/var/tmp}
4037taking precedence.  The following command could be used to achieve this
4038effect:
4039
4040@example
4041amd ... /mtmp union:/tmp:/var/tmp -type:=union
4042@end example
4043
4044Currently, the unioned directories must @emph{not} be automounted.  That
4045would cause a deadlock.  This seriously limits the current usefulness of
4046this filesystem type and the problem will be addressed in a future
4047release of @i{Amd}.
4048
4049Files created in the union directory are actually created in the last
4050named directory.  This is done by creating a wildcard entry which points
4051to the correct directory.  The wildcard entry is visible if the union
4052directory is listed, so allowing you to see which directory has
4053priority.
4054
4055The files visible in the union directory are computed at the time
4056@i{Amd} is started, and are not kept up-to-date with respect to the
4057underlying directories.  Similarly, if a link is removed, for example
4058with the @samp{rm} command, it will be lost forever.
4059
4060@c ----------------------------------------------------------------
4061@node Error Filesystem, Top-level Filesystem, Union Filesystem, Filesystem Types
4062@comment  node-name,  next,  previous,  up
4063@section Error Filesystem (@samp{error})
4064@cindex Error filesystem
4065@cindex error, filesystem type
4066@cindex Filesystem type; error
4067
4068The @dfn{error} (@samp{type:=error}) filesystem type is used internally as a catch-all in the
4069case where none of the other filesystems was selected, or some other
4070error occurred.  Lookups and mounts always fail with ``No such file or
4071directory''.  All other operations trivially succeed.
4072
4073The error filesystem is not directly accessible.
4074
4075@c ----------------------------------------------------------------
4076@node Top-level Filesystem, Root Filesystem, Error Filesystem, Filesystem Types
4077@comment  node-name,  next,  previous,  up
4078@section Top-level Filesystem (@samp{toplvl})
4079@cindex Top level filesystem
4080@cindex toplvl, filesystem type
4081@cindex Filesystem type; toplvl
4082
4083The @dfn{toplvl} (@samp{type:=toplvl}) filesystems is derived from the @samp{auto} filesystem
4084and is used to mount the top-level automount nodes.  Requests of this
4085type are automatically generated from the command line arguments.
4086
4087@c ----------------------------------------------------------------
4088@node Root Filesystem, Inheritance Filesystem, Top-level Filesystem, Filesystem Types
4089@comment  node-name,  next,  previous,  up
4090@section Root Filesystem (@samp{root})
4091@cindex Root filesystem
4092@cindex root, filesystem type
4093@cindex Filesystem type; root
4094
4095The @dfn{root} (@samp{type:=root}) filesystem type acts as an internal
4096placeholder onto which @i{Amd} can pin @samp{toplvl} mounts.  Only one
4097node of this type need ever exist and one is created automatically
4098during startup.  The effect of having more than one root node is
4099undefined.
4100
4101The root filesystem is not directly accessible.
4102
4103@c ----------------------------------------------------------------
4104@node Inheritance Filesystem, , Root Filesystem, Filesystem Types
4105@comment  node-name,  next,  previous,  up
4106@section Inheritance Filesystem (@samp{inherit})
4107@cindex Inheritance filesystem
4108@cindex Nodes generated on a restart
4109@cindex inherit, filesystem type
4110@cindex Filesystem type; inherit
4111
4112The @dfn{inheritance} (@samp{type:=inherit}) filesystem is not directly
4113accessible.  Instead, internal mount nodes of this type are
4114automatically generated when @i{Amd} is started with the @code{-r} option.
4115At this time the system mount table is scanned to locate any filesystems
4116which are already mounted.  If any reference to these filesystems is
4117made through @i{Amd} then instead of attempting to mount it, @i{Amd}
4118simulates the mount and @dfn{inherits} the filesystem.  This allows a
4119new version of @i{Amd} to be installed on a live system simply by
4120killing the old daemon with @samp{SIGTERM} and starting the new one.@refill
4121
4122This filesystem type is not generally visible externally, but it is
4123possible that the output from @samp{amq -m} may list @samp{inherit} as
4124the filesystem type.  This happens when an inherit operation cannot
4125be completed for some reason, usually because a fileserver is down.
4126
4127@c ################################################################
4128@node Amd Configuration File, Run-time Administration, Filesystem Types, Top
4129@comment  node-name,  next,  previous,  up
4130@chapter Amd Configuration File
4131@cindex  Amd Configuration File
4132@cindex amd.conf
4133
4134The @samp{amd.conf} file is the configuration file for @i{Amd}, as part
4135of the am-utils suite.  This file contains runtime configuration
4136information for the @i{Amd} automounter program.
4137
4138@menu
4139* File Format::
4140* The Global Section::
4141* Regular Map Sections::
4142* Common Parameters::
4143* Global Parameters::
4144* Regular Map Parameters::
4145* amd.conf Examples::
4146@end menu
4147
4148@c ================================================================
4149@node File Format, The Global Section, Amd Configuration File, Amd Configuration File
4150@comment  node-name,  next,  previous,  up
4151@section File Format
4152@cindex amd.conf file format
4153
4154The @samp{amd.conf} file consists of sections and parameters.  A section
4155begins with the name of the section in square brackets @samp{[]} and
4156continues until the next section begins or the end of the file is reached.
4157Sections contain parameters of the form @samp{name = value}.
4158
4159The file is line-based --- that is, each newline-terminated line
4160represents either a comment, a section name or a parameter.  No
4161line-continuation syntax is available.
4162
4163Section names, parameter names and their values are case sensitive.
4164
4165Only the first equals sign in a parameter is significant.  Whitespace
4166before or after the first equals sign is discarded.  Leading, trailing
4167and internal whitespace in section and parameter names is irrelevant.
4168Leading and trailing whitespace in a parameter value is discarded.
4169Internal whitespace within a parameter value is not allowed, unless the
4170whole parameter value is quoted with double quotes as in @samp{name =
4171"some value"}.
4172
4173Any line beginning with a pound sign @samp{#} is ignored, as are lines
4174containing only whitespace.
4175
4176The values following the equals sign in parameters are all either a
4177string (no quotes needed if string does not include spaces) or a
4178boolean, which may be given as @samp{yes}/@samp{no}.  Case is significant in all
4179values.  Some items such as cache timeouts are numeric.
4180
4181@c ================================================================
4182@node The Global Section, Regular Map Sections, File Format, Amd Configuration File
4183@comment  node-name,  next,  previous,  up
4184@section The Global Section
4185@cindex amd.conf global section
4186
4187The global section must be specified as @samp{[global]}.  Parameters in
4188this section either apply to @i{Amd} as a whole, or to all other regular map
4189sections which follow.  There should be only one global section defined
4190in one configuration file.
4191
4192It is highly recommended that this section be specified first in the
4193configuration file.  If it is not, then regular map sections which
4194precede it will not use global values defined later.
4195
4196@c ================================================================
4197@node Regular Map Sections, Common Parameters, The Global Section, Amd Configuration File
4198@comment  node-name,  next,  previous,  up
4199@section Regular Map Sections
4200@cindex amd.conf regular map sections
4201
4202Parameters in regular (non-global) sections apply to a single map entry.
4203For example, if the map section @samp{[/homes]} is defined, then all
4204parameters following it will be applied to the @file{/homes}
4205@i{Amd}-managed mount point.
4206
4207@c ================================================================
4208@node Common Parameters, Global Parameters, Regular Map Sections, Amd Configuration File
4209@comment  node-name,  next,  previous,  up
4210@section Common Parameters
4211@cindex amd.conf common parameters
4212
4213These parameters can be specified either in the global or a map-specific
4214section.  Entries specified in a map-specific section override the default
4215value or one defined in the global section.   If such a common parameter is
4216specified only in the global section, it is applicable to all regular map
4217sections that follow.
4218
4219@menu
4220* autofs_use_lofs Parameter::
4221* browsable_dirs Parameter::
4222* map_defaults Parameter::
4223* map_options Parameter::
4224* map_type Parameter::
4225* mount_type Parameter::
4226* search_path Parameter::
4227* selectors_in_defaults Parameter::
4228* sun_map_syntax Parameter::
4229@end menu
4230
4231@c ----------------------------------------------------------------
4232@node autofs_use_lofs Parameter, browsable_dirs Parameter, Common Parameters, Common Parameters
4233@comment  node-name,  next,  previous,  up
4234@subsection @t{autofs_use_lofs} Parameter
4235@cindex autofs_use_lofs Parameter
4236
4237(type=string, default=@samp{yes}).
4238When set to @samp{yes}, @i{Amd}'s autofs code will use lofs-type
4239(loopback) mounts for @code{type:=link} mounts, as well as several
4240other cases that require local references.  This has the advantage
4241that @i{Amd} does not use a secondary mount point and users do not see
4242external pathnames (the infamous @code{/bin/pwd} problem, where it
4243reports a different path than the user chdir'ed into).  One of the
4244disadvantages of using this option is that the autofs code is
4245relatively new and the in-place mounts have not been throughly tested.
4246
4247If this option is set to @samp{no}, then @i{Amd}'s autofs code will
4248use symlinks instead of lofs-type mounts for local references.  This
4249has the advantage of using simpler (more stable) code, but at the
4250expense of negating one of autofs's big advantages: the hiding of
4251@i{Amd}'s internal paths.  Note that symlinks are not supported in all
4252autofs implementations, especially those derived from Solaris Autofs
4253v1.  Also, on Solaris 2.6 and newer, autofs symlinks are not cached,
4254resulting in repeated up-call requests to @i{Amd}.
4255
4256@c ----------------------------------------------------------------
4257@node browsable_dirs Parameter, map_defaults Parameter, autofs_use_lofs Parameter, Common Parameters
4258@comment  node-name,  next,  previous,  up
4259@subsection @t{browsable_dirs} Parameter
4260@cindex browsable_dirs Parameter
4261
4262(type=string, default=@samp{no}).  If @samp{yes}, then @i{Amd}'s top-level
4263mount points will be browsable to @b{readdir}(3) calls.  This means you
4264could run for example @b{ls}(1) and see what keys are available to mount
4265in that directory.  Not all entries are made visible to @b{readdir}(3):
4266the @samp{/defaults} entry, wildcard entries, and those with a @file{/}
4267in them are not included.  If you specify @samp{full} to this option,
4268all but the @samp{/defaults} entry will be visible.  Note that if you run
4269a command which will attempt to @b{stat}(2) the entries, such as often
4270done by @samp{ls -l} or @samp{ls -F}, @i{Amd} will attempt to mount
4271@i{every} entry in that map.  This is often called a ``mount storm''.
4272
4273Note that mount storms are mostly avoided by using autofs mounts
4274(@samp{mount_type = autofs}).
4275
4276@c ----------------------------------------------------------------
4277@node map_defaults Parameter, map_options Parameter, browsable_dirs Parameter, Common Parameters
4278@comment  node-name,  next,  previous,  up
4279@subsection @t{map_defaults} Parameter
4280@cindex map_defaults Parameter
4281
4282(type=string, default to empty).  This option sets a string to be used
4283as the map's @code{/defaults} entry, overriding any @code{/defaults}
4284specified in the map.  This allows local users to override a given
4285map's defaults without modifying maps globally (which is impossible in
4286sites where the maps are managed by a different administrative group).
4287
4288@c ----------------------------------------------------------------
4289@node map_options Parameter, map_type Parameter, map_defaults Parameter, Common Parameters
4290@comment  node-name,  next,  previous,  up
4291@subsection @t{map_options} Parameter
4292@cindex map_options Parameter
4293
4294(type=string, default no options).  This option is the same as
4295specifying map options on the command line to @i{Amd}, such as
4296@samp{cache:=all}.
4297
4298@c ----------------------------------------------------------------
4299@node map_type Parameter, mount_type Parameter, map_options Parameter, Common Parameters
4300@comment  node-name,  next,  previous,  up
4301@subsection @t{map_type} Parameter
4302@cindex map_type Parameter
4303
4304(type=string, default search all map types).  If specified, @i{Amd} will
4305initialize the map only for the type given.  This is useful to avoid the
4306default map search type used by @i{Amd} which takes longer and can have
4307undesired side-effects such as initializing NIS even if not used.
4308Possible values are
4309
4310@table @samp
4311@item file
4312plain files
4313@item hesiod
4314Hesiod name service from MIT
4315@item ldap
4316Lightweight Directory Access Protocol
4317@item ndbm
4318(New) dbm style hash files
4319@item nis
4320Network Information Services (version 2)
4321@item nisplus
4322Network Information Services Plus (version 3)
4323@item passwd
4324local password files
4325@item union
4326union maps
4327@end table
4328
4329@c ----------------------------------------------------------------
4330@node mount_type Parameter, search_path Parameter, map_type Parameter, Common Parameters
4331@comment  node-name,  next,  previous,  up
4332@subsection @t{mount_type} Parameter
4333@cindex mount_type Parameter
4334
4335(type=string, default=@samp{nfs}).  All @i{Amd} mount types default to NFS.
4336That is, @i{Amd} is an NFS server on the map mount points, for the local
4337host it is running on.  If @samp{autofs} is specified, @i{Amd} will be
4338an autofs server for those mount points.
4339
4340@c ----------------------------------------------------------------
4341@node search_path Parameter, selectors_in_defaults Parameter, mount_type Parameter, Common Parameters
4342@comment  node-name,  next,  previous,  up
4343@subsection @t{search_path} Parameter
4344@cindex search_path Parameter
4345
4346(type=string, default no search path).  This provides a
4347(colon-delimited) search path for file maps.  Using a search path,
4348sites can allow for local map customizations and overrides, and can
4349distributed maps in several locations as needed.
4350
4351@c ----------------------------------------------------------------
4352@node selectors_in_defaults Parameter, sun_map_syntax Parameter, search_path Parameter, Common Parameters
4353@comment  node-name,  next,  previous,  up
4354@subsection @t{selectors_in_defaults} Parameter
4355@cindex selectors_in_defaults Parameter
4356
4357(type=boolean, default=@samp{no}).  If @samp{yes}, then the
4358@samp{/defaults} entry of maps will search for and process any
4359selectors before setting defaults for all other keys in that map.
4360Useful when you want to set different options for a complete map based
4361on some parameters.  For example, you may want to better the NFS
4362performance over slow slip-based networks as follows:
4363
4364@example
4365/defaults \
4366    wire==slip-net;opts:=intr,rsize=1024,wsize=1024 \
4367    wire!=slip-net;opts:=intr,rsize=8192,wsize=8192
4368@end example
4369
4370Deprecated form: selectors_on_default.
4371
4372@c ----------------------------------------------------------------
4373@node sun_map_syntax Parameter, , selectors_in_defaults Parameter, Common Parameters
4374@comment  node-name,  next,  previous,  up
4375@subsection @t{sun_map_syntax} Parameter
4376@cindex sun_map_syntax Parameter
4377
4378(type=boolean, default=@samp{no}).  If @samp{yes}, then @i{Amd} will
4379parse the map according to the Sun Automount syntax.
4380
4381
4382@c ================================================================
4383@node Global Parameters, Regular Map Parameters, Common Parameters, Amd Configuration File
4384@comment  node-name,  next,  previous,  up
4385@section Global Parameters
4386@cindex amd.conf global parameters
4387
4388The following parameters are applicable to the @samp{[global]} section only.
4389
4390@menu
4391* arch Parameter::
4392* auto_attrcache Parameter::
4393* auto_dir Parameter::
4394* cache_duration Parameter::
4395* cluster Parameter::
4396* debug_mtab_file Parameter::
4397* debug_options Parameter::
4398* dismount_interval Parameter::
4399* domain_strip Parameter::
4400* exec_map_timeout Parameter::
4401* forced_unmounts Parameter::
4402* full_os Parameter::
4403* fully_qualified_hosts Parameter::
4404* hesiod_base Parameter::
4405* karch Parameter::
4406* ldap_base Parameter::
4407* ldap_cache_maxmem Parameter::
4408* ldap_cache_seconds Parameter::
4409* ldap_hostports Parameter::
4410* ldap_proto_version Parameter::
4411* local_domain Parameter::
4412* localhost_address Parameter::
4413* log_file Parameter::
4414* log_options Parameter::
4415* map_reload_interval Parameter::
4416* nfs_allow_any_interface Parameter::
4417* nfs_allow_insecure_port Parameter::
4418* nfs_proto Parameter::
4419* nfs_retransmit_counter Parameter::
4420* nfs_retransmit_counter_udp Parameter::
4421* nfs_retransmit_counter_tcp Parameter::
4422* nfs_retransmit_counter_toplvl Parameter::
4423* nfs_retry_interval Parameter::
4424* nfs_retry_interval_udp Parameter::
4425* nfs_retry_interval_tcp Parameter::
4426* nfs_retry_interval_toplvl Parameter::
4427* nfs_vers Parameter::
4428* nis_domain Parameter::
4429* normalize_hostnames Parameter::
4430* normalize_slashes Parameter::
4431* os Parameter::
4432* osver Parameter::
4433* pid_file Parameter::
4434* plock Parameter::
4435* portmap_program Parameter::
4436* preferred_amq_port Parameter::
4437* print_pid Parameter::
4438* print_version Parameter::
4439* restart_mounts Parameter::
4440* show_statfs_entries Parameter::
4441* truncate_log Parameter::
4442* unmount_on_exit Parameter::
4443* use_tcpwrappers Parameter::
4444* vendor Parameter::
4445@end menu
4446
4447@c ----------------------------------------------------------------
4448@node arch Parameter, auto_attrcache Parameter, Global Parameters, Global Parameters
4449@comment  node-name,  next,  previous,  up
4450@subsection @t{arch} Parameter
4451@cindex arch Parameter
4452
4453(type=string, default to compiled in value).  Same as the @code{-A}
4454option to @i{Amd}.  Allows you to override the value of the @i{arch}
4455@i{Amd} variable.
4456
4457@c ----------------------------------------------------------------
4458@node auto_attrcache Parameter, auto_dir Parameter, arch Parameter, Global Parameters
4459@comment  node-name,  next,  previous,  up
4460@subsection @t{auto_attrcache} Parameter
4461@cindex auto_attrcache Parameter
4462
4463(type=numeric, default=0).  Specify in seconds (or units of 0.1
4464seconds, depending on the OS), what is the (kernel-side) NFS attribute
4465cache timeout for @i{Amd}'s own automount points.  A value of 0 is
4466supposed to turn off attribute caching, meaning that @i{Amd} will be
4467consulted via a kernel-RPC each time someone stat()'s the mount point
4468(which could be abused as a denial-of-service attack).
4469
4470@emph{WARNING}: @i{Amd} depends on being able to turn off the NFS
4471attribute cache of the client OS.  If it cannot be turned off, then
4472users may get ESTALE errors or symlinks that point to the wrong
4473places.  This is more likely under heavy use of @i{Amd}, for example
4474if your system is experiencing frequent map changes or frequent
4475mounts/unmounts.  Therefore, under normal circumstances, this
4476parameter should remain set to 0, to ensure that the attribute cache
4477is indeed off.
4478
4479Unfortunately, some kernels (e.g., certain BSDs) don't have a way to
4480turn off the NFS attribute cache.  Setting this parameter to 0 is
4481supposed to turn off attribute caching entirely, but unfortunately it
4482does not; instead, the attribute cache is set to some internal
4483hard-coded default (usually anywhere from 5-30 seconds).  If you
4484suspect that your OS doesn't have a reliable way of turning off the
4485attribute cache, then it is better to set this parameter to the
4486smallest possible non-zero value (set @samp{auto_attrcache=1} in your
4487@code{amd.conf}).  This will not eliminate the problem, but reduce the
4488risk window somewhat.  The best solutions are (1) to use @i{Amd} in
4489Autofs mode, if it's supported in your OS, and (2) talk to your OS
4490vendor to support a true @samp{noac} flag.  See the
4491@uref{http://www.am-utils.org/docs/am-utils/attrcache.txt,README.attrcache}
4492document for more details.
4493
4494If you are able to turn off the attribute cache on your OS, alas,
4495@i{Amd}'s performance may degrade (when not using Autofs) because
4496every traversal of an automounter-controlled pathname will result in a
4497lookup request from the kernel to @i{Amd}.  Under heavy loads, for
4498example when using recursive tools like @samp{find}, @samp{rdist}, or
4499@samp{rsync}, this performance degradation can be noticeable.  There
4500are two possible solutions that some administrators have chosen to
4501improve performance:
4502
4503@enumerate
4504
4505@item
4506First, you can turn off unmounting using the @samp{nounmount} mount
4507option.  This will ensure that no @i{Amd} symlink could ever change,
4508thereby the kernel's attribute cache and @i{Amd} will always be in
4509sync.  However, this method will cause the number of mounts to keep
4510growing, even if some are no longer in use; this has the disadvantage
4511that your system could be more susceptible to hangs if even one of
4512those accumulating mounts hangs due to a downed server.
4513
4514@item
4515Second, you can turn on attribute caching carefully by setting a small
4516automounter attribute cache value (say, one second), and a relatively
4517large dismount interval (say, one hour).  (@xref{dismount_interval
4518Parameter}.)  For example, you can set this in your @code{amd.conf}:
4519
4520@example
4521[global]
4522auto_attrcache = 1
4523dismount_interval = 3600
4524@end example
4525
4526This has the benefit of using the kernel's attribute cache and thus
4527improving performance.  The disadvantage with this option is that the
4528window of vulnerability is not eliminated entirely: it is only made
4529smaller.
4530
4531@end enumerate
4532
4533@c ----------------------------------------------------------------
4534@node auto_dir Parameter, cache_duration Parameter, auto_attrcache Parameter, Global Parameters
4535@comment  node-name,  next,  previous,  up
4536@subsection @t{auto_dir} Parameter
4537@cindex auto_dir Parameter
4538
4539(type=string, default=@samp{/a}).  Same as the @code{-a} option to @i{Amd}.
4540This sets the private directory where @i{Amd} will create
4541sub-directories for its real mount points.
4542
4543@c ----------------------------------------------------------------
4544@node cache_duration Parameter, cluster Parameter, auto_dir Parameter, Global Parameters
4545@comment  node-name,  next,  previous,  up
4546@subsection @t{cache_duration} Parameter
4547@cindex cache_duration Parameter
4548
4549(type=numeric, default=300).  Same as the @code{-c} option to @i{Amd}.
4550Sets the duration in seconds that looked-up or mounted map entries
4551remain in the cache.
4552
4553@c ----------------------------------------------------------------
4554@node cluster Parameter, debug_mtab_file Parameter, cache_duration Parameter, Global Parameters
4555@comment  node-name,  next,  previous,  up
4556@subsection @t{cluster} Parameter
4557@cindex cluster Parameter
4558
4559(type=string, default no cluster).  Same as the @code{-C} option to
4560@i{Amd}.  Specifies the alternate HP-UX cluster to use.
4561
4562@c ----------------------------------------------------------------
4563@node debug_mtab_file Parameter, debug_options Parameter, cluster Parameter, Global Parameters
4564@comment  node-name,  next,  previous,  up
4565@subsection @t{debug_mtab_file} Parameter
4566@cindex debug_mtab_file Parameter
4567
4568(type=string, default="/tmp/mtab").  Path to mtab file that is used
4569by @i{Amd} to store a list of mounted file systems during debug-mtab mode.
4570This option only applies to systems that store mtab information on disk.
4571
4572@c ----------------------------------------------------------------
4573@node debug_options Parameter, dismount_interval Parameter, debug_mtab_file Parameter, Global Parameters
4574@comment  node-name,  next,  previous,  up
4575@subsection @t{debug_options} Parameter
4576@cindex debug_options Parameter
4577
4578(type=string, default no debug options).  Same as the @code{-D} option
4579to @i{Amd}.  Specify any debugging options for @i{Amd}.  Works only if
4580am-utils was configured for debugging using the @code{--enable-debug}
4581option.  The additional @samp{mem} option can be turned on via
4582@code{--enable-debug=mem}.  Otherwise debugging options are ignored.
4583Options are comma delimited, and can be preceded by the string
4584@samp{no} to negate their meaning.  You can get the list of supported
4585debugging and logging options by running @code{amd -H}.  Possible
4586values those listed for the -D option.  @xref{-D Option}.
4587
4588@c ----------------------------------------------------------------
4589@node dismount_interval Parameter, domain_strip Parameter, debug_options Parameter, Global Parameters
4590@comment  node-name,  next,  previous,  up
4591@subsection @t{dismount_interval} Parameter
4592@cindex dismount_interval Parameter
4593
4594(type=numeric, default=120).  Same as the @code{-w} option to
4595@i{Amd}.  Specify in seconds, the time between attempts to dismount file
4596systems that have exceeded their cached times.
4597
4598@c ----------------------------------------------------------------
4599@node domain_strip Parameter, exec_map_timeout Parameter, dismount_interval Parameter, Global Parameters
4600@comment  node-name,  next,  previous,  up
4601@subsection @t{domain_strip} Parameter
4602@cindex domain_strip Parameter
4603
4604(type=boolean, default=@samp{yes}).  If @samp{yes}, then the domain
4605name part referred to by @code{$@{rhost@}} is stripped off.  This is
4606useful to keep logs and smaller.  If @samp{no}, then the domain name
4607part is left changed.  This is useful when using multiple domains with
4608the same maps (as you may have hosts whose domain-stripped name is
4609identical).
4610
4611@c ----------------------------------------------------------------
4612@node exec_map_timeout Parameter, forced_unmounts Parameter, domain_strip Parameter, Global Parameters
4613@comment  node-name,  next,  previous,  up
4614@subsection @t{exec_map_timeout} Parameter
4615@cindex exec_map_timeout Parameter
4616
4617(type=numeric, default=10).  The timeout in seconds that @i{Amd} will
4618wait for an executable map program before an answer is returned from
4619that program (or script).  This value should be set to as small as
4620possible while still allowing normal replies to be returned before the
4621timer expires, because during the time that the executable map program
4622is queried, @i{Amd} is essentially waiting and is thus not responding
4623to any other queries.  @xref{Executable maps}.
4624
4625@c ----------------------------------------------------------------
4626@node forced_unmounts Parameter, full_os Parameter, exec_map_timeout Parameter, Global Parameters
4627@comment  node-name,  next,  previous,  up
4628@subsection @t{forced_unmounts} Parameter
4629@cindex forced_unmounts Parameter
4630
4631(type=boolean, default=@samp{no}).
4632Sometimes, mount points are hung due to unrecoverable conditions, such
4633as when NFS servers migrate, change their IP address, are down
4634permanently, or due to hardware failures, and more.  In this case,
4635attempting to unmount an existing mount point, or even just to
4636@b{stat}(2) it, results in one of three fatal errors: EIO, ESTALE, or
4637EBUSY.  At that point, @i{Amd} can do little to recover that hung
4638point (in fact, the OS cannot automatically recover either).  For that
4639reason, some OSs support special kinds of forced unmounts, which must
4640be used very carefully: they will force an unmount immediately (or
4641lazily on Linux), which could result in application data loss.
4642However, that may be the only way to recover the entire host (without
4643rebooting).  Once a hung mount point is forced out, @i{Amd} can then
4644re-mount a replacement one (if available), bringing a mostly-hung
4645system back to operation and avoiding a potentially costly reboot.
4646
4647If the @samp{forced_unmounts} option is set to @samp{yes}, and the
4648client OS supports forced or lazy unmounts, then @i{Amd} will attempt
4649to use them if it gets any of the three serious error conditions
4650listed above.  Note that @i{Amd} will force the unmount of mount
4651points that returned EBUSY only for @samp{type:=toplvl} mounts
4652(@pxref{Top-level Filesystem}): that is, @i{Amd}'s own mount points.
4653This is useful to recover from a previously hung @i{Amd}, and to
4654ensure that an existing @i{Amd} can shutdown cleanly even if some
4655processes are keeping its mount points busy (i.e., when a user's shell
4656process uses @code{cd} to set its CWD to @i{Amd}'s own mount point).
4657
4658If this option is set to @samp{no} (the default), then @i{Amd} will
4659not attempt this special recovery procedure.
4660
4661@c ----------------------------------------------------------------
4662@node full_os Parameter, fully_qualified_hosts Parameter, forced_unmounts Parameter, Global Parameters
4663@comment  node-name,  next,  previous,  up
4664@subsection @t{full_os} Parameter
4665@cindex full_os Parameter
4666
4667(type=string, default to compiled in value).  The full name of the
4668operating system, along with its version.  Allows you to override the
4669compiled-in full name and version of the operating system.  Useful when
4670the compiled-in name is not desired.  For example, the full operating
4671system name on linux comes up as @samp{linux}, but you can override it
4672to @samp{linux-2.2.5}.
4673
4674@c ----------------------------------------------------------------
4675@node fully_qualified_hosts Parameter, hesiod_base Parameter, full_os Parameter, Global Parameters
4676@comment  node-name,  next,  previous,  up
4677@subsection @t{fully_qualified_hosts} Parameter
4678@cindex fully_qualified_hosts Parameter
4679
4680(type=string, default=@samp{no}).  If @samp{yes}, @i{Amd} will perform RPC
4681authentication using fully-qualified host names.  This is necessary for
4682some systems, and especially when performing cross-domain mounting.  For
4683this function to work, the @i{Amd} variable @samp{$@{hostd@}} is used,
4684requiring that @samp{$@{domain@}} not be null.
4685
4686@c ----------------------------------------------------------------
4687@node hesiod_base Parameter, karch Parameter, fully_qualified_hosts Parameter, Global Parameters
4688@comment  node-name,  next,  previous,  up
4689@subsection @t{hesiod_base} Parameter
4690@cindex hesiod_base Parameter
4691
4692(type=string, default=@samp{automount}).  Specify the base name for
4693hesiod maps.
4694
4695@c ----------------------------------------------------------------
4696@node karch Parameter, ldap_base Parameter, hesiod_base Parameter, Global Parameters
4697@comment  node-name,  next,  previous,  up
4698@subsection @t{karch} Parameter
4699@cindex karch Parameter
4700
4701(type=string, default to karch of the system).  Same as the @code{-k}
4702option to @i{Amd}.  Allows you to override the kernel-architecture of
4703your system.  Useful for example on Sun (Sparc) machines, where you can
4704build one @i{Amd} binary, and run it on multiple machines, yet you want
4705each one to get the correct @i{karch} variable set (for example, sun4c,
4706sun4m, sun4u, etc.)  Note that if not specified, @i{Amd} will use
4707@b{uname}(2) to figure out the kernel architecture of the machine.
4708
4709@c ----------------------------------------------------------------
4710@node ldap_base Parameter, ldap_cache_maxmem Parameter, karch Parameter, Global Parameters
4711@comment  node-name,  next,  previous,  up
4712@subsection @t{ldap_base} Parameter
4713@cindex ldap_base Parameter
4714
4715(type=string, default not set).
4716Specify the base name for LDAP.  This often includes LDAP-specific
4717values such as country and organization.
4718
4719@c ----------------------------------------------------------------
4720@node ldap_cache_maxmem Parameter, ldap_cache_seconds Parameter, ldap_base Parameter, Global Parameters
4721@comment  node-name,  next,  previous,  up
4722@subsection @t{ldap_cache_maxmem} Parameter
4723@cindex ldap_cache_maxmem Parameter
4724
4725(type=numeric, default=131072).  Specify the maximum memory @i{Amd}
4726should use to cache LDAP entries.
4727
4728@c ----------------------------------------------------------------
4729@node ldap_cache_seconds Parameter, ldap_hostports Parameter, ldap_cache_maxmem Parameter, Global Parameters
4730@comment  node-name,  next,  previous,  up
4731@subsection @t{ldap_cache_seconds} Parameter
4732@cindex ldap_cache_seconds Parameter
4733
4734(type=numeric, default=0).  Specify the number of seconds to keep
4735entries in the cache.
4736
4737@c ----------------------------------------------------------------
4738@node ldap_hostports Parameter, ldap_proto_version Parameter, ldap_cache_seconds Parameter, Global Parameters
4739@comment  node-name,  next,  previous,  up
4740@subsection @t{ldap_hostports} Parameter
4741@cindex ldap_hostports Parameter
4742
4743(type=string, default not set).
4744Specify the LDAP host and port values.
4745
4746@c ----------------------------------------------------------------
4747@node ldap_proto_version Parameter, local_domain Parameter, ldap_hostports Parameter, Global Parameters
4748@comment  node-name,  next,  previous,  up
4749@subsection @t{ldap_proto_version} Parameter
4750@cindex ldap_proto_version Parameter
4751
4752(type=numeric, default=2).  Specify the LDAP protocol version to use.
4753With a value of 3 will use LDAPv3 protocol.
4754
4755@c ----------------------------------------------------------------
4756@node local_domain Parameter, localhost_address Parameter, ldap_proto_version Parameter, Global Parameters
4757@comment  node-name,  next,  previous,  up
4758@subsection @t{local_domain} Parameter
4759@cindex local_domain Parameter
4760
4761(type=string, default no sub-domain).  Same as the @code{-d} option
4762to @i{Amd}.  Specify the local domain name.  If this option is not given
4763the domain name is determined from the hostname, by removing the first
4764component of the fully-qualified host name.
4765
4766@c ----------------------------------------------------------------
4767@node localhost_address Parameter, log_file Parameter, local_domain Parameter, Global Parameters
4768@comment  node-name,  next,  previous,  up
4769@subsection @t{localhost_address} Parameter
4770@cindex localhost_address Parameter
4771
4772(type=string, default to localhost or 127.0.0.1).  Specify the name or
4773IP address for @i{Amd} to use when connecting the sockets for the
4774local NFS server and the RPC server.  This defaults to 127.0.0.1 or
4775whatever the host reports as its local address.  This parameter is
4776useful on hosts with multiple addresses where you want to force
4777@i{Amd} to connect to a specific address.
4778
4779@c ----------------------------------------------------------------
4780@node log_file Parameter, log_options Parameter, localhost_address Parameter, Global Parameters
4781@comment  node-name,  next,  previous,  up
4782@subsection @t{log_file} Parameter
4783@cindex log_file Parameter
4784
4785(type=string, default=@samp{stderr}).  Same as the @code{-l} option to
4786@i{Amd}.  Specify a file name to log @i{Amd} events to.
4787If the string @samp{/dev/stderr} is specified,
4788@i{Amd} will send its events to the standard error file descriptor.
4789
4790If the string @samp{syslog} is given, @i{Amd} will record its events
4791with the system logger @b{syslogd}(8).  If your system supports syslog
4792facilities, then the default facility used is @samp{LOG_DAEMON}.
4793
4794When using syslog, if you wish to change the facility, append its name
4795to the option name, delimited by a single colon.  For example, if it is
4796the string @samp{syslog:local7} then @i{Amd} will log messages via
4797@b{syslog}(3) using the @samp{LOG_LOCAL7} facility.  If the facility
4798name specified is not recognized, @i{Amd} will default to @samp{LOG_DAEMON}.
4799Note: while you can use any syslog facility available on your system, it
4800is generally a bad idea to use those reserved for other services such as
4801@samp{kern}, @samp{lpr}, @samp{cron}, etc.
4802
4803@c ----------------------------------------------------------------
4804@node log_options Parameter, map_reload_interval Parameter, log_file Parameter, Global Parameters
4805@comment  node-name,  next,  previous,  up
4806@subsection @t{log_options} Parameter
4807@cindex log_options Parameter
4808
4809(type=string, default=``defaults'').  Same as the @code{-x}
4810option to @i{Amd}.  Specify any logging options for @i{Amd}.  Options
4811are comma delimited, and can be preceded by the string @samp{no} to
4812negate their meaning.  The @samp{debug} logging option is only available
4813if am-utils was configured with @code{--enable-debug}.  You can get the
4814list of supported debugging options by running @code{amd -H}.  Possible
4815values are:
4816
4817@table @samp
4818@item all
4819all messages
4820@item defaults
4821an alias for "fatal,error,user,warning,info"
4822@item debug
4823debug messages
4824@item error
4825non-fatal system errors (cannot be turned off)
4826@item fatal
4827fatal errors (cannot be turned off)
4828@item info
4829information
4830@item map
4831map errors
4832@item stats
4833additional statistical information
4834@item user
4835non-fatal user errors
4836@item warn
4837warnings
4838@item warning
4839warnings
4840@end table
4841
4842@c ----------------------------------------------------------------
4843@node map_reload_interval Parameter, nfs_allow_any_interface Parameter, log_options Parameter, Global Parameters
4844@comment  node-name,  next,  previous,  up
4845@subsection @t{map_reload_interval} Parameter
4846@cindex map_reload_interval Parameter
4847
4848(type=numeric, default=3600).  The number of seconds that @i{Amd} will
4849wait before it checks to see if any maps have changed at their source
4850(NIS servers, LDAP servers, files, etc.).  @i{Amd} will reload only
4851those maps that have changed.
4852
4853@c ----------------------------------------------------------------
4854@node nfs_allow_any_interface Parameter, nfs_allow_insecure_port Parameter, map_reload_interval Parameter, Global Parameters
4855@comment  node-name,  next,  previous,  up
4856@subsection @t{nfs_allow_any_interface} Parameter
4857@cindex nfs_allow_any_interface Parameter
4858
4859(type=string, default=@samp{no}).  Normally @i{Amd} accepts local NFS
4860packets only from 127.0.0.1.  If this parameter is set to @samp{yes},
4861then @i{amd} will accept local NFS packets from any local interface;
4862this is useful on hosts that may have multiple interfaces where the
4863system is forced to send all outgoing packets (even those bound to the
4864same host) via an address other than 127.0.0.1.
4865
4866@c ----------------------------------------------------------------
4867@node nfs_allow_insecure_port Parameter, nfs_proto Parameter, nfs_allow_any_interface Parameter, Global Parameters
4868@comment  node-name,  next,  previous,  up
4869@subsection @t{nfs_allow_insecure_port} Parameter
4870@cindex nfs_allow_insecure_port Parameter
4871
4872(type=string, default=@samp{no}).  Normally @i{Amd} will refuse requests
4873coming from unprivileged ports (i.e., ports >= 1024 on Unix systems),
4874so that only privileged users and the kernel can send NFS requests to
4875it.  However, some kernels (certain versions of Darwin, MacOS X, and
4876Linux) have bugs that cause them to use unprivileged ports in certain
4877situations, which causes @i{Amd} to stop dead in its tracks.  This
4878parameter allows @i{Amd} to operate normally even on such systems, at the
4879expense of a slight decrease in the security of its operations.  If
4880you see messages like ``ignoring request from foo:1234, port not
4881reserved'' in your @i{Amd} log, try enabling this parameter and give it
4882another go.
4883
4884@c ----------------------------------------------------------------
4885@node nfs_proto Parameter, nfs_retransmit_counter Parameter, nfs_allow_insecure_port Parameter, Global Parameters
4886@comment  node-name,  next,  previous,  up
4887@subsection @t{nfs_proto} Parameter
4888@cindex nfs_proto Parameter
4889
4890(type=string, default to trying version tcp then udp).  By default,
4891@i{Amd} tries @code{tcp} and then @code{udp}.  This option forces the
4892overall NFS protocol used to TCP or UDP.  It overrides what is in the
4893@i{Amd} maps, and is useful when @i{Amd} is compiled with TCP support
4894in NFSv2/NFSv3 that may not be stable.  With this option you can turn
4895off the complete usage of TCP for NFS dynamically (without having to
4896recompile @i{Amd}), and use UDP only, until such time as TCP support
4897is desired again.
4898
4899@c ----------------------------------------------------------------
4900@node nfs_retransmit_counter Parameter, nfs_retransmit_counter_udp Parameter, nfs_proto Parameter, Global Parameters
4901@comment  node-name,  next,  previous,  up
4902@subsection @t{nfs_retransmit_counter} Parameter
4903@cindex nfs_retransmit_counter Parameter
4904
4905(type=numeric, default=11).  Same as the @i{retransmit} part of the
4906@code{-t} @i{timeout.retransmit} option to @i{Amd}.  Specifies the
4907number of NFS retransmissions that the kernel will use to communicate
4908with @i{Amd} using either UDP or TCP mounts.  @xref{-t Option}.
4909
4910@c ----------------------------------------------------------------
4911@node nfs_retransmit_counter_udp Parameter, nfs_retransmit_counter_tcp Parameter, nfs_retransmit_counter Parameter, Global Parameters
4912@comment  node-name,  next,  previous,  up
4913@subsection @t{nfs_retransmit_counter_udp} Parameter
4914@cindex nfs_retransmit_counter_udp Parameter
4915@cindex nfs_retransmit_counter Parameter
4916@cindex UDP
4917
4918(type=numeric, default=11).  Same as the @i{nfs_retransmit_counter}
4919parameter, but applied globally only to UDP mounts.
4920@xref{nfs_retransmit_counter Parameter}.
4921
4922@c ----------------------------------------------------------------
4923@node nfs_retransmit_counter_tcp Parameter, nfs_retransmit_counter_toplvl Parameter, nfs_retransmit_counter_udp Parameter, Global Parameters
4924@comment  node-name,  next,  previous,  up
4925@subsection @t{nfs_retransmit_counter_tcp} Parameter
4926@cindex nfs_retransmit_counter_tcp Parameter
4927@cindex nfs_retransmit_counter Parameter
4928@cindex TCP
4929
4930(type=numeric, default=11).  Same as the @i{nfs_retransmit_counter}
4931parameter, but applied globally only to TCP mounts.
4932@xref{nfs_retransmit_counter Parameter}.
4933
4934@c ----------------------------------------------------------------
4935@node nfs_retransmit_counter_toplvl Parameter, nfs_retry_interval Parameter, nfs_retransmit_counter_tcp Parameter, Global Parameters
4936@comment  node-name,  next,  previous,  up
4937@subsection @t{nfs_retransmit_counter_toplvl} Parameter
4938@cindex nfs_retransmit_counter_toplvl Parameter
4939@cindex nfs_retransmit_counter Parameter
4940@cindex UDP
4941
4942(type=numeric, default=11).  Same as the @i{nfs_retransmit_counter}
4943parameter, applied only for @i{Amd}'s top-level UDP mounts.  On some
4944systems it is useful to set this differently than the OS default, so
4945as to better tune @i{Amd}'s responsiveness under heavy scheduler
4946loads.  @xref{nfs_retransmit_counter Parameter}.
4947
4948@c ----------------------------------------------------------------
4949@node nfs_retry_interval Parameter, nfs_retry_interval_udp Parameter, nfs_retransmit_counter_toplvl Parameter, Global Parameters
4950@comment  node-name,  next,  previous,  up
4951@subsection @t{nfs_retry_interval} Parameter
4952@cindex nfs_retry_interval Parameter
4953
4954(type=numeric, default=8).  Same as the @i{timeout} part of the
4955@code{-t} @i{timeout.retransmit} option to @i{Amd}.  Specifies the NFS
4956timeout interval, in @emph{tenths} of seconds, between NFS/RPC retries
4957(for UDP or TCP).  This is the value that the kernel will use to
4958communicate with @i{Amd}.  @xref{-t Option}.
4959
4960@i{Amd} relies on the kernel RPC retransmit mechanism to trigger mount
4961retries.  The values of the @i{nfs_retransmit_counter} and the
4962@i{nfs_retry_interval} parameters change the overall retry interval.
4963Too long an interval gives poor interactive response; too short an
4964interval causes excessive retries.
4965
4966@c ----------------------------------------------------------------
4967@node nfs_retry_interval_udp Parameter, nfs_retry_interval_tcp Parameter, nfs_retry_interval Parameter, Global Parameters
4968@comment  node-name,  next,  previous,  up
4969@subsection @t{nfs_retry_interval_udp} Parameter
4970@cindex nfs_retry_interval_udp Parameter
4971@cindex nfs_retry_interval Parameter
4972@cindex UDP
4973
4974(type=numeric, default=8).  Same as the @i{nfs_retry_interval}
4975parameter, but applied globally only to UDP mounts.
4976@xref{nfs_retry_interval Parameter}.
4977
4978@c ----------------------------------------------------------------
4979@node nfs_retry_interval_tcp Parameter, nfs_retry_interval_toplvl Parameter, nfs_retry_interval_udp Parameter, Global Parameters
4980@comment  node-name,  next,  previous,  up
4981@subsection @t{nfs_retry_interval_tcp} Parameter
4982@cindex nfs_retry_interval_tcp Parameter
4983@cindex nfs_retry_interval Parameter
4984@cindex TCP
4985
4986(type=numeric, default=8).  Same as the @i{nfs_retry_interval}
4987parameter, but applied globally only to TCP mounts.
4988@xref{nfs_retry_interval Parameter}.
4989
4990@c ----------------------------------------------------------------
4991@node nfs_retry_interval_toplvl Parameter, nfs_vers Parameter, nfs_retry_interval_tcp Parameter, Global Parameters
4992@comment  node-name,  next,  previous,  up
4993@subsection @t{nfs_retry_interval_toplvl} Parameter
4994@cindex nfs_retry_interval_toplvl Parameter
4995@cindex nfs_retry_interval Parameter
4996@cindex UDP
4997
4998(type=numeric, default=8).  Same as the @i{nfs_retry_interval}
4999parameter, applied only for @i{Amd}'s top-level UDP mounts.  On some
5000systems it is useful to set this differently than the OS default, so
5001as to better tune @i{Amd}'s responsiveness under heavy scheduler
5002loads.  @xref{nfs_retry_interval Parameter}.
5003
5004@c ----------------------------------------------------------------
5005@node nfs_vers Parameter, nis_domain Parameter, nfs_retry_interval_toplvl Parameter, Global Parameters
5006@comment  node-name,  next,  previous,  up
5007@subsection @t{nfs_vers} Parameter
5008@cindex nfs_vers Parameter
5009
5010(type=numeric, default to trying version 3 then 2).  By default,
5011@i{Amd} tries version 3 and then version 2.  This option forces the
5012overall NFS protocol used to version 3 or 2.  It overrides what is in
5013the @i{Amd} maps, and is useful when @i{Amd} is compiled with NFSv3
5014support that may not be stable.  With this option you can turn off the
5015complete usage of NFSv3 dynamically (without having to recompile
5016@i{Amd}), and use NFSv2 only, until such time as NFSv3 support is
5017desired again.
5018
5019@c ----------------------------------------------------------------
5020@node nis_domain Parameter, normalize_hostnames Parameter, nfs_vers Parameter, Global Parameters
5021@comment  node-name,  next,  previous,  up
5022@subsection @t{nis_domain} Parameter
5023@cindex nis_domain Parameter
5024
5025(type=string, default to local NIS domain name).  Same as the
5026@code{-y} option to @i{Amd}.  Specify an alternative NIS domain from
5027which to fetch the NIS maps.  The default is the system domain name.
5028This option is ignored if NIS support is not available.
5029
5030@c ----------------------------------------------------------------
5031@node normalize_hostnames Parameter, normalize_slashes Parameter, nis_domain Parameter, Global Parameters
5032@comment  node-name,  next,  previous,  up
5033@subsection @t{normalize_hostnames} Parameter
5034@cindex normalize_hostnames Parameter
5035
5036(type=boolean, default=@samp{no}).  Same as the @code{-n} option to @i{Amd}.
5037If @samp{yes}, then the name referred to by @code{$@{rhost@}} is normalized
5038relative to the host database before being used.  The effect is to
5039translate aliases into ``official'' names.
5040
5041@c ----------------------------------------------------------------
5042@node normalize_slashes Parameter, os Parameter, normalize_hostnames Parameter, Global Parameters
5043@comment  node-name,  next,  previous,  up
5044@subsection @t{normalize_slashes} Parameter
5045@cindex normalize_slashes Parameter
5046
5047(type=boolean, default=@samp{yes}).  If @samp{yes} then amd will
5048condense all multiple @code{/} (slash) characters into one and remove
5049all trailing slashes.  If @samp{no}, then amd will not touch strings
5050that may contain repeated or trailing slashes.  The latter is
5051sometimes useful with SMB mounts, which often require multiple slash
5052characters in pathnames.
5053
5054@c ----------------------------------------------------------------
5055@node os Parameter, osver Parameter, normalize_slashes Parameter, Global Parameters
5056@comment  node-name,  next,  previous,  up
5057@subsection @t{os} Parameter
5058@cindex os Parameter
5059
5060(type=string, default to compiled in value).  Same as the @code{-O}
5061option to @i{Amd}.  Allows you to override the compiled-in name of the
5062operating system.  Useful when the built-in name is not desired for
5063backward compatibility reasons.  For example, if the built-in name is
5064@samp{sunos5}, you can override it to @samp{sos5}, and use older maps
5065which were written with the latter in mind.
5066
5067
5068@c ----------------------------------------------------------------
5069@node osver Parameter, pid_file Parameter, os Parameter, Global Parameters
5070@comment  node-name,  next,  previous,  up
5071@subsection @t{osver} Parameter
5072@cindex osver Parameter
5073
5074(type=string, default to compiled in value).  Same as the @code{-o}
5075option to @i{Amd}.  Allows you to override the compiled-in version
5076number of the operating system.  Useful when the built-in version is not
5077desired for backward compatibility reasons.  For example, if the build
5078in version is @samp{2.5.1}, you can override it to @samp{5.5.1}, and use
5079older maps that were written with the latter in mind.
5080
5081@c ----------------------------------------------------------------
5082@node pid_file Parameter, plock Parameter, osver Parameter, Global Parameters
5083@comment  node-name,  next,  previous,  up
5084@subsection @t{pid_file} Parameter
5085@cindex pid_file Parameter
5086
5087(type=string, default=@samp{/dev/stdout}).  Specify a file to store the process
5088ID of the running daemon into.  If not specified, @i{Amd} will print its
5089process id onto the standard output.  Useful for killing @i{Amd} after
5090it had run.  Note that the PID of a running @i{Amd} can also be
5091retrieved via @i{Amq} (@pxref{Amq -p option}).
5092
5093This file is used only if the @samp{print_pid} option is on
5094(@pxref{print_pid Parameter}).
5095
5096@c ----------------------------------------------------------------
5097@node plock Parameter, portmap_program Parameter, pid_file Parameter, Global Parameters
5098@comment  node-name,  next,  previous,  up
5099@subsection @t{plock} Parameter
5100@cindex plock Parameter
5101
5102(type=boolean, default=@samp{yes}).  Same as the @code{-S} option to @i{Amd}.
5103If @samp{yes}, lock the running executable pages of @i{Amd} into memory.
5104To improve @i{Amd}'s performance, systems that support the @b{plock}(3)
5105or @b{mlockall}(2)
5106call can lock the @i{Amd} process into memory.  This way there is less
5107chance the operating system will schedule, page out, and swap the
5108@i{Amd} process as needed.  This improves @i{Amd}'s performance, at the
5109cost of reserving the memory used by the @i{Amd} process (making it
5110unavailable for other processes).
5111
5112@c ----------------------------------------------------------------
5113@node portmap_program Parameter, preferred_amq_port Parameter, plock Parameter, Global Parameters
5114@comment  node-name,  next,  previous,  up
5115@subsection @t{portmap_program} Parameter
5116@cindex portmap_program Parameter
5117
5118(type=numeric, default=300019).  Specify an alternate Port-mapper RPC
5119program number, other than the official number.  This is useful when
5120running multiple @i{Amd} processes.  For example, you can run another
5121@i{Amd} in ``test'' mode, without affecting the primary @i{Amd} process
5122in any way.  For safety reasons, the alternate program numbers that can
5123be specified must be in the range 300019-300029, inclusive.  @i{Amq} has
5124an option @code{-P} which can be used to specify an alternate program
5125number of an @i{Amd} to contact.  In this way, amq can fully control any
5126number of @i{Amd} processes running on the same host.
5127
5128@c ----------------------------------------------------------------
5129@node preferred_amq_port Parameter, print_pid Parameter, portmap_program Parameter, Global Parameters
5130@comment  node-name,  next,  previous,  up
5131@subsection @t{preferred_amq_port} Parameter
5132@cindex preferred_amq_port Parameter
5133
5134(type=numeric, default=0).  Specify an alternate Port-mapper RPC port
5135number for @i{Amd}'s @i{Amq} service.  This is used for both UDP and
5136TCP.  Setting this value to 0 (or not defining it) will cause @i{Amd}
5137to select an arbitrary port number.  Setting the @i{Amq} RPC service
5138port to a specific number is useful in firewalled or NAT'ed
5139environments, where you need to know which port @i{Amd} will listen
5140on.
5141
5142@c ----------------------------------------------------------------
5143@node print_pid Parameter, print_version Parameter, preferred_amq_port Parameter, Global Parameters
5144@comment  node-name,  next,  previous,  up
5145@subsection @t{print_pid} Parameter
5146@cindex print_pid Parameter
5147
5148(type=boolean, default=@samp{no}).  Same as the @code{-p} option to @i{Amd}.
5149If @samp{yes}, @i{Amd} will print its process ID upon starting.
5150
5151@c ----------------------------------------------------------------
5152@node print_version Parameter, restart_mounts Parameter, print_pid Parameter, Global Parameters
5153@comment  node-name,  next,  previous,  up
5154@subsection @t{print_version} Parameter
5155@cindex print_version Parameter
5156
5157(type=boolean, default=@samp{no}).  Same as the @code{-v} option to @i{Amd},
5158but the version prints and @i{Amd} continues to run.  If @samp{yes}, @i{Amd}
5159will print its version information string, which includes some
5160configuration and compilation values.
5161
5162@c ----------------------------------------------------------------
5163@node restart_mounts Parameter, show_statfs_entries Parameter, print_version Parameter, Global Parameters
5164@comment  node-name,  next,  previous,  up
5165@subsection @t{restart_mounts} Parameter
5166@cindex restart_mounts Parameter
5167
5168(type=boolean, default=@samp{no}).  Same as the @code{-r} option to @i{Amd}.
5169If @samp{yes} @i{Amd} will scan the mount table to determine which file
5170systems are currently mounted.  Whenever one of these would have been
5171auto-mounted, @i{Amd} inherits it.
5172
5173@c ----------------------------------------------------------------
5174@node show_statfs_entries Parameter, truncate_log Parameter, restart_mounts Parameter, Global Parameters
5175@comment  node-name,  next,  previous,  up
5176@subsection @t{show_statfs_entries} Parameter
5177@cindex show_statfs_entries Parameter
5178
5179(type=boolean), default=@samp{no}).  If @samp{yes}, then all maps which are
5180browsable will also show the number of entries (keys) they have when
5181@b{df}(1) runs. (This is accomplished by returning non-zero values to
5182the @b{statfs}(2) system call).
5183
5184@c ----------------------------------------------------------------
5185@node truncate_log Parameter, unmount_on_exit Parameter, show_statfs_entries Parameter, Global Parameters
5186@comment  node-name,  next,  previous,  up
5187@subsection @t{truncate_log} Parameter
5188@cindex truncate_log Parameter
5189
5190(type=boolean), default=@samp{no}).  If @samp{yes}, then @i{Amd} will
5191truncate the log file (if it's a regular file) on startup.  This could
5192be useful when conducting extensive testing on @i{Amd} maps (or
5193@i{Amd} itself) and you don't want to see log data from a previous run
5194in the same file.
5195
5196@c ----------------------------------------------------------------
5197@node unmount_on_exit Parameter, use_tcpwrappers Parameter, truncate_log Parameter, Global Parameters
5198@comment  node-name,  next,  previous,  up
5199@subsection @t{unmount_on_exit} Parameter
5200@cindex unmount_on_exit Parameter
5201
5202(type=boolean, default=@samp{no}).  If @samp{yes}, then @i{Amd} will attempt
5203to unmount all file systems which it knows about.  Normally it leaves
5204all (esp. NFS) mounted file systems intact.  Note that @i{Amd} does not
5205know about file systems mounted before it starts up, unless the
5206@samp{restart_mounts} option is used (@pxref{restart_mounts Parameter}).
5207
5208@c ----------------------------------------------------------------
5209@node use_tcpwrappers Parameter, vendor Parameter, unmount_on_exit Parameter, Global Parameters
5210@comment  node-name,  next,  previous,  up
5211@subsection @t{use_tcpwrappers} Parameter
5212@cindex use_tcpwrappers Parameter
5213
5214(type=boolean), default=@samp{yes}).  If @samp{yes}, then amd will use
5215the tcpwrappers (tcpd/librwap) library (if available) to control
5216access to @i{Amd} via the @code{/etc/hosts.allow} and
5217@code{/etc/hosts.deny} files.  @i{Amd} will verify that the host
5218running @i{Amq} is authorized to connect.  The @code{amd} service name
5219must used in the @code{/etc/hosts.allow} and @code{/etc/hosts.deny}
5220files.  For example, to allow only localhost to connect to @i{Amd},
5221add this line to @code{/etc/hosts.allow}:
5222
5223@example
5224amd: localhost
5225@end example
5226
5227and this line to @code{/etc/hosts.deny}:
5228
5229@example
5230amd: ALL
5231@end example
5232
5233Consult the man pages for @b{hosts_access}(5) for more information on using
5234the tcpwrappers access-control library.
5235
5236Note that in particular, you should not configure your @code{hosts.allow}
5237file to spawn a command for @i{Amd}: that will cause @i{Amd} to not be able
5238to @code{waitpid} on the child process ID of any background un/mount that
5239@i{Amd} issued, resulting in a confused @i{Amd} that does not know what
5240happened to those background un/mount requests.
5241
5242@c ----------------------------------------------------------------
5243@node vendor Parameter, , use_tcpwrappers Parameter, Global Parameters
5244@comment  node-name,  next,  previous,  up
5245@subsection @t{vendor} Parameter
5246@cindex vendor Parameter
5247
5248(type=string, default to compiled in value).  The name of the vendor of
5249the operating system.  Overrides the compiled-in vendor name.  Useful
5250when the compiled-in name is not desired.  For example, most Intel based
5251systems set the vendor name to @samp{unknown}, but you can set it to
5252@samp{redhat}.
5253
5254@c ================================================================
5255@node Regular Map Parameters, amd.conf Examples, Global Parameters, Amd Configuration File
5256@comment  node-name,  next,  previous,  up
5257@section Regular Map Parameters
5258@cindex amd.conf regular map parameters
5259
5260The following parameters are applicable only to regular map sections.
5261
5262@menu
5263* map_name Parameter::
5264* tag Parameter::
5265@end menu
5266
5267@c ----------------------------------------------------------------
5268@node map_name Parameter, tag Parameter, Regular Map Parameters, Regular Map Parameters
5269@comment  node-name,  next,  previous,  up
5270@subsection map_name Parameter
5271@cindex map_name Parameter
5272
5273(type=string, must be specified).  Name of the map where the keys are
5274located.
5275
5276@c ----------------------------------------------------------------
5277@node tag Parameter, , map_name Parameter, Regular Map Parameters
5278@comment  node-name,  next,  previous,  up
5279@subsection tag Parameter
5280@cindex tag Parameter
5281
5282(type=string, default no tag).  Each map entry in the configuration file
5283can be tagged.  If no tag is specified, that map section will always be
5284processed by @i{Amd}.  If it is specified, then @i{Amd} will process the map
5285if the @code{-T} option was given to @i{Amd}, and the value given to that
5286command-line option matches that in the map section.
5287
5288@c ================================================================
5289@node amd.conf Examples, , Regular Map Parameters, Amd Configuration File
5290@comment  node-name,  next,  previous,  up
5291@section amd.conf Examples
5292@cindex amd.conf examples
5293
5294The following is the actual @code{amd.conf} file I used at the
5295Computer Science Department of Columbia University.
5296
5297@example
5298# GLOBAL OPTIONS SECTION
5299[ global ]
5300normalize_hostnames =    no
5301print_pid =              no
5302#pid_file =              /var/run/amd.pid
5303restart_mounts =         yes
5304#unmount_on_exit =       yes
5305auto_dir =               /n
5306log_file =               /var/log/amd
5307log_options =            all
5308#debug_options =         defaults
5309plock =                  no
5310selectors_in_defaults =  yes
5311# config.guess picks up "sunos5" and I don't want to edit my maps yet
5312os =                     sos5
5313# if you print_version after setting up "os", it will show it.
5314print_version =          no
5315map_type =               file
5316search_path =            /etc/amdmaps:/usr/lib/amd:/usr/local/AMD/lib
5317browsable_dirs =         yes
5318fully_qualified_hosts =  no
5319
5320# DEFINE AN AMD MOUNT POINT
5321[ /u ]
5322map_name =               amd.u
5323
5324[ /proj ]
5325map_name =               amd.proj
5326
5327[ /src ]
5328map_name =               amd.src
5329
5330[ /misc ]
5331map_name =               amd.misc
5332
5333[ /import ]
5334map_name =               amd.import
5335
5336[ /tftpboot/.amd ]
5337tag =                    tftpboot
5338map_name =               amd.tftpboot
5339@end example
5340
5341@c ################################################################
5342@node Run-time Administration, FSinfo, Amd Configuration File, Top
5343@comment  node-name,  next,  previous,  up
5344@chapter Run-time Administration
5345@cindex Run-time administration
5346@cindex Amq command
5347
5348@menu
5349* Starting Amd::
5350* Stopping Amd::
5351* Restarting Amd::
5352* Controlling Amd::
5353@end menu
5354
5355@node Starting Amd, Stopping Amd, Run-time Administration, Run-time Administration
5356@comment  node-name,  next,  previous,  up
5357@section Starting @i{Amd}
5358@cindex Starting Amd
5359@cindex Additions to /etc/rc.local
5360@cindex /etc/rc.local additions
5361@cindex ctl-amd
5362
5363@i{Amd} is best started from @samp{/etc/rc.local} on BSD systems, or
5364from the appropriate start-level script in @samp{/etc/init.d} on System V
5365systems.
5366
5367@example
5368if [ -f /usr/local/sbin/ctl-amd ]; then
5369    /usr/local/sbin/ctl-amd start; (echo -n ' amd') > /dev/console
5370fi
5371@end example
5372
5373@noindent
5374The shell script, @samp{ctl-amd} is used to start, stop, or restart
5375@i{Amd}.  It is a relatively generic script.  All options you want to
5376set should not be made in this script, but rather updated in the
5377@file{amd.conf} file. @xref{Amd Configuration File}.
5378
5379If you do not wish to use an @i{Amd} configuration file, you may start
5380@i{Amd} manually.  For example, getting the map entries via NIS:
5381
5382@example
5383amd -r -l /var/log/amd `ypcat -k auto.master`
5384@end example
5385
5386@node Stopping Amd, Restarting Amd, Starting Amd, Run-time Administration
5387@comment  node-name,  next,  previous,  up
5388@section Stopping @i{Amd}
5389@cindex Stopping Amd
5390@cindex SIGTERM signal
5391@cindex SIGINT signal
5392
5393@i{Amd} stops in response to two signals.
5394
5395@table @samp
5396@item SIGTERM
5397causes the top-level automount points to be unmounted and then @i{Amd}
5398to exit.  Any automounted filesystems are left mounted.  They can be
5399recovered by restarting @i{Amd} with the @code{-r} command line option.@refill
5400
5401@item SIGINT
5402causes @i{Amd} to attempt to unmount any filesystems which it has
5403automounted, in addition to the actions of @samp{SIGTERM}.  This signal
5404is primarily used for debugging.@refill
5405@end table
5406
5407Actions taken for other signals are undefined.
5408
5409The easiest and safest way to stop @i{Amd}, without having to find its
5410process ID by hand, is to use the @file{ctl-amd} script, as with:
5411
5412@example
5413ctl-amd stop
5414@end example
5415
5416@node Restarting Amd, Controlling Amd, Stopping Amd, Run-time Administration
5417@comment  node-name,  next,  previous,  up
5418@section Restarting @i{Amd}
5419@cindex Restarting Amd
5420@cindex Killing and starting Amd
5421
5422Before @i{Amd} can be started, it is vital to ensure that no other
5423@i{Amd} processes are managing any of the mount points, and that the
5424previous process(es) have terminated cleanly.  When a terminating signal
5425is set to @i{Amd}, the automounter does @emph{not} terminate right then.
5426Rather, it starts by unmounting all of its managed mount mounts in the
5427background, and then terminates.  It usually takes a few seconds for
5428this process to happen, but it can take an arbitrarily longer time.  If
5429two or more @i{Amd} processes attempt to manage the same mount point, it
5430usually will result in a system lockup.
5431
5432The easiest and safest way to restart @i{Amd}, without having to find
5433its process ID by hand, sending it the @samp{SIGTERM} signal, waiting for @i{Amd}
5434to die cleanly, and verifying so, is to use the @file{ctl-amd} script,
5435as with:
5436
5437@example
5438ctl-amd restart
5439@end example
5440
5441The script will locate the process ID of @i{Amd}, kill it, and wait for
5442it to die cleanly before starting a new instance of the automounter.
5443@file{ctl-amd} will wait for a total of 30 seconds for @i{Amd} to die,
5444and will check once every 5 seconds if it had.
5445
5446@node Controlling Amd, , Restarting Amd, Run-time Administration
5447@comment  node-name,  next,  previous,  up
5448@section Controlling @i{Amd}
5449@cindex Controlling Amd
5450@cindex Discovering what is going on at run-time
5451@cindex Listing currently mounted filesystems
5452
5453It is sometimes desirable or necessary to exercise external control
5454over some of @i{Amd}'s internal state.  To support this requirement,
5455@i{Amd} implements an RPC interface which is used by the @dfn{Amq} program.
5456A variety of information is available.
5457
5458@i{Amq} generally applies an operation, specified by a single letter option,
5459to a list of mount points.  The default operation is to obtain statistics
5460about each mount point.  This is similar to the output shown above
5461but includes information about the number and type of accesses to each
5462mount point.
5463
5464@menu
5465* Amq default::       Default command behavior.
5466* Amq -f option::     Flushing the map cache.
5467* Amq -h option::     Controlling a non-local host.
5468* Amq -H option::     Print help message.
5469* Amq -l option::     Controlling the log file.
5470* Amq -m option::     Obtaining mount statistics.
5471* Amq -p option::     Getting Amd's process ID.
5472* Amq -P option::     Contacting alternate Amd processes.
5473* Amq -s option::     Obtaining global statistics.
5474* Amq -T option::     Use TCP transport.
5475* Amq -U option::     Use UDP transport.
5476* Amq -u option::     Forcing volumes to time out.
5477* Amq -v option::     Version information.
5478* Amq -w option::     Print Amd current working directory.
5479* Other Amq options:: Three other special options.
5480@end menu
5481
5482@c ----------------------------------------------------------------
5483@node Amq default, Amq -f option, Controlling Amd, Controlling Amd
5484@comment  node-name,  next,  previous,  up
5485@subsection @i{Amq} default information
5486
5487With no arguments, @dfn{Amq} obtains a brief list of all existing
5488mounts created by @i{Amd}.  This is different from the list displayed by
5489@b{df}(1) since the latter only includes system mount points.
5490
5491@noindent
5492The output from this option includes the following information:
5493
5494@itemize @bullet
5495@item
5496the automount point,
5497@item
5498the filesystem type,
5499@item
5500the mount map or mount information,
5501@item
5502the internal, or system mount point.
5503@end itemize
5504
5505@noindent
5506For example:
5507
5508@example
5509/            root   "root"                    sky:(pid75)
5510/homes       toplvl /usr/local/etc/amd.homes  /homes
5511/home        toplvl /usr/local/etc/amd.home   /home
5512/homes/jsp   nfs    charm:/home/charm         /a/charm/home/charm/jsp
5513/homes/phjk  nfs    toytown:/home/toytown     /a/toytown/home/toytown/ai/phjk
5514@end example
5515
5516@noindent
5517If an argument is given then statistics for that volume name will
5518be output.  For example:
5519
5520@example
5521What         Uid   Getattr Lookup RdDir   RdLnk   Statfs Mounted@@
5522/homes       0     1196    512    22      0       30     90/09/14 12:32:55
5523/homes/jsp   0     0       0      0       1180    0      90/10/13 12:56:58
5524@end example
5525
5526@table @code
5527@item What
5528the volume name.
5529
5530@item Uid
5531ignored.
5532
5533@item Getattr
5534the count of NFS @dfn{getattr} requests on this node.  This should only be
5535non-zero for directory nodes.
5536
5537@item Lookup
5538the count of NFS @dfn{lookup} requests on this node.  This should only be
5539non-zero for directory nodes.
5540
5541@item RdDir
5542the count of NFS @dfn{readdir} requests on this node.  This should only
5543be non-zero for directory nodes.
5544
5545@item RdLnk
5546the count of NFS @dfn{readlink} requests on this node.  This should be
5547zero for directory nodes.
5548
5549@item Statfs
5550the count of NFS @dfn{statfs} requests on this node.  This should only
5551be non-zero for top-level automount points.
5552
5553@item Mounted@@
5554the date and time the volume name was first referenced.
5555@end table
5556
5557@c ----------------------------------------------------------------
5558@node Amq -f option, Amq -h option, Amq default, Controlling Amd
5559@comment  node-name,  next,  previous,  up
5560@subsection @i{Amq} @code{-f} option
5561@cindex Flushing the map cache
5562@cindex Map cache, flushing
5563
5564The @code{-f} option causes @i{Amd} to flush the internal mount map cache.
5565This is useful for example in Hesiod maps since @i{Amd} will not
5566automatically notice when they have been updated.  The map cache can
5567also be synchronized with the map source by using the @samp{sync} option
5568(@pxref{Automount Filesystem}).@refill
5569
5570@c ----------------------------------------------------------------
5571@node Amq -h option, Amq -H option, Amq -f option, Controlling Amd
5572@comment  node-name,  next,  previous,  up
5573@subsection @i{Amq} @code{-h} option
5574@cindex Querying an alternate host
5575
5576By default the local host is used.  In an HP-UX cluster the root server
5577is used since that is the only place in the cluster where @i{Amd} will
5578be running.  To query @i{Amd} on another host the @code{-h} option should
5579be used.
5580
5581@c ----------------------------------------------------------------
5582@node Amq -H option, Amq -l option, Amq -h option, Controlling Amd
5583@comment  node-name,  next,  previous,  up
5584@subsection @i{Amq} @code{-H} option
5585@cindex Displaying brief help
5586@cindex Help; showing from Amq
5587
5588Print a brief help and usage string.
5589
5590@c ----------------------------------------------------------------
5591@node Amq -l option, Amq -m option, Amq -H option, Controlling Amd
5592@comment  node-name,  next,  previous,  up
5593@subsection @i{Amq} @code{-l} option
5594@cindex Resetting the Amd log file
5595@cindex Setting the Amd log file via Amq
5596@cindex Log file, resetting
5597
5598Tell @i{Amd} to use @i{log_file} as the log file name.  For security
5599reasons, this @emph{must} be the same log file which @i{Amd} used when
5600started.  This option is therefore only useful to refresh @i{Amd}'s open
5601file handle on the log file, so that it can be rotated and compressed
5602via daily cron jobs.
5603
5604@c ----------------------------------------------------------------
5605@node Amq -m option, Amq -p option, Amq -l option, Controlling Amd
5606@comment  node-name,  next,  previous,  up
5607@subsection @i{Amq} @code{-m} option
5608
5609The @code{-m} option displays similar information about mounted
5610filesystems, rather than automount points.  The output includes the
5611following information:
5612
5613@itemize @bullet
5614@item
5615the mount information,
5616@item
5617the mount point,
5618@item
5619the filesystem type,
5620@item
5621the number of references to this filesystem,
5622@item
5623the server hostname,
5624@item
5625the state of the file server,
5626@item
5627any error which has occurred.
5628@end itemize
5629
5630For example:
5631
5632@example
5633"root"           truth:(pid602)     root   1 localhost is up
5634hesiod.home      /home              toplvl 1 localhost is up
5635hesiod.vol       /vol               toplvl 1 localhost is up
5636hesiod.homes     /homes             toplvl 1 localhost is up
5637amy:/home/amy    /a/amy/home/amy    nfs    5 amy is up
5638swan:/home/swan  /a/swan/home/swan  nfs    0 swan is up (Permission denied)
5639ex:/home/ex      /a/ex/home/ex      nfs    0 ex is down
5640@end example
5641
5642When the reference count is zero the filesystem is not mounted but
5643the mount point and server information is still being maintained
5644by @i{Amd}.
5645
5646@c ----------------------------------------------------------------
5647@ignore
5648@comment Retained for future consideration: from the description of the
5649@comment amq -M option removed in amd 6.0.5.
5650
5651A future release of @i{Amd} will include code to allow the @b{mount}(8)
5652command to mount automount points:
5653
5654@example
5655mount -t amd /vol hesiod.vol
5656@end example
5657
5658This will then allow @i{Amd} to be controlled from the standard system
5659filesystem mount list.
5660
5661@end ignore
5662
5663@c ----------------------------------------------------------------
5664@node Amq -p option, Amq -P option, Amq -m option, Controlling Amd
5665@comment  node-name,  next,  previous,  up
5666@subsection @i{Amq} @code{-p} option
5667@cindex Process ID; Amd
5668@cindex Amd's process ID
5669@cindex Amd's PID
5670@cindex PID; Amd
5671
5672Return the process ID of the remote or locally running @i{Amd}.  Useful
5673when you need to send a signal to the local @i{Amd} process, and would
5674rather not have to search through the process table.  This option is
5675used in the @file{ctl-amd} script.
5676
5677@c ----------------------------------------------------------------
5678@node Amq -P option, Amq -s option, Amq -p option, Controlling Amd
5679@comment  node-name,  next,  previous,  up
5680@subsection @i{Amq} @code{-P} option
5681@cindex Multiple Amd processes
5682@cindex Running multiple Amd
5683@cindex Debugging a new Amd configuration
5684@cindex RPC Program numbers; Amd
5685
5686Contact an alternate running @i{Amd} that had registered itself on a
5687different RPC @var{program_number} and apply all other operations to
5688that instance of the automounter.  This is useful when you run multiple
5689copies of @i{Amd}, and need to manage each one separately.  If not
5690specified, @i{Amq} will use the default program number for @i{Amd}, 300019.
5691For security reasons, the only alternate program numbers @i{Amd} can use
5692range from 300019 to 300029, inclusive.
5693
5694For example, to kill an alternate running @i{Amd}:
5695
5696@example
5697kill `amq -p -P 300020`
5698@end example
5699
5700@c ----------------------------------------------------------------
5701@node Amq -s option, Amq -T option, Amq -P option, Controlling Amd
5702@comment  node-name,  next,  previous,  up
5703@subsection @i{Amq} @code{-s} option
5704@cindex Global statistics
5705@cindex Statistics
5706
5707The @code{-s} option displays global statistics.  If any other options are specified
5708or any filesystems named then this option is ignored.  For example:
5709
5710@example
5711requests  stale     mount     mount     unmount
5712deferred  fhandles  ok        failed    failed
57131054      1         487       290       7017
5714@end example
5715
5716@table @samp
5717@item Deferred requests
5718are those for which an immediate reply could not be constructed.  For
5719example, this would happen if a background mount was required.
5720
5721@item Stale filehandles
5722counts the number of times the kernel passes a stale filehandle to @i{Amd}.
5723Large numbers indicate problems.
5724
5725@item Mount ok
5726counts the number of automounts which were successful.
5727
5728@item Mount failed
5729counts the number of automounts which failed.
5730
5731@item Unmount failed
5732counts the number of times a filesystem could not be unmounted.  Very
5733large numbers here indicate that the time between unmount attempts
5734should be increased.
5735@end table
5736
5737@c ----------------------------------------------------------------
5738@node Amq -T option, Amq -U option, Amq -s option, Controlling Amd
5739@comment  node-name,  next,  previous,  up
5740@subsection @i{Amq} @code{-T} option
5741@cindex Forcing Amq to use a TCP transport
5742@cindex TCP; using with Amq
5743
5744The @code{-T} option causes the @i{Amq} to contact @i{Amd} using the TCP
5745transport only (connection oriented).  Normally, @i{Amq} will use TCP
5746first, and if that failed, will try UDP.
5747
5748@c ----------------------------------------------------------------
5749@node Amq -U option, Amq -u option, Amq -T option, Controlling Amd
5750@comment  node-name,  next,  previous,  up
5751@subsection @i{Amq} @code{-U} option
5752@cindex Forcing Amq to use a UDP transport
5753@cindex UDP; using with Amq
5754
5755The @code{-U} option causes the @i{Amq} to contact @i{Amd} using the UDP
5756transport only (connectionless).  Normally, @i{Amq} will use TCP first,
5757and if that failed, will try UDP.
5758
5759@c ----------------------------------------------------------------
5760@node Amq -u option, Amq -v option, Amq -U option, Controlling Amd
5761@comment  node-name,  next,  previous,  up
5762@subsection @i{Amq} @code{-u} option
5763@cindex Forcing filesystem to time out
5764@cindex Unmounting a filesystem
5765
5766The @code{-u} option causes the time-to-live interval of the named mount
5767points to be expired, thus causing an unmount attempt.  This is the only
5768safe way to unmount an automounted filesystem.  It is not possible to
5769unmount a filesystem which has been mounted with the @samp{nounmount}
5770flag.
5771
5772@c The @code{-H} option informs @i{Amd} that the specified mount point
5773@c has hung - as if its keepalive timer had expired.
5774
5775@c ----------------------------------------------------------------
5776@node Amq -v option, Amq -w option, Amq -u option, Controlling Amd
5777@comment  node-name,  next,  previous,  up
5778@subsection @i{Amq} @code{-v} option
5779@cindex Version information at run-time
5780
5781The @code{-v} option displays the version of @i{Amd} in a similar way to
5782@i{Amd}'s @code{-v} option.
5783
5784@c ----------------------------------------------------------------
5785@node Amq -w option, Other Amq options, Amq -v option, Controlling Amd
5786@comment  node-name,  next,  previous,  up
5787@subsection @i{Amq} @code{-w} option
5788@cindex Getting real working directory
5789
5790The @code{-w} option translates a full pathname as returned by
5791@b{getpwd}(3) into a short @i{Amd} pathname that goes through its mount
5792points.  This option requires that @i{Amd} is running.
5793
5794@c ----------------------------------------------------------------
5795@node Other Amq options, , Amq -w option, Controlling Amd
5796@comment  node-name,  next,  previous,  up
5797@subsection Other @i{Amq} options
5798@cindex Logging options via Amq
5799@cindex Debugging options via Amq
5800
5801Two other operations are implemented.  These modify the state of @i{Amd}
5802as a whole, rather than any particular filesystem.  The @code{-x} and
5803@code{-D} options have exactly the same effect as @i{Amd}'s corresponding
5804command line options.
5805
5806When @i{Amd} receives the @code{-x} flag, it disallows turning off the
5807@samp{fatal} or @samp{error} flags.  Both are on by default.  They are
5808mandatory so that @i{Amd} could report important errors, including
5809errors relating to turning flags on/off.
5810
5811@c ################################################################
5812@node FSinfo, Hlfsd, Run-time Administration, Top
5813@comment  node-name,  next,  previous,  up
5814@chapter FSinfo
5815@cindex FSinfo
5816@cindex Filesystem info package
5817
5818XXX: this chapter should be reviewed by someone knowledgeable with
5819fsinfo.
5820
5821@menu
5822* FSinfo Overview::                 Introduction to FSinfo.
5823* Using FSinfo::                    Basic concepts.
5824* FSinfo Grammar::                  Language syntax, semantics and examples.
5825* FSinfo host definitions::         Defining a new host.
5826* FSinfo host attributes::          Definable host attributes.
5827* FSinfo filesystems::              Defining locally attached filesystems.
5828* FSinfo static mounts::            Defining additional static mounts.
5829* FSinfo automount definitions::
5830* FSinfo Command Line Options::
5831* FSinfo errors::
5832@end menu
5833
5834@node FSinfo Overview, Using FSinfo, FSinfo, FSinfo
5835@comment  node-name,  next,  previous,  up
5836@section @i{FSinfo} overview
5837@cindex FSinfo overview
5838
5839@i{FSinfo} is a filesystem management tool.  It has been designed to
5840work with @i{Amd} to help system administrators keep track of the ever
5841increasing filesystem namespace under their control.
5842
5843The purpose of @i{FSinfo} is to generate all the important standard
5844filesystem data files from a single set of input data.  Starting with a
5845single data source guarantees that all the generated files are
5846self-consistent.  One of the possible output data formats is a set of
5847@i{Amd} maps which can be used among the set of hosts described in the
5848input data.
5849
5850@i{FSinfo} implements a declarative language.  This language is
5851specifically designed for describing filesystem namespace and physical
5852layouts.  The basic declaration defines a mounted filesystem including
5853its device name, mount point, and all the volumes and access
5854permissions.  @i{FSinfo} reads this information and builds an internal
5855map of the entire network of hosts.  Using this map, many different data
5856formats can be produced including @file{/etc/fstab},
5857@file{/etc/exports}, @i{Amd} mount maps and
5858@file{/etc/bootparams}.@refill
5859
5860@node Using FSinfo, FSinfo Grammar, FSinfo Overview, FSinfo
5861@comment  node-name,  next,  previous,  up
5862@section Using @i{FSinfo}
5863@cindex Using FSinfo
5864
5865The basic strategy when using @i{FSinfo} is to gather all the
5866information about all disks on all machines into one set of
5867declarations.  For each machine being managed, the following data is
5868required:
5869
5870@itemize @bullet
5871@item
5872Hostname
5873@item
5874List of all filesystems and, optionally, their mount points.
5875@item
5876Names of volumes stored on each filesystem.
5877@item
5878NFS export information for each volume.
5879@item
5880The list of static filesystem mounts.
5881@end itemize
5882
5883The following information can also be entered into the same
5884configuration files so that all data can be kept in one place.
5885
5886@itemize @bullet
5887@item
5888List of network interfaces
5889@item
5890IP address of each interface
5891@item
5892Hardware address of each interface
5893@item
5894Dumpset to which each filesystem belongs
5895@item
5896and more @dots{}
5897@end itemize
5898
5899To generate @i{Amd} mount maps, the automount tree must also be defined
5900(@pxref{FSinfo automount definitions}).  This will have been designed at
5901the time the volume names were allocated.  Some volume names will not be
5902automounted, so @i{FSinfo} needs an explicit list of which volumes
5903should be automounted.@refill
5904
5905Hostnames are required at several places in the @i{FSinfo} language.  It
5906is important to stick to either fully qualified names or unqualified
5907names.  Using a mixture of the two will inevitably result in confusion.
5908
5909Sometimes volumes need to be referenced which are not defined in the set
5910of hosts being managed with @i{FSinfo}.  The required action is to add a
5911dummy set of definitions for the host and volume names required.  Since
5912the files generated for those particular hosts will not be used on them,
5913the exact values used is not critical.
5914
5915@node FSinfo Grammar, FSinfo host definitions, Using FSinfo, FSinfo
5916@comment  node-name,  next,  previous,  up
5917@section @i{FSinfo} grammar
5918@cindex FSinfo grammar
5919@cindex Grammar, FSinfo
5920
5921@i{FSinfo} has a relatively simple grammar.  Distinct syntactic
5922constructs exist for each of the different types of data, though they
5923share a common flavor.  Several conventions are used in the grammar
5924fragments below.
5925
5926The notation, @i{list(}@t{xxx}@i{)}, indicates a list of zero or more
5927@t{xxx}'s.  The notation, @i{opt(}@t{xxx}@i{)}, indicates zero or one
5928@t{xxx}.  Items in double quotes, @i{eg} @t{"host"}, represent input
5929tokens.  Items in angle brackets, @i{eg} @var{<hostname>}, represent
5930strings in the input.  Strings need not be in double quotes, except to
5931differentiate them from reserved words.  Quoted strings may include the
5932usual set of C ``@t{\}'' escape sequences with one exception: a
5933backslash-newline-whitespace sequence is squashed into a single space
5934character.  To defeat this feature, put a further backslash at the start
5935of the second line.
5936
5937At the outermost level of the grammar, the input consists of a
5938sequence of host and automount declarations.  These declarations are
5939all parsed before they are analyzed.  This means they can appear in
5940any order and cyclic host references are possible.
5941
5942@example
5943fsinfo      : @i{list(}fsinfo_attr@i{)} ;
5944
5945fsinfo_attr : host | automount ;
5946@end example
5947
5948@menu
5949* FSinfo host definitions::
5950* FSinfo automount definitions::
5951@end menu
5952
5953@node FSinfo host definitions, FSinfo host attributes, FSinfo Grammar, FSinfo
5954@comment  node-name,  next,  previous,  up
5955@section @i{FSinfo} host definitions
5956@cindex FSinfo host definitions
5957@cindex Defining a host, FSinfo
5958
5959A host declaration consists of three parts: a set of machine attribute
5960data, a list of filesystems physically attached to the machine, and a
5961list of additional statically mounted filesystems.
5962
5963@example
5964host        : "host" host_data @i{list(}filesystem@i{@i{)}} @i{list(}mount@i{@i{)}} ;
5965@end example
5966
5967Each host must be declared in this way exactly once.  Such things as the
5968hardware address, the architecture and operating system types and the
5969cluster name are all specified within the @dfn{host data}.
5970
5971All the disks the machine has should then be described in the @dfn{list
5972of filesystems}.  When describing disks, you can specify what
5973@dfn{volname} the disk/partition should have and all such entries are
5974built up into a dictionary which can then be used for building the
5975automounter maps.
5976
5977The @dfn{list of mounts} specifies all the filesystems that should be
5978statically mounted on the machine.
5979
5980@menu
5981* FSinfo host attributes::
5982* FSinfo filesystems::
5983* FSinfo static mounts::
5984@end menu
5985
5986@node FSinfo host attributes, FSinfo filesystems, FSinfo host definitions , FSinfo host definitions
5987@comment  node-name,  next,  previous,  up
5988@section @i{FSinfo} host attributes
5989@cindex FSinfo host attributes
5990@cindex Defining host attributes, FSinfo
5991
5992The host data, @dfn{host_data}, always includes the @dfn{hostname}.  In
5993addition, several other host attributes can be given.
5994
5995@example
5996host_data   : @var{<hostname>}
5997            | "@{" @i{list(}host_attrs@i{)} "@}" @var{<hostname>}
5998            ;
5999
6000host_attrs  : host_attr "=" @var{<string>}
6001            | netif
6002            ;
6003
6004host_attr   : "config"
6005            | "arch"
6006            | "os"
6007            | "cluster"
6008            ;
6009@end example
6010
6011The @dfn{hostname} is, typically, the fully qualified hostname of the
6012machine.
6013
6014Examples:
6015
6016@example
6017host dylan.doc.ic.ac.uk
6018
6019host @{
6020    os = hpux
6021    arch = hp300
6022@} dougal.doc.ic.ac.uk
6023@end example
6024
6025The options that can be given as host attributes are shown below.
6026
6027@menu
6028* FSinfo netif Option::         FSinfo host netif.
6029* FSinfo config Option::        FSinfo host config.
6030* FSinfo arch Option::          FSinfo host arch.
6031* FSinfo os Option::            FSinfo host os.
6032* FSinfo cluster Option::       FSinfo host cluster.
6033@end menu
6034
6035@node FSinfo netif Option, FSinfo config Option, , FSinfo host attributes
6036@comment  node-name,  next,  previous,  up
6037@subsection netif Option
6038
6039This defines the set of network interfaces configured on the machine.
6040The interface attributes collected by @i{FSinfo} are the IP address,
6041subnet mask and hardware address.  Multiple interfaces may be defined
6042for hosts with several interfaces by an entry for each interface.  The
6043values given are sanity checked, but are currently unused for anything
6044else.
6045
6046@example
6047netif       : "netif" @var{<string>} "@{" @i{list(}netif_attrs@i{)} "@}" ;
6048
6049netif_attrs : netif_attr "=" @var{<string>} ;
6050
6051netif_attr  : "inaddr" | "netmask" | "hwaddr" ;
6052@end example
6053
6054Examples:
6055
6056@example
6057netif ie0 @{
6058    inaddr  = 129.31.81.37
6059    netmask = 0xfffffe00
6060    hwaddr  = "08:00:20:01:a6:a5"
6061@}
6062
6063netif ec0 @{ @}
6064@end example
6065
6066@node FSinfo config Option, FSinfo arch Option, FSinfo netif Option, FSinfo host attributes
6067@comment  node-name,  next,  previous,  up
6068@subsection config Option
6069@cindex FSinfo config host attribute
6070@cindex config, FSinfo host attribute
6071
6072This option allows you to specify configuration variables for the
6073startup scripts (@file{rc} scripts).  A simple string should immediately
6074follow the keyword.
6075
6076Example:
6077
6078@example
6079config "NFS_SERVER=true"
6080config "ZEPHYR=true"
6081@end example
6082
6083This option is currently unsupported.
6084
6085@node FSinfo arch Option, FSinfo os Option, FSinfo config Option, FSinfo host attributes
6086@comment  node-name,  next,  previous,  up
6087@subsection arch Option
6088@cindex FSinfo arch host attribute
6089@cindex arch, FSinfo host attribute
6090
6091This defines the architecture of the machine.  For example:
6092
6093@example
6094arch = hp300
6095@end example
6096
6097This is intended to be of use when building architecture specific
6098mountmaps, however, the option is currently unsupported.
6099
6100@node FSinfo os Option, FSinfo cluster Option, FSinfo arch Option, FSinfo host attributes
6101@comment  node-name,  next,  previous,  up
6102@subsection os Option
6103@cindex FSinfo os host attribute
6104@cindex os, FSinfo host attribute
6105
6106This defines the operating system type of the host.  For example:
6107
6108@example
6109os = hpux
6110@end example
6111
6112This information is used when creating the @file{fstab} files, for
6113example in choosing which format to use for the @file{fstab} entries
6114within the file.
6115
6116@node FSinfo cluster Option, , FSinfo os Option, FSinfo host attributes
6117@comment  node-name,  next,  previous,  up
6118@subsection cluster Option
6119@cindex FSinfo cluster host attribute
6120@cindex cluster, FSinfo host attribute
6121
6122This is used for specifying in which cluster the machine belongs.  For
6123example:
6124
6125@example
6126cluster = "theory"
6127@end example
6128
6129The cluster is intended to be used when generating the automount maps,
6130although it is currently unsupported.
6131
6132@node FSinfo filesystems, FSinfo static mounts, FSinfo host attributes, FSinfo host definitions
6133@comment  node-name,  next,  previous,  up
6134@section @i{FSinfo} filesystems
6135@cindex FSinfo filesystems
6136
6137The list of physically attached filesystems follows the machine
6138attributes.  These should define all the filesystems available from this
6139machine, whether exported or not.  In addition to the device name,
6140filesystems have several attributes, such as filesystem type, mount
6141options, and @samp{fsck} pass number which are needed to generate
6142@file{fstab} entries.
6143
6144@example
6145filesystem  : "fs" @var{<device>} "@{" @i{list(}fs_data@i{)} "@}" ;
6146
6147fs_data     : fs_data_attr "=" @var{<string>}
6148            | mount
6149            ;
6150
6151fs_data_attr
6152            : "fstype" | "opts" | "passno"
6153            | "freq" | "dumpset" | "log"
6154            ;
6155@end example
6156
6157Here, @var{<device>} is the device name of the disk (for example,
6158@file{/dev/dsk/2s0}).  The device name is used for building the mount
6159maps and for the @file{fstab} file.  The attributes that can be
6160specified are shown in the following section.
6161
6162The @i{FSinfo} configuration file for @code{dylan.doc.ic.ac.uk} is listed below.
6163
6164@example
6165host dylan.doc.ic.ac.uk
6166
6167fs /dev/dsk/0s0 @{
6168        fstype = swap
6169@}
6170
6171fs /dev/dsk/0s0 @{
6172        fstype = hfs
6173        opts = rw,noquota,grpid
6174        passno = 0;
6175        freq = 1;
6176        mount / @{ @}
6177@}
6178
6179fs /dev/dsk/1s0 @{
6180        fstype = hfs
6181        opts = defaults
6182        passno = 1;
6183        freq = 1;
6184        mount /usr @{
6185                local @{
6186                        exportfs "dougal eden dylan zebedee brian"
6187                        volname /nfs/hp300/local
6188                @}
6189        @}
6190@}
6191
6192fs /dev/dsk/2s0 @{
6193        fstype = hfs
6194        opts = defaults
6195        passno = 1;
6196        freq = 1;
6197        mount default @{
6198                exportfs "toytown_clients hangers_on"
6199                volname /home/dylan/dk2
6200        @}
6201@}
6202
6203fs /dev/dsk/3s0 @{
6204        fstype = hfs
6205        opts = defaults
6206        passno = 1;
6207        freq = 1;
6208        mount default @{
6209                exportfs "toytown_clients hangers_on"
6210                volname /home/dylan/dk3
6211        @}
6212@}
6213
6214fs /dev/dsk/5s0 @{
6215        fstype = hfs
6216        opts = defaults
6217        passno = 1;
6218        freq = 1;
6219        mount default @{
6220                exportfs "toytown_clients hangers_on"
6221                volname /home/dylan/dk5
6222        @}
6223@}
6224@end example
6225
6226@menu
6227* FSinfo fstype Option::        FSinfo filesystems fstype.
6228* FSinfo opts Option::          FSinfo filesystems opts.
6229* FSinfo passno Option::        FSinfo filesystems passno.
6230* FSinfo freq Option::          FSinfo filesystems freq.
6231* FSinfo mount Option::         FSinfo filesystems mount.
6232* FSinfo dumpset Option::       FSinfo filesystems dumpset.
6233* FSinfo log Option::           FSinfo filesystems log.
6234@end menu
6235
6236@node FSinfo fstype Option, FSinfo opts Option, , FSinfo filesystems
6237@comment  node-name,  next,  previous,  up
6238@subsection fstype Option
6239@cindex FSinfo fstype filesystems option
6240@cindex fstype, FSinfo filesystems option
6241@cindex export, FSinfo special fstype
6242
6243This specifies the type of filesystem being declared and will be placed
6244into the @file{fstab} file as is.  The value of this option will be
6245handed to @code{mount} as the filesystem type---it should have such
6246values as @code{4.2}, @code{nfs} or @code{swap}.  The value is not
6247examined for correctness.
6248
6249There is one special case.  If the filesystem type is specified as
6250@samp{export} then the filesystem information will not be added to the
6251host's @file{fstab} information, but it will still be visible on the
6252network.  This is useful for defining hosts which contain referenced
6253volumes but which are not under full control of @i{FSinfo}.
6254
6255Example:
6256
6257@example
6258fstype = swap
6259@end example
6260
6261@node FSinfo opts Option, FSinfo passno Option, FSinfo fstype Option, FSinfo filesystems
6262@comment  node-name,  next,  previous,  up
6263@subsection opts Option
6264@cindex FSinfo opts filesystems option
6265@cindex opts, FSinfo filesystems option
6266
6267This defines any options that should be given to @b{mount}(8) in the
6268@file{fstab} file.  For example:
6269
6270@example
6271opts = rw,nosuid,grpid
6272@end example
6273
6274@node FSinfo passno Option, FSinfo freq Option, FSinfo opts Option, FSinfo filesystems
6275@comment  node-name,  next,  previous,  up
6276@subsection passno Option
6277@cindex FSinfo passno filesystems option
6278@cindex passno, FSinfo filesystems option
6279
6280This defines the @b{fsck}(8) pass number in which to check the
6281filesystem.  This value will be placed into the @file{fstab} file.
6282
6283Example:
6284
6285@example
6286passno = 1
6287@end example
6288
6289@node FSinfo freq Option, FSinfo mount Option, FSinfo passno Option, FSinfo filesystems
6290@comment  node-name,  next,  previous,  up
6291@subsection freq Option
6292@cindex FSinfo freq filesystems option
6293@cindex freq, FSinfo filesystems option
6294
6295This defines the interval (in days) between dumps.  The value is placed
6296as is into the @file{fstab} file.
6297
6298Example:
6299
6300@example
6301freq = 3
6302@end example
6303
6304@node FSinfo mount Option, FSinfo dumpset Option, FSinfo freq Option, FSinfo filesystems
6305@comment  node-name,  next,  previous,  up
6306@subsection mount Option
6307@cindex FSinfo mount filesystems option
6308@cindex mount, FSinfo filesystems option
6309@cindex exportfs, FSinfo mount option
6310@cindex volname, FSinfo mount option
6311@cindex sel, FSinfo mount option
6312
6313This defines the mountpoint at which to place the filesystem.  If the
6314mountpoint of the filesystem is specified as @code{default}, then the
6315filesystem will be mounted in the automounter's tree under its volume
6316name and the mount will automatically be inherited by the automounter.
6317
6318Following the mountpoint, namespace information for the filesystem may
6319be described.  The options that can be given here are @code{exportfs},
6320@code{volname} and @code{sel}.
6321
6322The format is:
6323
6324@example
6325mount       : "mount" vol_tree ;
6326
6327vol_tree    : @i{list(}vol_tree_attr@i{)} ;
6328
6329vol_tree_attr
6330            :  @var{<string>} "@{" @i{list(}vol_tree_info@i{)} vol_tree "@}" ;
6331
6332vol_tree_info
6333            : "exportfs" @var{<export-data>}
6334            | "volname" @var{<volname>}
6335            | "sel" @var{<selector-list>}
6336            ;
6337@end example
6338
6339Example:
6340
6341@example
6342mount default @{
6343    exportfs "dylan dougal florence zebedee"
6344    volname /vol/andrew
6345@}
6346@end example
6347
6348In the above example, the filesystem currently being declared will have
6349an entry placed into the @file{exports} file allowing the filesystem to
6350be exported to the machines @code{dylan}, @code{dougal}, @code{florence}
6351and @code{zebedee}.  The volume name by which the filesystem will be
6352referred to remotely, is @file{/vol/andrew}.  By declaring the
6353mountpoint to be @code{default}, the filesystem will be mounted on the
6354local machine in the automounter tree, where @i{Amd} will automatically
6355inherit the mount as @file{/vol/andrew}.@refill
6356
6357@table @samp
6358@item exportfs
6359a string defining which machines the filesystem may be exported to.
6360This is copied, as is, into the @file{exports} file---no sanity checking
6361is performed on this string.@refill
6362
6363@item volname
6364a string which declares the remote name by which to reference the
6365filesystem.  The string is entered into a dictionary and allows you to
6366refer to this filesystem in other places by this volume name.@refill
6367
6368@item sel
6369a string which is placed into the automounter maps as a selector for the
6370filesystem.@refill
6371
6372@end table
6373
6374@node FSinfo dumpset Option, FSinfo log Option, FSinfo mount Option, FSinfo filesystems
6375@comment  node-name,  next,  previous,  up
6376@subsection dumpset Option
6377@cindex FSinfo dumpset filesystems option
6378@cindex dumpset, FSinfo filesystems option
6379
6380This provides support for Imperial College's local file backup tools and
6381is not documented further here.
6382
6383@node FSinfo log Option, , FSinfo dumpset Option, FSinfo filesystems
6384@comment  node-name,  next,  previous,  up
6385@subsection log Option
6386@cindex FSinfo log filesystems option
6387@cindex log, FSinfo filesystems option
6388
6389Specifies the log device for the current filesystem. This is ignored if
6390not required by the particular filesystem type.
6391
6392@node FSinfo static mounts, FSinfo automount definitions , FSinfo filesystems, FSinfo host definitions
6393@comment  node-name,  next,  previous,  up
6394@section @i{FSinfo} static mounts
6395@cindex FSinfo static mounts
6396@cindex Statically mounts filesystems, FSinfo
6397
6398Each host may also have a number of statically mounted filesystems.  For
6399example, the host may be a diskless workstation in which case it will
6400have no @code{fs} declarations.  In this case the @code{mount}
6401declaration is used to determine from where its filesystems will be
6402mounted.  In addition to being added to the @file{fstab} file, this
6403information can also be used to generate a suitable @file{bootparams}
6404file.@refill
6405
6406@example
6407mount       : "mount" @var{<volname>} @i{list(}localinfo@i{)} ;
6408
6409localinfo   : localinfo_attr @var{<string>} ;
6410
6411localinfo_attr
6412            : "as"
6413            | "from"
6414            | "fstype"
6415            | "opts"
6416            ;
6417@end example
6418
6419The filesystem specified to be mounted will be searched for in the
6420dictionary of volume names built when scanning the list of hosts'
6421definitions.
6422
6423The attributes have the following semantics:
6424@table @samp
6425@item from @var{machine}
6426mount the filesystem from the machine with the hostname of
6427@dfn{machine}.@refill
6428
6429@item as @var{mountpoint}
6430mount the filesystem locally as the name given, in case this is
6431different from the advertised volume name of the filesystem.
6432
6433@item opts @var{options}
6434native @b{mount}(8) options.
6435
6436@item fstype @var{type}
6437type of filesystem to be mounted.
6438@end table
6439
6440An example:
6441
6442@example
6443mount /export/exec/hp300/local as /usr/local
6444@end example
6445
6446If the mountpoint specified is either @file{/} or @file{swap}, the
6447machine will be considered to be booting off the net and this will be
6448noted for use in generating a @file{bootparams} file for the host which
6449owns the filesystems.
6450
6451@node FSinfo automount definitions, FSinfo Command Line Options, FSinfo static mounts, FSinfo
6452@comment  node-name,  next,  previous,  up
6453@section Defining an @i{Amd} Mount Map in @i{FSinfo}
6454@cindex FSinfo automount definitions
6455@cindex Defining an Amd mount map, FSinfo
6456
6457The maps used by @i{Amd} can be constructed from @i{FSinfo} by defining
6458all the automount trees.  @i{FSinfo} takes all the definitions found and
6459builds one map for each top level tree.
6460
6461The automount tree is usually defined last.  A single automount
6462configuration will usually apply to an entire management domain.  One
6463@code{automount} declaration is needed for each @i{Amd} automount point.
6464@i{FSinfo} determines whether the automount point is @dfn{direct}
6465(@pxref{Direct Automount Filesystem}) or @dfn{indirect}
6466(@pxref{Top-level Filesystem}).  Direct automount points are
6467distinguished by the fact that there is no underlying
6468@dfn{automount_tree}.@refill
6469
6470@example
6471automount   : "automount" @i{opt(}auto_opts@i{)} automount_tree ;
6472
6473auto_opts   : "opts" @var{<mount-options>} ;
6474
6475automount_tree
6476            : @i{list(}automount_attr@i{)}
6477            ;
6478
6479automount_attr
6480            : @var{<string>} "=" @var{<volname>}
6481            | @var{<string>} "->" @var{<symlink>}
6482            | @var{<string>} "@{" automount_tree "@}"
6483            ;
6484@end example
6485
6486If @var{<mount-options>} is given, then it is the string to be placed in
6487the maps for @i{Amd} for the @code{opts} option.
6488
6489A @dfn{map} is typically a tree of filesystems, for example @file{home}
6490normally contains a tree of filesystems representing other machines in
6491the network.
6492
6493A map can either be given as a name representing an already defined
6494volume name, or it can be a tree.  A tree is represented by placing
6495braces after the name.  For example, to define a tree @file{/vol}, the
6496following map would be defined:
6497
6498@example
6499automount /vol @{ @}
6500@end example
6501
6502Within a tree, the only items that can appear are more maps.
6503For example:
6504
6505@example
6506automount /vol @{
6507    andrew @{ @}
6508    X11 @{ @}
6509@}
6510@end example
6511
6512In this case, @i{FSinfo} will look for volumes named @file{/vol/andrew}
6513and @file{/vol/X11} and a map entry will be generated for each.  If the
6514volumes are defined more than once, then @i{FSinfo} will generate
6515a series of alternate entries for them in the maps.@refill
6516
6517Instead of a tree, either a link (@var{name} @code{->}
6518@var{destination}) or a reference can be specified (@var{name} @code{=}
6519@var{destination}).  A link creates a symbolic link to the string
6520specified, without further processing the entry.  A reference will
6521examine the destination filesystem and optimize the reference.  For
6522example, to create an entry for @code{njw} in the @file{/homes} map,
6523either of the two forms can be used:@refill
6524
6525@example
6526automount /homes @{
6527    njw -> /home/dylan/njw
6528@}
6529@end example
6530
6531or
6532
6533@example
6534automount /homes @{
6535    njw = /home/dylan/njw
6536@}
6537@end example
6538
6539In the first example, when @file{/homes/njw} is referenced from @i{Amd},
6540a link will be created leading to @file{/home/dylan/njw} and the
6541automounter will be referenced a second time to resolve this filename.
6542The map entry would be:
6543
6544@example
6545njw type:=link;fs:=/home/dylan/njw
6546@end example
6547
6548In the second example, the destination directory is analyzed and found
6549to be in the filesystem @file{/home/dylan} which has previously been
6550defined in the maps. Hence the map entry will look like:
6551
6552@example
6553njw rhost:=dylan;rfs:=/home/dylan;sublink:=njw
6554@end example
6555
6556Creating only one symbolic link, and one access to @i{Amd}.
6557
6558@node FSinfo Command Line Options, FSinfo errors, FSinfo automount definitions, FSinfo
6559@comment  node-name,  next,  previous,  up
6560@section @i{FSinfo} Command Line Options
6561@cindex FSinfo command line options
6562@cindex Command line options, FSinfo
6563
6564@i{FSinfo} is started from the command line by using the command:
6565
6566@example
6567fsinfo [@i{options}] @i{files} ...
6568@end example
6569
6570The input to @i{FSinfo} is a single set of definitions of machines and
6571automount maps.  If multiple files are given on the command-line, then
6572the files are concatenated together to form the input source.  The files
6573are passed individually through the C pre-processor before being parsed.
6574
6575Several options define a prefix for the name of an output file.  If the
6576prefix is not specified no output of that type is produced.  The suffix
6577used will correspond either to the hostname to which a file belongs, or
6578to the type of output if only one file is produced.  Dumpsets and the
6579@file{bootparams} file are in the latter class.  To put the output into
6580a subdirectory simply put a @file{/} at the end of the prefix, making
6581sure that the directory has already been made before running
6582@i{Fsinfo}.
6583
6584@menu
6585* -a FSinfo Option::    Amd automount directory:
6586* -b FSinfo Option::    Prefix for bootparams files.
6587* -d FSinfo Option::    Prefix for dumpset data files.
6588* -e FSinfo Option::    Prefix for exports files.
6589* -f FSinfo Option::    Prefix for fstab files.
6590* -h FSinfo Option::    Local hostname.
6591* -m FSinfo Option::    Prefix for automount maps.
6592* -q FSinfo Option::    Ultra quiet mode.
6593* -v FSinfo Option::    Verbose mode.
6594* -I FSinfo Option::    Define new #include directory.
6595* -D-FSinfo Option::    Define macro.
6596* -U FSinfo Option::    Undefine macro.
6597@end menu
6598
6599@node -a FSinfo Option, -b FSinfo Option, FSinfo Command Line Options, FSinfo Command Line Options
6600@comment  node-name,  next,  previous,  up
6601@subsection @code{-a} @var{autodir}
6602
6603Specifies the directory name in which to place the automounter's
6604mountpoints.  This defaults to @file{/a}.  Some sites have the autodir set
6605to be @file{/amd}, and this would be achieved by:
6606
6607@example
6608fsinfo -a /amd ...
6609@end example
6610
6611@node -b FSinfo Option, -d FSinfo Option, -a FSinfo Option, FSinfo Command Line Options
6612@comment  node-name,  next,  previous,  up
6613@subsection @code{-b} @var{bootparams}
6614@cindex bootparams, FSinfo prefix
6615
6616This specifies the prefix for the @file{bootparams} filename.  If it is
6617not given, then the file will not be generated.  The @file{bootparams}
6618file will be constructed for the destination machine and will be placed
6619into a file named @file{bootparams} and prefixed by this string.  The
6620file generated contains a list of entries describing each diskless
6621client that can boot from the destination machine.
6622
6623As an example, to create a @file{bootparams} file in the directory
6624@file{generic}, the following would be used:
6625
6626@example
6627fsinfo -b generic/ ...
6628@end example
6629
6630@node -d FSinfo Option, -e FSinfo Option, -b FSinfo Option, FSinfo Command Line Options
6631@comment  node-name,  next,  previous,  up
6632@subsection @code{-d} @var{dumpsets}
6633@cindex dumpset, FSinfo prefix
6634
6635This specifies the prefix for the @file{dumpsets} file.  If it is not
6636specified, then the file will not be generated.  The file will be for
6637the destination machine and will be placed into a filename
6638@file{dumpsets}, prefixed by this string.  The @file{dumpsets} file is
6639for use by Imperial College's local backup system.
6640
6641For example, to create a @file{dumpsets} file in the directory @file{generic},
6642then you would use the following:
6643
6644@example
6645fsinfo -d generic/ ...
6646@end example
6647
6648@node -e FSinfo Option, -f FSinfo Option, -d FSinfo Option, FSinfo Command Line Options
6649@comment  node-name,  next,  previous,  up
6650@subsection @code{-e} @var{exportfs}
6651@cindex exports, FSinfo prefix
6652
6653Defines the prefix for the @file{exports} files.  If it is not given,
6654then the file will not be generated.  For each machine defined in the
6655configuration files as having disks, an @file{exports} file is
6656constructed and given a filename determined by the name of the machine,
6657prefixed with this string.  If a machine is defined as diskless, then no
6658@file{exports} file will be created for it.  The files contain entries
6659for directories on the machine that may be exported to clients.
6660
6661Example: To create the @file{exports} files for each diskfull machine
6662and place them into the directory @file{exports}:
6663
6664@example
6665fsinfo -e exports/ ...
6666@end example
6667
6668@node -f FSinfo Option, -h FSinfo Option, -e FSinfo Option, FSinfo Command Line Options
6669@comment  node-name,  next,  previous,  up
6670@subsection @code{-f} @var{fstab}
6671@cindex fstab, FSinfo prefix
6672
6673This defines the prefix for the @file{fstab} files.  The files will only
6674be created if this prefix is defined.  For each machine defined in the
6675configuration files, a @file{fstab} file is created with the filename
6676determined by prefixing this string with the name of the machine.  These
6677files contain entries for filesystems and partitions to mount at boot
6678time.
6679
6680Example, to create the files in the directory @file{fstabs}:
6681
6682@example
6683fsinfo -f fstabs/ ...
6684@end example
6685
6686@node -h FSinfo Option, -m FSinfo Option, -f FSinfo Option, FSinfo Command Line Options
6687@comment  node-name,  next,  previous,  up
6688@subsection @code{-h} @var{hostname}
6689@cindex hostname, FSinfo command line option
6690
6691Defines the hostname of the destination machine to process for.  If this
6692is not specified, it defaults to the local machine name, as returned by
6693@b{gethostname}(2).
6694
6695Example:
6696
6697@example
6698fsinfo -h dylan.doc.ic.ac.uk ...
6699@end example
6700
6701@node -m FSinfo Option, -q FSinfo Option, -h FSinfo Option, FSinfo Command Line Options
6702@comment  node-name,  next,  previous,  up
6703@subsection @code{-m} @var{mount-maps}
6704@cindex maps, FSinfo command line option
6705
6706Defines the prefix for the automounter files.  The maps will only be
6707produced if this prefix is defined.  The mount maps suitable for the
6708network defined by the configuration files will be placed into files
6709with names calculated by prefixing this string to the name of each map.
6710
6711For example, to create the automounter maps and place them in the
6712directory @file{automaps}:
6713
6714@example
6715fsinfo -m automaps/ ...
6716@end example
6717
6718@node -q FSinfo Option, -v FSinfo Option, -m FSinfo Option, FSinfo Command Line Options
6719@comment  node-name,  next,  previous,  up
6720@subsection @code{-q}
6721@cindex quiet, FSinfo command line option
6722
6723Selects quiet mode.  @i{FSinfo} suppress the ``running commentary'' and
6724only outputs any error messages which are generated.
6725
6726@node -v FSinfo Option, -D-FSinfo Option, -q FSinfo Option, FSinfo Command Line Options
6727@comment  node-name,  next,  previous,  up
6728@subsection @code{-v}
6729@cindex verbose, FSinfo command line option
6730
6731Selects verbose mode.  When this is activated, the program will display
6732more messages, and display all the information discovered when
6733performing the semantic analysis phase.  Each verbose message is output
6734to @file{stdout} on a line starting with a @samp{#} character.
6735
6736@node -D-FSinfo Option, -I FSinfo Option, -v FSinfo Option, FSinfo Command Line Options
6737@comment  node-name,  next,  previous,  up
6738@subsection @code{-D} @var{name}@i{[=defn]}
6739
6740Defines a symbol @dfn{name} for the preprocessor when reading the
6741configuration files.  Equivalent to @code{#define} directive.
6742
6743@node -I FSinfo Option, -U FSinfo Option, -D-FSinfo Option, FSinfo Command Line Options
6744@comment  node-name,  next,  previous,  up
6745@subsection @code{-I} @var{directory}
6746
6747This option is passed into the preprocessor for the configuration files.
6748It specifies directories in which to find include files
6749
6750@node -U FSinfo Option, , -I FSinfo Option, FSinfo Command Line Options
6751@comment  node-name,  next,  previous,  up
6752@subsection @code{-U} @var{name}
6753
6754Removes any initial definition of the symbol @dfn{name}.  Inverse of the
6755@code{-D} option.
6756
6757@node FSinfo errors, , FSinfo Command Line Options, FSinfo
6758@comment  node-name,  next,  previous,  up
6759@section Errors produced by @i{FSinfo}
6760@cindex FSinfo error messages
6761
6762The following table documents the errors and warnings which @i{FSinfo} may produce.
6763
6764@table @t
6765
6766@item " expected
6767Occurs if an unescaped newline is found in a quoted string.
6768
6769@item ambiguous mount: @var{volume} is a replicated filesystem
6770If several filesystems are declared as having the same volume name, they
6771will be considered replicated filesystems.  To mount a replicated
6772filesystem statically, a specific host will need to be named, to say
6773which particular copy to try and mount, else this error will
6774result.
6775
6776@item can't open @var{filename} for writing
6777Occurs if any errors are encountered when opening an output file.
6778
6779@item cannot determine localname since volname @var{volume} is not uniquely defined
6780If a volume is replicated and an attempt is made to mount the filesystem
6781statically without specifying a local mountpoint, @i{FSinfo} cannot
6782calculate a mountpoint, as the desired pathname would be
6783ambiguous.
6784
6785@item @var{device} has duplicate exportfs data
6786Produced if the @samp{exportfs} option is used multiple times within the
6787same branch of a filesystem definition. For example, if you attempt to
6788set the @samp{exportfs} data at different levels of the mountpoint
6789directory tree.
6790
6791@item dump frequency for @var{host}:@var{device} is non-zero
6792Occurs if @var{device} has its @samp{fstype} declared to be @samp{swap}
6793or @samp{export} and the @samp{dump} option is set to a value greater
6794than zero.  Swap devices should not be dumped.
6795
6796@item duplicate host @var{hostname}!
6797If a host has more than one definition.
6798
6799@item end of file within comment
6800A comment was unterminated before the end of one of the configuration
6801files.
6802
6803@item @var{filename}: cannot open for reading
6804If a file specified on the command line as containing configuration data
6805could not be opened.
6806
6807@item @var{filesystem} has a volname but no exportfs data
6808Occurs when a volume name is declared for a file system, but the string
6809specifying what machines the filesystem can be exported to is
6810missing.
6811
6812@item fs field "@var{field-name}" already set
6813Occurs when multiple definitions are given for one of the attributes of a
6814host's filesystem.
6815
6816@item host field "@var{field-name}" already set
6817If duplicate definitions are given for any of the fields with a host
6818definition.
6819
6820@item @var{host}:@var{device} has more than one mount point
6821Occurs if the mount option for a host's filesystem specifies multiple
6822trees at which to place the mountpoint.
6823
6824@item @var{host}:@var{device} has no mount point
6825Occurs if the @samp{mount} option is not specified for a host's
6826filesystem.
6827
6828@item @var{host}:@var{device} needs field "@var{field-name}"
6829Occurs when a filesystem is missing a required field. @var{field-name} could
6830be one of @samp{fstype}, @samp{opts}, @samp{passno} or
6831@samp{mount}.
6832
6833@item @var{host}:mount field specified for swap partition
6834Occurs if a mountpoint is given for a filesystem whose type is declared
6835to be @samp{swap}.
6836
6837@item malformed IP dotted quad: @var{address}
6838If the Internet address of an interface is incorrectly specified.  An
6839Internet address definition is handled to @b{inet_addr}(3N) to see if it
6840can cope.  If not, then this message will be displayed.
6841
6842@item malformed netmask: @var{netmask}
6843If the netmask cannot be decoded as though it were a hexadecimal number,
6844then this message will be displayed.  It will typically be caused by
6845incorrect characters in the @var{netmask} value.
6846
6847@item mount field "@var{field-name}" already set
6848Occurs when a static mount has multiple definitions of the same field.
6849
6850@item mount tree field "@var{field-name}" already set
6851Occurs when the @var{field-name} is defined more than once during the
6852definition of a filesystems mountpoint.
6853
6854@item netif field @var{field-name} already set
6855Occurs if you attempt to define an attribute of an interface more than
6856once.
6857
6858@item network booting requires both root and swap areas
6859Occurs if a machine has mount declarations for either the root partition
6860or the swap area, but not both.  You cannot define a machine to only
6861partially boot via the network.
6862
6863@item no disk mounts on @var{hostname}
6864If there are no static mounts, nor local disk mounts specified for a
6865machine, this message will be displayed.
6866
6867@item no volname given for @var{host}:@var{device}
6868Occurs when a filesystem is defined to be mounted on @file{default}, but
6869no volume name is given for the file system, then the mountpoint cannot
6870be determined.
6871
6872@item not allowed '/' in a directory name
6873Occurs when a pathname with multiple directory elements is specified as
6874the name for an automounter tree.  A tree should only have one name at
6875each level.
6876
6877@item pass number for @var{host}:@var{device} is non-zero
6878Occurs if @var{device} has its @samp{fstype} declared to be @samp{swap}
6879or @samp{export} and the @b{fsck}(8) pass number is set. Swap devices
6880should not be fsck'd.  @xref{FSinfo fstype Option}.
6881
6882@item sub-directory @var{directory} of @var{directory-tree} starts with '/'
6883Within the filesystem specification for a host, if an element
6884@var{directory} of the mountpoint begins with a @samp{/} and it is not
6885the start of the tree.
6886
6887@item sub-directory of @var{directory-tree} is named "default"
6888@samp{default} is a keyword used to specify if a mountpoint should be
6889automatically calculated by @i{FSinfo}.  If you attempt to specify a
6890directory name as this, it will use the filename of @file{default} but
6891will produce this warning.
6892
6893@item unknown \ sequence
6894Occurs if an unknown escape sequence is found inside a string.  Within a
6895string, you can give the standard C escape sequences for strings, such
6896as newlines and tab characters.
6897
6898@item unknown directory attribute
6899If an unknown keyword is found while reading the definition of a host's
6900filesystem mount option.
6901
6902@item unknown filesystem attribute
6903Occurs if an unrecognized keyword is used when defining a host's
6904filesystems.
6905
6906@item unknown host attribute
6907Occurs if an unrecognized keyword is used when defining a host.
6908
6909@item unknown mount attribute
6910Occurs if an unrecognized keyword is found while parsing the list of
6911static mounts.
6912
6913@item unknown volname @var{volume} automounted @i{[} on @i{name} @i{]}
6914Occurs if @var{volume} is used in a definition of an automount map but the volume
6915name has not been declared during the host filesystem definitions.
6916
6917@item volname @var{volume} is unknown
6918Occurs if an attempt is made to mount or reference a volume name which
6919has not been declared during the host filesystem definitions.
6920
6921@item volname @var{volume} not exported from @var{machine}
6922Occurs if you attempt to mount the volume @var{volume} from a machine
6923which has not declared itself to have such a filesystem
6924available.
6925
6926@end table
6927
6928@c ################################################################
6929@node Hlfsd, Assorted Tools, FSinfo, Top
6930@comment  node-name,  next,  previous,  up
6931@chapter Hlfsd
6932@pindex Hlfsd
6933@cindex Home-Link Filesystem
6934
6935@i{Hlfsd} is a daemon which implements a filesystem containing a
6936symbolic link to subdirectory within a user's home directory, depending
6937on the user which accessed that link.  It was primarily designed to
6938redirect incoming mail to users' home directories, so that it can be read
6939from anywhere.  It was designed and implemented by
6940@uref{http://www.cs.sunysb.edu/~ezk,Erez Zadok} and
6941@email{dupuy AT cs.columbia.edu,Alexander Dupuy}, at the
6942@uref{http://www.cs.columbia.edu/,Computer Science Department} of
6943@uref{http://www.columbia.edu/,Columbia University}.  A
6944@uref{http://www.fsl.cs.sunysb.edu/docs/hlfsd/hlfsd.html,paper}
6945on @i{Hlfsd} was presented at the Usenix LISA VII conference in 1993.
6946
6947@i{Hlfsd} operates by mounting itself as an NFS server for the directory
6948containing @i{linkname}, which defaults to @file{/hlfs/home}.  Lookups
6949within that directory are handled by @i{Hlfsd}, which uses the
6950password map to determine how to resolve the lookup.  The directory will
6951be created if it doesn't already exist.  The symbolic link will be to
6952the accessing user's home directory, with @i{subdir} appended to it.  If
6953not specified, @i{subdir} defaults to @file{.hlfsdir}.  This directory
6954will also be created if it does not already exist.
6955
6956A @samp{SIGTERM} sent to @i{Hlfsd} will cause it to shutdown.  A
6957@samp{SIGHUP} will flush the internal caches, and reload the password
6958map.  It will also close and reopen the log file, to enable the original
6959log file to be removed or rotated.  A @samp{SIGUSR1} will cause it to
6960dump its internal table of user IDs and home directories to the file
6961@file{/tmp/hlfsddump}.
6962
6963@menu
6964* Introduction to Hlfsd::
6965* Background to Mail Delivery::
6966* Using Hlfsd::
6967@end menu
6968
6969@c ================================================================
6970@node Introduction to Hlfsd, Background to Mail Delivery, Hlfsd, Hlfsd
6971@comment  node-name,  next,  previous,  up
6972@section Introduction to Hlfsd
6973@cindex Introduction to Hlfsd
6974@cindex Hlfsd; introduction
6975
6976Electronic mail has become one of the major applications for many
6977computer networks, and use of this service is expected to increase over
6978time, as networks proliferate and become faster.  Providing a convenient
6979environment for users to read, compose, and send electronic mail has
6980become a requirement for systems administrators (SAs).
6981
6982Widely used methods for handling mail usually require users to be logged
6983into a designated ``home'' machine, where their mailbox files reside.
6984Only on that one machine can they read newly arrived mail.  Since users
6985have to be logged into that system to read their mail, they often find
6986it convenient to run all of their other processes on that system as
6987well, including memory and CPU-intensive jobs.  For example, in our
6988department, we have allocated and configured several multi-processor
6989servers to handle such demanding CPU/memory applications, but these were
6990underutilized, in large part due to the inconvenience of not being able
6991to read mail on those machines.  (No home directories were located on
6992these designated CPU-servers, since we did not want NFS service for
6993users' home directories to have to compete with CPU-intensive jobs.  At the
6994same time, we discouraged users from running demanding applications on
6995their home machines.)
6996
6997Many different solutions have been proposed to allow users to read their
6998mail on any host.  However, all of these solutions fail in one or more
6999of several ways:
7000
7001@itemize @bullet
7002
7003@item
7004they introduce new single points of failure
7005
7006@item
7007they require using different mail transfer agents (MTAs) or user agents
7008(UAs)
7009
7010@item
7011they do not solve the problem for all cases, i.e.  the solution is only
7012partially successful for a particular environment.
7013
7014@end itemize
7015
7016We have designed a simple filesystem, called the @dfn{Home-Link File
7017System}, to provide the ability to deliver mail to users' home
7018directories, without modification to mail-related applications. We have
7019endeavored to make it as stable as possible.  Of great importance to us
7020was to make sure the HLFS daemon, @file{hlfsd} , would not hang under
7021any circumstances, and would take the next-best action when faced with
7022problems.  Compared to alternative methods, @i{Hlfsd} is a stable, more
7023general solution, and easier to install/use.  In fact, in some ways, we
7024have even managed to improve the reliability and security of mail
7025service.
7026
7027Our server implements a small filesystem containing a symbolic link
7028to a subdirectory of the invoking user's home directory, and named symbolic
7029links to users' mailbox files.
7030
7031The @i{Hlfsd} server finds out the @var{uid} of the process that is
7032accessing its mount point, and resolves the pathname component @samp{home} as a
7033symbolic link to a subdirectory within the home directory given by the
7034@var{uid}'s entry in the password file.  If the @var{gid} of the process
7035that attempts to access a mailbox file is a special one (called
7036HLFS_GID), then the server maps the name of the @emph{next} pathname
7037component directly to the user's mailbox.  This is necessary so that
7038access to a mailbox file by users other than the owner can succeed.  The
7039server has safety features in case of failures such as hung filesystems
7040or home directory filesystems that are inaccessible or full.
7041
7042On most of our machines, mail gets delivered to the directory
7043@file{/var/spool/mail}. Many programs, including UAs, depend on that
7044path.  @i{Hlfsd} creates a directory @file{/mail}, and mounts itself on
7045top of that directory.  @i{Hlfsd} implements the path name component
7046called @samp{home}, pointing to a subdirectory of the user's home directory.
7047We have made @file{/var/spool/mail} a symbolic link to
7048@file{/mail/home}, so that accessing @file{/var/spool/mail} actually
7049causes access to a subdirectory within a user's home directory.
7050
7051The following table shows an example of how resolving the pathname
7052@file{/var/mail/@i{NAME}} to @file{/users/ezk/.mailspool/@i{NAME}} proceeds.
7053
7054@multitable {Resolving Component} {Pathname left to resolve} {Value if symbolic link}
7055
7056@item @b{Resolving Component}
7057@tab @b{Pathname left to resolve}
7058@tab @b{Value if symbolic link}
7059
7060@item @t{/}
7061@tab @t{var/mail/}@i{NAME}
7062
7063@item @t{var/}
7064@tab @t{mail/}@i{NAME}
7065
7066@item @t{mail}@@
7067@tab @t{/mail/home/}@i{NAME}
7068@tab @t{mail}@@ -> @t{/mail/home}
7069
7070@item @t{/}
7071@tab @t{mail/home/}@i{NAME}
7072
7073@item @t{mail/}
7074@tab @t{home/}@i{NAME}
7075
7076@item @t{home}@@
7077@tab @i{NAME}
7078@tab @t{home}@@ -> @t{/users/ezk/.mailspool}
7079
7080@item @t{/}
7081@tab @t{users/ezk/.mailspool/}@i{NAME}
7082
7083@item @t{users/}
7084@tab @t{ezk/.mailspool/}@i{NAME}
7085
7086@item @t{ezk/}
7087@tab @t{.mailspool/}@i{NAME}
7088
7089@item @t{.mailspool/}
7090@tab @i{NAME}
7091
7092@item @i{NAME}
7093
7094@end multitable
7095
7096@c ================================================================
7097@node Background to Mail Delivery, Using Hlfsd, Introduction to Hlfsd, Hlfsd
7098@comment  node-name,  next,  previous,  up
7099@section Background to Mail Delivery
7100@cindex Background to Mail Delivery
7101@cindex Hlfsd; background
7102
7103This section provides an in-depth discussion of why available methods
7104for delivering mail to home directories are not as good as the one used
7105by @i{Hlfsd}.
7106
7107@menu
7108* Single-Host Mail Spool Directory::
7109* Centralized Mail Spool Directory::
7110* Distributed Mail Spool Service::
7111* Why Deliver Into the Home Directory?::
7112@end menu
7113
7114@c ----------------------------------------------------------------
7115@node Single-Host Mail Spool Directory, Centralized Mail Spool Directory, Background to Mail Delivery, Background to Mail Delivery
7116@comment  node-name,  next,  previous,  up
7117@subsection Single-Host Mail Spool Directory
7118@cindex Single-Host Mail Spool Directory
7119
7120The most common method for mail delivery is for mail to be appended to a
7121mailbox file in a standard spool directory on the designated ``mail
7122home'' machine of the user. The greatest advantage of this method is
7123that it is the default method most vendors provide with their systems,
7124thus very little (if any) configuration is required on the SA's part.
7125All they need to set up are mail aliases directing mail to the host on
7126which the user's mailbox file is assigned.  (Otherwise, mail is
7127delivered locally, and users find mailboxes on many machines.)
7128
7129As users become more sophisticated, and aided by windowing systems, they
7130find themselves logging in on multiple hosts at once, performing several
7131tasks concurrently.  They ask to be able to read their mail on any host
7132on the network, not just the one designated as their ``mail home''.
7133
7134@c ----------------------------------------------------------------
7135@node Centralized Mail Spool Directory, Distributed Mail Spool Service, Single-Host Mail Spool Directory, Background to Mail Delivery
7136@comment  node-name,  next,  previous,  up
7137@subsection Centralized Mail Spool Directory
7138@cindex Centralized Mail Spool Directory
7139
7140A popular method for providing mail readability from any host is to have
7141all mail delivered to a mail spool directory on a designated
7142``mail-server'' which is exported via NFS to all of the hosts on the
7143network.  Configuring such a system is relatively easy.  On most
7144systems, the bulk of the work is a one-time addition to one or two
7145configuration files in @file{/etc}.  The file-server's spool directory
7146is then hard-mounted across every machine on the local network.  In
7147small environments with only a handful of hosts this can be an
7148acceptable solution.  In our department, with a couple of hundred active
7149hosts and thousands of mail messages processed daily, this was deemed
7150completely unacceptable, as it introduced several types of problems:
7151
7152@table @b
7153
7154@item Scalability and Performance
7155
7156As more and more machines get added to the network, more mail traffic
7157has to go over NFS to and from the mail-server. Users like to run
7158mail-watchers, and read their mail often. The stress on the shared
7159infrastructure increases with every user and host added; loads on the
7160mail server would most certainly be high since all mail delivery goes
7161through that one machine.@footnote{ Delivery via NFS-mounted filesystems
7162may require usage of @samp{rpc.lockd} and @samp{rpc.statd} to provide
7163distributed file-locking, both of which are widely regarded as unstable
7164and unreliable.  Furthermore, this will degrade performance, as local
7165processes as well as remote @samp{nfsd} processes are kept busy.}  This
7166leads to lower reliability and performance.  To reduce the number of
7167concurrent connections between clients and the server host, some SAs
7168have resorted to automounting the mail-spool directory.  But this
7169solution only makes things worse: since users often run mail watchers,
7170and many popular applications such as @samp{trn}, @samp{emacs},
7171@samp{csh} or @samp{ksh} check periodically for new mail, the
7172automounted directory would be effectively permanently mounted.  If it
7173gets unmounted automatically by the automounter program, it is most
7174likely to get mounted shortly afterwards, consuming more I/O resources
7175by the constant cycle of mount and umount calls.
7176
7177@item Reliability
7178
7179The mail-server host and its network connectivity must be very reliable.
7180Worse, since the spool directory has to be hard-mounted,@footnote{No SA
7181in their right minds would soft-mount read/write partitions --- the
7182chances for data loss are too great.} many processes which access the
7183spool directory (various shells, @samp{login}, @samp{emacs}, etc.)
7184would be hung as long as connectivity to the mail-server is severed. To
7185improve reliability, SAs may choose to backup the mail-server's spool
7186partition several times a day.  This may make things worse since reading
7187or delivering mail while backups are in progress may cause backups to be
7188inconsistent; more backups consume more backup-media resources, and
7189increase the load on the mail-server host.
7190
7191@end table
7192
7193@c ----------------------------------------------------------------
7194@node Distributed Mail Spool Service, Why Deliver Into the Home Directory?, Centralized Mail Spool Directory, Background to Mail Delivery
7195@comment  node-name,  next,  previous,  up
7196@subsection Distributed Mail Spool Service
7197@cindex Distributed Mail Spool Service
7198
7199Despite the existence of a few systems that support delivery to users'
7200home directories, mail delivery to home directories hasn't caught on.
7201We believe the main reason is that there are too many programs that
7202``know'' where mailbox files reside.  Besides the obvious (the delivery
7203program @file{/bin/mail} and mail readers like @file{/usr/ucb/Mail},
7204@samp{mush}, @samp{mm}, etc.), other programs that know mailbox location
7205are login, from, almost every shell, @samp{xbiff}, @samp{xmailbox}, and
7206even some programs not directly related to mail, such as @samp{emacs}
7207and @samp{trn}.  Although some of these programs can be configured to
7208look in different directories with the use of environment variables and
7209other resources, many of them cannot.  The overall porting work is
7210significant.
7211
7212Other methods that have yet to catch on require the use of a special
7213mail-reading server, such as IMAP or POP.  The main disadvantage of
7214these systems is that UAs need to be modified to use these services ---
7215a long and involved task.  That is why they are not popular at this
7216time.
7217
7218Several other ideas have been proposed and even used in various
7219environments.  None of them is robust.  They are mostly very
7220specialized, inflexible, and do not extend to the general case.  Some of
7221the ideas are plain bad, potentially leading to lost or corrupt mail:
7222
7223@table @b
7224
7225@item automounters
7226
7227Using an automounter such as @i{Amd} to provide a set of symbolic links
7228from the normal spool directory to user home directories is not
7229sufficient.  UAs rename, unlink, and recreate the mailbox as a regular
7230file, therefore it must be a real file, not a symbolic link.
7231Furthermore, it must reside in a real directory which is writable by the
7232UAs and MTAs.  This method may also require populating
7233@file{/var/spool/mail} with symbolic links and making sure they are
7234updated.  Making @i{Amd} manage that directory directly fails, since
7235many various lock files need to be managed as well.  Also, @i{Amd} does
7236not provide all of the NFS operations which are required to write mail
7237such as write, create, remove, and unlink.
7238
7239@item @code{$MAIL}
7240
7241Setting this variable to an automounted directory pointing to the user's
7242mail spool host only solves the problem for those programs which know
7243and use @code{$MAIL}.  Many programs don't, therefore this solution is partial
7244and of limited flexibility.  Also, it requires the SAs or the users to
7245set it themselves --- an added level of inconvenience and possible
7246failures.
7247
7248@item @t{/bin/mail}
7249
7250Using a different mail delivery agent could be the solution.  One such
7251example is @samp{hdmail}.  However, @samp{hdmail} still requires
7252modifying all UAs, the MTA's configuration, installing new daemons, and
7253changing login scripts.  This makes the system less upgradable or
7254compatible with others, and adds one more complicated system for SAs to
7255deal with.  It is not a complete solution because it still requires each
7256user have their @code{$MAIL} variable setup correctly, and that every program
7257use this variable.
7258
7259@end table
7260
7261@c ----------------------------------------------------------------
7262@node Why Deliver Into the Home Directory?, , Distributed Mail Spool Service, Background to Mail Delivery
7263@comment  node-name,  next,  previous,  up
7264@subsection Why Deliver Into the Home Directory?
7265@cindex Why Deliver Into the Home Directory?
7266@cindex Hlfsd; Why Deliver Into the Home Directory?
7267
7268There are several major reasons why SAs might want to deliver mail
7269directly into the users' home directories:
7270
7271@table @b
7272
7273@item Location
7274
7275Many mail readers need to move mail from the spool directory to the
7276user's home directory.  It speeds up this operation if the two are on
7277the same filesystem.  If for some reason the user's home directory is
7278inaccessible, it isn't that useful to be able to read mail, since there
7279is no place to move it to.  In some cases, trying to move mail to a
7280non-existent or hung filesystem may result in mail loss.
7281
7282@item Distribution
7283
7284Having all mail spool directories spread among the many more filesystems
7285minimizes the chances that complete environments will grind to a halt
7286when a single server is down.  It does increase the chance that there
7287will be someone who is not able to read their mail when a machine is
7288down, but that is usually preferred to having no one be able to read
7289their mail because a centralized mail server is down.  The problem of
7290losing some mail due to the (presumably) higher chances that a user's
7291machine is down is minimized in HLFS.
7292
7293@item Security
7294
7295Delivering mail to users' home directories has another advantage ---
7296enhanced security and privacy.  Since a shared system mail spool
7297directory has to be world-readable and searchable, any user can see
7298whether other users have mail, when they last received new mail, or when
7299they last read their mail.  Programs such as @samp{finger} display this
7300information, which some consider an infringement of privacy.  While it
7301is possible to disable this feature of @samp{finger} so that remote
7302users cannot see a mailbox file's status, this doesn't prevent local
7303users from getting the information.  Furthermore, there are more
7304programs which make use of this information.  In shared environments,
7305disabling such programs has to be done on a system-wide basis, but with
7306mail delivered to users' home directories, users less concerned with
7307privacy who do want to let others know when they last received or read
7308mail can easily do so using file protection bits.
7309
7310@c Lastly, on systems that do not export their NFS filesystem with
7311@c @t{anon=0}, superusers are less likely to snoop around others' mail, as
7312@c they become ``nobodies'' across NFS.
7313
7314@end table
7315
7316In summary, delivering mail to home directories provides users the
7317functionality sought, and also avoids most of the problems just
7318discussed.
7319
7320@c ================================================================
7321@node Using Hlfsd, , Background to Mail Delivery, Hlfsd
7322@comment  node-name,  next,  previous,  up
7323@section Using Hlfsd
7324@cindex Using Hlfsd
7325@cindex Hlfsd; using
7326
7327@menu
7328* Controlling Hlfsd::
7329* Hlfsd Options::
7330* Hlfsd Files::
7331@end menu
7332
7333@c ----------------------------------------------------------------
7334@node Controlling Hlfsd, Hlfsd Options, Using Hlfsd, Using Hlfsd
7335@comment  node-name,  next,  previous,  up
7336@subsection Controlling Hlfsd
7337@cindex Controlling Hlfsd
7338@cindex Hlfsd; controlling
7339@pindex ctl-hlfsd
7340
7341Much the same way @i{Amd} is controlled by @file{ctl-amd}, so does
7342@i{Hlfsd} get controlled by the @file{ctl-hlfsd} script:
7343
7344@table @t
7345
7346@item ctl-hlfsd start
7347Start a new @i{Hlfsd}.
7348
7349@item ctl-hlfsd stop
7350Stop a running @i{Hlfsd}.
7351
7352@item ctl-hlfsd restart
7353Stop a running @i{Hlfsd}, wait for 10 seconds, and then start a new
7354one.  It is hoped that within 10 seconds, the previously running
7355@i{Hlfsd} terminate properly; otherwise, starting a second one could
7356cause system lockup.
7357
7358@end table
7359
7360For example, on our systems, we start @i{Hlfsd} within @file{ctl-hlfsd}
7361as follows on Solaris 2 systems:
7362
7363@example
7364hlfsd -a /var/alt_mail -x all -l /var/log/hlfsd /mail/home .mailspool
7365@end example
7366
7367The directory @file{/var/alt_mail} is a directory in the root partition
7368where alternate mail will be delivered into, when it cannot be delivered
7369into the user's home directory.
7370
7371Normal mail gets delivered into @file{/var/mail}, but on our systems,
7372that is a symbolic link to @file{/mail/home}.  @file{/mail} is managed
7373by @i{Hlfsd}, which creates a dynamic symlink named @samp{home},
7374pointing to the subdirectory @file{.mailspool} @emph{within} the
7375accessing user's home directory.  This results in mail which normally
7376should go to @file{/var/mail/@code{$USER}}, to go to
7377@file{@code{$HOME}/.mailspool/@code{$USER}}.
7378
7379@i{Hlfsd} does not create the @file{/var/mail} symlink.  This needs to
7380be created (manually) once on each host, by the system administrators,
7381as follows:
7382
7383@example
7384mv /var/mail /var/alt_mail
7385ln -s /mail/home /var/mail
7386@end example
7387
7388@i{Hlfsd} also responds to the following signals:
7389
7390A @samp{SIGHUP} signal sent to @i{Hlfsd} will force it to reload the
7391password map immediately.
7392
7393A @samp{SIGUSR1} signal sent to @i{Hlfsd} will cause it to dump its
7394internal password map to the file @file{/usr/tmp/hlfsd.dump.XXXXXX},
7395where @samp{XXXXXX} will be replaced by a random string generated by
7396@b{mktemp}(3) or (the more secure) @b{mkstemp}(3).
7397
7398@c ----------------------------------------------------------------
7399@node Hlfsd Options, Hlfsd Files, Controlling Hlfsd, Using Hlfsd
7400@comment  node-name,  next,  previous,  up
7401@subsection Hlfsd Options
7402@cindex Hlfsd Options
7403@cindex Hlfsd; Options
7404
7405@table @t
7406
7407@item -a @var{alt_dir}
7408Alternate directory.  The name of the directory to which the symbolic
7409link returned by @i{Hlfsd} will point, if it cannot access the home
7410directory of the user.  This defaults to @file{/var/hlfs}.  This
7411directory will be created if it doesn't exist.  It is expected that
7412either users will read these files, or the system administrators will
7413run a script to resend this ``lost mail'' to its owner.
7414
7415@item -c @var{cache-interval}
7416Caching interval.  @i{Hlfsd} will cache the validity of home directories
7417for this interval, in seconds.  Entries which have been verified within
7418the last @var{cache-interval} seconds will not be verified again, since
7419the operation could be expensive, and the entries are most likely still
7420valid.  After the interval has expired, @i{Hlfsd} will re-verify the
7421validity of the user's home directory, and reset the cache time-counter.
7422The default value for @var{cache-interval} is 300 seconds (5 minutes).
7423
7424@item -f
7425Force fast startup.  This option tells @i{Hlfsd} to skip startup-time
7426consistency checks such as existence of mount directory, alternate spool
7427directory, symlink to be hidden under the mount directory, their
7428permissions and validity.
7429
7430@item -g @var{group}
7431Set the special group HLFS_GID to @var{group}.  Programs such as
7432@file{/usr/ucb/from} or @file{/usr/sbin/in.comsat}, which access the
7433mailboxes of other users, must be setgid @samp{HLFS_GID} to work properly.  The
7434default group is @samp{hlfs}.  If no group is provided, and there is no
7435group @samp{hlfs}, this feature is disabled.
7436
7437@item -h
7438Help.  Print a brief help message, and exit.
7439
7440@item -i @var{reload-interval}
7441Map-reloading interval.  Each @var{reload-interval} seconds, @i{Hlfsd}
7442will reload the password map.  @i{Hlfsd} needs the password map for the
7443UIDs and home directory pathnames.  @i{Hlfsd} schedules a @samp{SIGALRM} to
7444reload the password maps.  A @samp{SIGHUP} sent to @i{Hlfsd} will force it to
7445reload the maps immediately.  The default value for
7446@var{reload-interval} is 900 seconds (15 minutes.)
7447
7448@item -l @var{logfile}
7449Specify a log file to which @i{Hlfsd} will record events.  If
7450@var{logfile} is the string @samp{syslog} then the log messages will be
7451sent to the system log daemon by @b{syslog}(3), using the @samp{LOG_DAEMON}
7452facility.  This is also the default.
7453
7454@item -n
7455No verify.  @i{Hlfsd} will not verify the validity of the symbolic link
7456it will be returning, or that the user's home directory contains
7457sufficient disk-space for spooling.  This can speed up @i{Hlfsd} at the
7458cost of possibly returning symbolic links to home directories which are
7459not currently accessible or are full.  By default, @i{Hlfsd} validates
7460the symbolic-link in the background.  The @code{-n} option overrides the
7461meaning of the @code{-c} option, since no caching is necessary.
7462
7463@item -o @var{mount-options}
7464Mount options which @i{Hlfsd} will use to mount itself on top of
7465@var{dirname}.  By default, @var{mount-options} is set to @samp{ro}.  If
7466the system supports symbolic-link caching, default options are set
7467to @samp{ro,nocache}.
7468
7469@item -p
7470Print PID.  Outputs the process-id of @i{Hlfsd} to standard output where
7471it can be saved into a file.
7472
7473@item -v
7474Version.  Displays version information to standard error.
7475
7476@item -x @var{log-options}
7477Specify run-time logging options.  The options are a comma separated
7478list chosen from: @samp{fatal}, @samp{error}, @samp{user}, @samp{warn}, @samp{info}, @samp{map}, @samp{stats}, @samp{all}.
7479
7480@item -C
7481Force @i{Hlfsd} to run on systems that cannot turn off the NFS
7482attribute-cache.  Use of this option on those systems is discouraged, as
7483it may result in loss or misdelivery of mail.  The option is ignored on
7484systems that can turn off the attribute-cache.
7485
7486@item -D @var{log-options}
7487Select from a variety of debugging options.  Prefixing an option with
7488the string @samp{no} reverses the effect of that option.  Options are
7489cumulative.  The most useful option is @samp{all}.  Since this option is
7490only used for debugging other options are not documented here.  A fuller
7491description is available in the program source.
7492
7493@item -P @var{password-file}
7494Read the user-name, user-id, and home directory information from the
7495file @var{password-file}.  Normally, @i{Hlfsd} will use @b{getpwent}(3)
7496to read the password database.  This option allows you to override the
7497default database, and is useful if you want to map users' mail files to
7498a directory other than their home directory.  Only the username, uid,
7499and home-directory fields of the file @var{password-file} are read and
7500checked.  All other fields are ignored.  The file @var{password-file}
7501must otherwise be compliant with Unix Version 7 colon-delimited format
7502@b{passwd}(4).
7503
7504@end table
7505
7506@c ----------------------------------------------------------------
7507@node Hlfsd Files, , Hlfsd Options, Using Hlfsd
7508@comment  node-name,  next,  previous,  up
7509@subsection Hlfsd Files
7510@cindex Hlfsd Files
7511@cindex Hlfsd; Files
7512
7513The following files are used by @i{Hlfsd}:
7514
7515@table @file
7516
7517@item /hlfs
7518directory under which @i{Hlfsd} mounts itself and manages the symbolic
7519link @file{home}.
7520
7521@item .hlfsdir
7522default sub-directory in the user's home directory, to which the
7523@file{home} symbolic link returned by @i{Hlfsd} points.
7524
7525@item /var/hlfs
7526directory to which @file{home} symbolic link returned by @i{Hlfsd}
7527points if it is unable to verify the that user's home directory is
7528accessible.
7529
7530@item /usr/tmp/hlfsd.dump.XXXXXX
7531file to which @i{Hlfsd} will dump its internal password map when it
7532receives the @samp{SIGUSR1} signal. @samp{XXXXXX} will be replaced by
7533a random string generated by @b{mktemp}(3) or (the more secure)
7534@b{mkstemp}(3).
7535
7536@end table
7537
7538For discussion on other files used by @i{Hlfsd}, see @xref{lostaltmail}, and
7539@ref{lostaltmail.conf-sample}.
7540
7541@c ################################################################
7542@node Assorted Tools, Examples, Hlfsd, Top
7543@comment  node-name,  next,  previous,  up
7544@chapter Assorted Tools
7545@cindex  Assorted Tools
7546
7547The following are additional utilities and scripts included with
7548am-utils, and get installed.
7549
7550@menu
7551* am-eject::
7552* amd.conf-sample::
7553* amd2ldif::
7554* amd2sun::
7555* automount2amd::
7556* ctl-amd::
7557* ctl-hlfsd::
7558* expn::
7559* fix-amd-map::
7560* fixmount::
7561* fixrmtab::
7562* lostaltmail::
7563* lostaltmail.conf-sample::
7564* mk-amd-map::
7565* pawd::
7566* redhat-ctl-amd::
7567* wait4amd::
7568* wait4amd2die::
7569* wire-test::
7570@end menu
7571
7572@c ----------------------------------------------------------------
7573@node am-eject, amd.conf-sample, Assorted Tools, Assorted Tools
7574@comment  node-name,  next,  previous,  up
7575@section am-eject
7576@pindex am-eject
7577
7578A shell script unmounts a floppy or CD-ROM that is automounted, and
7579then attempts to eject the removable device.
7580
7581@c ----------------------------------------------------------------
7582@node amd.conf-sample, amd2ldif, am-eject, Assorted Tools
7583@comment  node-name,  next,  previous,  up
7584@section amd.conf-sample
7585@pindex amd.conf-sample
7586
7587A sample @i{Amd} configuration file. @xref{Amd Configuration File}.
7588
7589@c ----------------------------------------------------------------
7590@node amd2ldif, amd2sun, amd.conf-sample, Assorted Tools
7591@comment  node-name,  next,  previous,  up
7592@section amd2ldif
7593@pindex amd2ldif
7594
7595A script to convert @i{Amd} maps to LDAP input files.  Use it as follows:
7596
7597@example
7598amd2ldif @i{mapname} @i{base} < @i{amd.mapfile} > @i{mapfile.ldif}
7599@end example
7600
7601@c ----------------------------------------------------------------
7602@node amd2sun, automount2amd, amd2ldif, Assorted Tools
7603@comment  node-name,  next,  previous,  up
7604@section amd2sun
7605@pindex amd2sun
7606
7607A script to convert @i{Amd} maps to Sun Automounter maps.  Use it as
7608follows
7609
7610@example
7611amd2sun < @i{amd.mapfile} > @i{auto_mapfile}
7612@end example
7613
7614@c ----------------------------------------------------------------
7615@node automount2amd, ctl-amd, amd2sun, Assorted Tools
7616@comment  node-name,  next,  previous,  up
7617@section automount2amd
7618@pindex automount2amd
7619
7620A script to convert old Sun Automounter maps to @i{Amd} maps.
7621
7622Say you have the Sun automount file @i{auto.foo}, with these two lines:
7623@example
7624home                  earth:/home
7625moon  -ro,intr        server:/proj/images
7626@end example
7627Running
7628@example
7629automount2amd auto.foo > amd.foo
7630@end example
7631
7632will produce the @i{Amd} map @i{amd.foo} with this content:
7633
7634@example
7635# generated by automount2amd on Sat Aug 14 17:59:32 US/Eastern 1999
7636
7637/defaults \\
7638  type:=nfs;opts:=rw,grpid,nosuid,utimeout=600
7639
7640home \
7641  host==earth;type:=link;fs:=/home \\
7642  rhost:=earth;rfs:=/home
7643
7644moon \
7645  -addopts:=ro,intr \\
7646  host==server;type:=link;fs:=/proj/images \\
7647  rhost:=server;rfs:=/proj/images
7648@end example
7649
7650This perl script will use the following @i{/default} entry
7651@example
7652type:=nfs;opts:=rw,grpid,nosuid,utimeout=600
7653@end example
7654If you wish to override that, define the @b{$DEFAULTS} environment
7655variable, or modify the script.
7656
7657If you wish to generate Amd maps using the @i{hostd} (@pxref{hostd
7658Selector Variable}) @i{Amd} map syntax, then define the environment
7659variable @b{$DOMAIN} or modify the script.
7660
7661Note that automount2amd does not understand the syntax in newer Sun
7662Automount maps, those used with autofs.
7663
7664@c ----------------------------------------------------------------
7665@node ctl-amd, ctl-hlfsd, automount2amd, Assorted Tools
7666@comment  node-name,  next,  previous,  up
7667@section ctl-amd
7668@pindex ctl-amd
7669
7670A script to start, stop, or restart @i{Amd}.  Use it as follows:
7671
7672@table @t
7673@item ctl-amd start
7674Start a new @i{Amd} process.
7675@item ctl-amd stop
7676Stop the running @i{Amd}.
7677@item ctl-amd restart
7678Stop the running @i{Amd} (if any), safely wait for it to terminate, and
7679then start a new process --- only if the previous one died cleanly.
7680@end table
7681
7682@xref{Run-time Administration}, for more details.
7683
7684@c ----------------------------------------------------------------
7685@node ctl-hlfsd, expn, ctl-amd, Assorted Tools
7686@comment  node-name,  next,  previous,  up
7687@section ctl-hlfsd
7688@pindex ctl-hlfsd
7689
7690A script for controlling @i{Hlfsd}, much the same way @file{ctl-amd}
7691controls @i{Amd}.  Use it as follows:
7692
7693@table @t
7694@item ctl-hlfsd start
7695Start a new @i{Hlfsd} process.
7696@item ctl-hlfsd stop
7697Stop the running @i{Hlfsd}.
7698@item ctl-hlfsd restart
7699Stop the running @i{Hlfsd} (if any), wait for 10 seconds for it to
7700terminate, and then start a new process --- only if the previous one
7701died cleanly.
7702@end table
7703
7704@xref{Hlfsd}, for more details.
7705
7706@c ----------------------------------------------------------------
7707@node expn, fix-amd-map, ctl-hlfsd, Assorted Tools
7708@comment  node-name,  next,  previous,  up
7709@section expn
7710@pindex expn
7711
7712A script to expand email addresses into their full name.  It is
7713generally useful when using with the @file{lostaltmail} script, but is a
7714useful tools otherwise.
7715
7716@example
7717$ expn -v ezk@@example.com
7718ezk@@example.com ->
7719        ezk@@shekel.example.com
7720ezk@@shekel.example.com ->
7721        Erez Zadok <"| /usr/local/mh/lib/slocal -user ezk || exit 75>
7722        Erez Zadok <\ezk>
7723        Erez Zadok </u/zing/ezk/.mailspool/backup>
7724@end example
7725
7726@c ----------------------------------------------------------------
7727@node fix-amd-map, fixmount, expn, Assorted Tools
7728@comment  node-name,  next,  previous,  up
7729@section fix-amd-map
7730@pindex fix-amd-map
7731
7732Am-utils changed some of the syntax and default values of some
7733variables.  For example, the default value for @samp{$@{os@}} for
7734Solaris 2.x (aka SunOS 5.x) systems used to be @samp{sos5}, it is now
7735more automatically generated from @file{config.guess} and its value is
7736@samp{sunos5}.
7737
7738This script converts older @i{Amd} maps to new ones.  Use it as follows:
7739
7740@example
7741fix-amd-map < @i{old.map} > @i{new.map}
7742@end example
7743
7744@c ----------------------------------------------------------------
7745@node fixmount, fixrmtab, fix-amd-map, Assorted Tools
7746@comment  node-name,  next,  previous,  up
7747@section fixmount
7748@pindex fixmount
7749
7750@samp{fixmount} is a variant of @b{showmount}(8) that can delete bogus
7751mount entries in remote @b{mountd}(8) daemons.  This is useful to
7752cleanup otherwise ever-accumulating ``junk''.  Use it for example:
7753
7754@example
7755fixmount -r @i{host}
7756@end example
7757
7758See the online manual page for @samp{fixmount} for more details of its
7759usage.
7760
7761@c ----------------------------------------------------------------
7762@node fixrmtab, lostaltmail, fixmount, Assorted Tools
7763@comment  node-name,  next,  previous,  up
7764@section fixrmtab
7765@pindex fixrmtab
7766
7767A script to invalidate @file{/etc/rmtab} entries for hosts named.  Also
7768restart mountd for changes to take effect.  Use it for example:
7769
7770@example
7771fixrmtab @i{host1} @i{host2} @i{...}
7772@end example
7773
7774@c ----------------------------------------------------------------
7775@node lostaltmail, lostaltmail.conf-sample, fixrmtab, Assorted Tools
7776@comment  node-name,  next,  previous,  up
7777@section lostaltmail
7778@pindex lostaltmail
7779
7780A script used with @i{Hlfsd} to resend any ``lost'' mail.  @i{Hlfsd}
7781redirects mail which cannot be written into the user's home directory to
7782an alternate directory.  This is useful to continue delivering mail,
7783even if the user's file system was unavailable, full, or over quota.
7784But, the mail which gets delivered to  the alternate directory needs to
7785be resent to its respective users.  This is what the @samp{lostaltmail}
7786script does.
7787
7788Use it as follows:
7789
7790@example
7791lostaltmail
7792@end example
7793
7794This script needs a configuration file @samp{lostaltmail.conf} set up
7795with the right parameters to properly work.  @xref{Hlfsd}, for more
7796details.
7797
7798@c ----------------------------------------------------------------
7799@node lostaltmail.conf-sample, mk-amd-map, lostaltmail, Assorted Tools
7800@comment  node-name,  next,  previous,  up
7801@section lostaltmail.conf-sample
7802@pindex lostaltmail.conf-sample
7803@cindex lostaltmail; configuration file
7804
7805This is a text file with configuration parameters needed for the
7806@samp{lostaltmail} script.  The script includes comments explaining each
7807of the configuration variables.  See it for more information.  Also
7808@pxref{Hlfsd} for general information.
7809
7810@c ----------------------------------------------------------------
7811@node mk-amd-map, pawd, lostaltmail.conf-sample, Assorted Tools
7812@comment  node-name,  next,  previous,  up
7813@section mk-amd-map
7814@pindex mk-amd-map
7815
7816This program converts a normal @i{Amd} map file into an ndbm database
7817with the same prefix as the named file.  Use it as follows:
7818
7819@example
7820mk-amd-map @i{mapname}
7821@end example
7822
7823@c ----------------------------------------------------------------
7824@node pawd, redhat-ctl-amd, mk-amd-map, Assorted Tools
7825@comment  node-name,  next,  previous,  up
7826@section pawd
7827@pindex pawd
7828
7829@i{Pawd} is used to print the current working directory, adjusted to
7830reflect proper paths that can be reused to go through the automounter
7831for the shortest possible path.  In particular, the path printed back
7832does not include any of @i{Amd}'s local mount points.  Using them is
7833unsafe, because @i{Amd} may unmount managed file systems from the mount
7834points, and thus including them in paths may not always find the files
7835within.
7836
7837Without any arguments, @i{Pawd} will print the automounter adjusted
7838current working directory.  With any number of arguments, it will print
7839the adjusted path of each one of the arguments.
7840
7841@c ----------------------------------------------------------------
7842@node redhat-ctl-amd, wait4amd, pawd, Assorted Tools
7843@comment  node-name,  next,  previous,  up
7844@section redhat-ctl-amd
7845@pindex redhat-ctl-amd
7846
7847This script is similar to @i{ctl-amd} (@pxref{ctl-amd}) but is intended
7848for Red Hat Linux systems.  You can safely copy @i{redhat-ctl-amd} onto
7849@file{/etc/rc.d/init.d/amd}.  The script supplied by @i{Am-utils} is
7850usually better than the one provided by Red Hat, because the Red Hat
7851script does not correctly kill @i{Amd} processes: it is too quick to
7852kill the wrong processes, leaving stale or hung mount points behind.
7853
7854@c ----------------------------------------------------------------
7855@node wait4amd, wait4amd2die, redhat-ctl-amd, Assorted Tools
7856@comment  node-name,  next,  previous,  up
7857@section wait4amd
7858@pindex wait4amd
7859
7860A script to wait for @i{Amd} to start on a particular host before
7861performing an arbitrary command.  The command is executed repeatedly,
7862with 1 second intervals in between.  You may interrupt the script using
7863@samp{^C} (or whatever keyboard sequence your terminal's @samp{intr} function
7864is bound to).
7865
7866Examples:
7867
7868@table @t
7869@item wait4amd saturn amq -p -h saturn
7870When @i{Amd} is up on host @samp{saturn}, get the process ID of that
7871running @i{Amd}.
7872@item wait4amd pluto rlogin pluto
7873Remote login to host @samp{pluto} when @i{Amd} is up on that host.  It
7874is generally necessary to wait for @i{Amd} to properly start and
7875initialize on a remote host before logging in to it, because otherwise
7876user home directories may not be accessible across the network.
7877@item wait4amd pluto
7878A short-hand version of the previous command, since the most useful
7879reason for this script is to login to a remote host.  I use it very
7880often when testing out new versions of @i{Amd}, and need to reboot hung
7881hosts.
7882@end table
7883
7884@c ----------------------------------------------------------------
7885@node wait4amd2die, wire-test, wait4amd, Assorted Tools
7886@comment  node-name,  next,  previous,  up
7887@section wait4amd2die
7888@pindex wait4amd2die
7889
7890This script is used internally by @samp{ctl-amd} when used to restart
7891@i{Amd}.  It waits for @i{Amd} to terminate.  If it detected that
7892@i{Amd} terminated cleanly, this script will return an exist status of
7893zero.  Otherwise, it will return a non-zero exit status.
7894
7895The script tests for @i{Amd}'s existence once every 5 seconds, six
7896times, for a total of 30 seconds.  It will return a zero exist status as
7897soon as it detects that @i{Amd} dies.
7898
7899@c ----------------------------------------------------------------
7900@node wire-test, , wait4amd2die, Assorted Tools
7901@comment  node-name,  next,  previous,  up
7902@section wire-test
7903@pindex wire-test
7904
7905A simple program to test if some of the most basic networking functions
7906in am-util's library @file{libamu} work.  It also tests the combination
7907of NFS protocol and version number that are supported from the current
7908host, to a remote one.
7909
7910For example, in this test a machine which only supports NFS Version 2 is
7911contacting a remote host that can support the same version, but using
7912both UDP and TCP.  If no host name is specified, @samp{wire-test} will
7913try @file{localhost}.
7914
7915@example
7916$ wire-test moisil
7917Network name is "mcl-lab-net.cs.columbia.edu"
7918Network number is "128.59.13"
7919Network name is "old-net.cs.columbia.edu"
7920Network number is "128.59.16"
7921My IP address is 0x7f000001.
7922NFS Version and protocol tests to host "moisil"...
7923        testing vers=2, proto="udp" -> found version 2.
7924        testing vers=3, proto="udp" -> failed!
7925        testing vers=2, proto="tcp" -> found version 2.
7926        testing vers=3, proto="tcp" -> failed!
7927@end example
7928
7929@c ################################################################
7930@node Examples, Internals, Assorted Tools, Top
7931@comment  node-name,  next,  previous,  up
7932@chapter Examples
7933
7934@menu
7935* User Filesystems::
7936* Home Directories::
7937* Architecture Sharing::
7938* Wildcard Names::
7939* rwho servers::
7940* /vol::
7941* /defaults with selectors::
7942* /tftpboot in a chroot-ed environment::
7943
7944@end menu
7945
7946@node User Filesystems, Home Directories, Examples, Examples
7947@comment  node-name,  next,  previous,  up
7948@section User Filesystems
7949@cindex User filesystems
7950@cindex Mounting user filesystems
7951
7952With more than one fileserver, the directories most frequently
7953cross-mounted are those containing user home directories.  A common
7954convention used at Imperial College is to mount the user disks under
7955@t{/home/}@i{machine}.
7956
7957Typically, the @samp{/etc/fstab} file contained a long list of entries
7958such as:
7959
7960@example
7961@i{machine}:/home/@i{machine} /home/@i{machine} nfs ...
7962@end example
7963
7964for each fileserver on the network.
7965
7966There are numerous problems with this system.  The mount list can become
7967quite large and some of the machines may be down when a system is
7968booted.  When a new fileserver is installed, @samp{/etc/fstab} must be
7969updated on every machine, the mount directory created and the filesystem
7970mounted.
7971
7972In many environments most people use the same few workstations, but
7973it is convenient to go to a colleague's machine and access your own
7974files.  When a server goes down, it can cause a process on a client
7975machine to hang.  By minimizing the mounted filesystems to only include
7976those actively being used, there is less chance that a filesystem will
7977be mounted when a server goes down.
7978
7979The following is a short extract from a map taken from a research fileserver
7980at Imperial College.
7981
7982Note the entry for @samp{localhost} which is used for users such as
7983the operator (@samp{opr}) who have a home directory on most machine as
7984@samp{/home/localhost/opr}.
7985
7986@example
7987/defaults       opts:=rw,intr,grpid,nosuid
7988charm           host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@} \
7989                host==$@{key@};type:=ufs;dev:=/dev/xd0g
7990#
7991...
7992
7993#
7994localhost       type:=link;fs:=$@{host@}
7995...
7996#
7997# dylan has two user disks so have a
7998# top directory in which to mount them.
7999#
8000dylan           type:=auto;fs:=$@{map@};pref:=$@{key@}/
8001#
8002dylan/dk2       host!=dylan;type:=nfs;rhost:=dylan;rfs:=/home/$@{key@} \
8003                host==dylan;type:=ufs;dev:=/dev/dsk/2s0
8004#
8005dylan/dk5       host!=dylan;type:=nfs;rhost:=dylan;rfs:=/home/$@{key@} \
8006                host==dylan;type:=ufs;dev:=/dev/dsk/5s0
8007...
8008#
8009toytown         host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@} \
8010                host==$@{key@};type:=ufs;dev:=/dev/xy1g
8011...
8012#
8013zebedee         host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@} \
8014                host==$@{key@};type:=ufs;dev:=/dev/dsk/1s0
8015#
8016# Just for access...
8017#
8018gould           type:=auto;fs:=$@{map@};pref:=$@{key@}/
8019gould/staff     host!=gould;type:=nfs;rhost:=gould;rfs:=/home/$@{key@}
8020#
8021gummo           host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@}
8022...
8023@end example
8024
8025This map is shared by most of the machines listed so on those
8026systems any of the user disks is accessible via a consistent name.
8027@i{Amd} is started with the following command
8028
8029@example
8030amd /home amd.home
8031@end example
8032
8033Note that when mounting a remote filesystem, the @dfn{automounted}
8034mount point is referenced, so that the filesystem will be mounted if
8035it is not yet (at the time the remote @samp{mountd} obtains the file handle).
8036
8037@node Home Directories, Architecture Sharing, User Filesystems, Examples
8038@comment  node-name,  next,  previous,  up
8039@section Home Directories
8040@cindex Home directories
8041@cindex Example of mounting home directories
8042@cindex Mount home directories
8043
8044One convention for home directories is to locate them in @samp{/homes}
8045so user @samp{jsp}'s home directory is @samp{/homes/jsp}.  With more
8046than a single fileserver it is convenient to spread user files across
8047several machines.  All that is required is a mount-map which converts
8048login names to an automounted directory.
8049
8050Such a map might be started by the command:
8051
8052@example
8053amd /homes amd.homes
8054@end example
8055
8056where the map @samp{amd.homes} contained the entries:
8057
8058@example
8059/defaults   type:=link   # All the entries are of type:=link
8060jsp         fs:=/home/charm/jsp
8061njw         fs:=/home/dylan/dk5/njw
8062...
8063phjk        fs:=/home/toytown/ai/phjk
8064sjv         fs:=/home/ganymede/sjv
8065@end example
8066
8067Whenever a login name is accessed in @samp{/homes} a symbolic link
8068appears pointing to the real location of that user's home directory.  In
8069this example, @samp{/homes/jsp} would appear to be a symbolic link
8070pointing to @samp{/home/charm/jsp}.  Of course, @samp{/home} would also
8071be an automount point.
8072
8073This system causes an extra level of symbolic links to be used.
8074Although that turns out to be relatively inexpensive, an alternative is
8075to directly mount the required filesystems in the @samp{/homes}
8076map.  The required map is simple, but long, and its creation is best automated.
8077The entry for @samp{jsp} could be:
8078
8079@example
8080jsp   -sublink:=$@{key@};rfs:=/home/charm \
8081               host==charm;type:=ufs;dev:=/dev/xd0g \
8082               host!=charm;type:=nfs;rhost:=charm
8083@end example
8084
8085This map can become quite big if it contains a large number of entries.
8086By combining two other features of @i{Amd} it can be greatly simplified.
8087
8088First the UFS partitions should be mounted under the control of
8089@samp{/etc/fstab}, taking care that they are mounted in the same place
8090that @i{Amd} would have automounted them.  In most cases this would be
8091something like @samp{/a/@dfn{host}/home/@dfn{host}} and
8092@samp{/etc/fstab} on host @samp{charm} would have a line:@refill
8093
8094@example
8095/dev/xy0g /a/charm/home/charm 4.2 rw,nosuid,grpid 1 5
8096@end example
8097
8098The map can then be changed to:
8099
8100@example
8101/defaults    type:=nfs;sublink:=$@{key@};opts:=rw,intr,nosuid,grpid
8102jsp          rhost:=charm;rfs:=/home/charm
8103njw          rhost:=dylan;rfs:=/home/dylan/dk5
8104...
8105phjk         rhost:=toytown;rfs:=/home/toytown;sublink:=ai/$@{key@}
8106sjv          rhost:=ganymede;rfs:=/home/ganymede
8107@end example
8108
8109This map operates as usual on a remote machine (@i{ie} @code{$@{host@}}
8110not equal to @code{$@{rhost@}}).  On the machine where the filesystem is
8111stored (@i{ie} @code{$@{host@}} equal to @code{$@{rhost@}}), @i{Amd}
8112will construct a local filesystem mount point which corresponds to the
8113name of the locally mounted UFS partition.  If @i{Amd} is started with
8114the @code{-r} option then instead of attempting an NFS mount, @i{Amd} will
8115simply inherit the UFS mount (@pxref{Inheritance Filesystem}).  If
8116@code{-r} is not used then a loopback NFS mount will be made.  This type of
8117mount is known to cause a deadlock on many systems.
8118
8119@node Architecture Sharing, Wildcard Names, Home Directories, Examples
8120@comment  node-name,  next,  previous,  up
8121@section Architecture Sharing
8122@cindex Architecture sharing
8123@cindex Sharing a fileserver between architectures
8124@cindex Architecture dependent volumes
8125
8126@c %At the moment some of the research machines have sets of software
8127@c %mounted in @samp{/vol}.  This contains subdirectories for \TeX,
8128@c %system sources, local sources, prolog libraries and so on.
8129Often a filesystem will be shared by machines of different architectures.
8130Separate trees can be maintained for the executable images for each
8131architecture, but it may be more convenient to have a shared tree,
8132with distinct subdirectories.
8133
8134A shared tree might have the following structure on the fileserver (called
8135@samp{fserver} in the example):
8136
8137@example
8138local/tex
8139local/tex/fonts
8140local/tex/lib
8141local/tex/bin
8142local/tex/bin/sun3
8143local/tex/bin/sun4
8144local/tex/bin/hp9000
8145...
8146@end example
8147
8148In this example, the subdirectories of @samp{local/tex/bin} should be
8149hidden when accessed via the automount point (conventionally @samp{/vol}).
8150A mount-map for @samp{/vol} to achieve this would look like:
8151
8152@example
8153/defaults   sublink:=$@{/key@};rhost:=fserver;type:=link
8154tex         type:=auto;fs:=$@{map@};pref:=$@{key@}/
8155tex/fonts   host!=fserver;type:=nfs;rfs:=/vol/tex \
8156            host==fserver;fs:=/usr/local/tex
8157tex/lib     host!=fserver;type:=nfs;rfs:=/vol/tex \
8158            host==fserver;fs:=/usr/local/tex
8159tex/bin     -sublink:=$@{/key@}/$@{arch@} \
8160            host!=fserver;type:=nfs;rfs:=/vol/tex \
8161            host:=fserver;fs:=/usr/local/tex
8162@end example
8163
8164When @samp{/vol/tex/bin} is referenced, the current machine architecture
8165is automatically appended to the path by the @code{$@{sublink@}}
8166variable.  This means that users can have @samp{/vol/tex/bin} in their
8167@samp{PATH} without concern for architecture dependencies.
8168
8169@node Wildcard Names, rwho servers, Architecture Sharing, Examples
8170@comment  node-name,  next,  previous,  up
8171@section Wildcard Names & Replicated Servers
8172
8173By using the wildcard facility, @i{Amd} can @dfn{overlay} an existing
8174directory with additional entries.
8175The system files are usually mounted under @samp{/usr}.  If instead,
8176@i{Amd} is mounted on @samp{/usr}, additional
8177names can be overlayed to augment or replace names in the ``master'' @samp{/usr}.
8178A map to do this would have the form:
8179
8180@example
8181local  type:=auto;fs:=local-map
8182share  type:=auto;fs:=share-map
8183*      -type:=nfs;rfs:=/export/exec/$@{arch@};sublink:="$@{key@}" \
8184        rhost:=fserv1  rhost:=fserv2  rhost:=fserv3
8185@end example
8186
8187Note that the assignment to @code{$@{sublink@}} is surrounded by double
8188quotes to prevent the incoming key from causing the map to be
8189misinterpreted.  This map has the effect of directing any access to
8190@samp{/usr/local} or @samp{/usr/share} to another automount point.
8191
8192In this example, it is assumed that the @samp{/usr} files are replicated
8193on three fileservers: @samp{fserv1}, @samp{fserv2} and @samp{fserv3}.
8194For any references other than to @samp{local} and @samp{share} one of
8195the servers is used and a symbolic link to
8196@t{$@{autodir@}/$@{rhost@}/export/exec/$@{arch@}/@i{whatever}} is
8197returned once an appropriate filesystem has been mounted.@refill
8198
8199@node rwho servers, /vol, Wildcard Names, Examples
8200@comment  node-name,  next,  previous,  up
8201@section @samp{rwho} servers
8202@cindex rwho servers
8203@cindex Architecture specific mounts
8204@cindex Example of architecture specific mounts
8205
8206The @samp{/usr/spool/rwho} directory is a good candidate for automounting.
8207For efficiency reasons it is best to capture the rwho data on a small
8208number of machines and then mount that information onto a large number
8209of clients.  The data written into the rwho files is byte order dependent
8210so only servers with the correct byte ordering can be used by a client:
8211
8212@example
8213/defaults         type:=nfs
8214usr/spool/rwho    -byte==little;rfs:=/usr/spool/rwho \
8215                      rhost:=vaxA  rhost:=vaxB \
8216                  || -rfs:=/usr/spool/rwho \
8217                      rhost:=sun4  rhost:=hp300
8218@end example
8219
8220@node /vol, /defaults with selectors, rwho servers, Examples
8221@comment  node-name,  next,  previous,  up
8222@section @samp{/vol}
8223@cindex /vol
8224@cindex Catch-all mount point
8225@cindex Generic volume name
8226
8227@samp{/vol} is used as a catch-all for volumes which do not have other
8228conventional names.
8229
8230Below is part of the @samp{/vol} map for the domain @samp{doc.ic.ac.uk}.
8231The @samp{r+d} tree is used for new or experimental software that needs
8232to be available everywhere without installing it on all the fileservers.
8233Users wishing to try out the new software then simply include
8234@samp{/vol/r+d/@{bin,ucb@}} in their path.@refill
8235
8236The main tree resides on one host @samp{gould.doc.ic.ac.uk}, which has
8237different @samp{bin}, @samp{etc}, @samp{lib} and @samp{ucb}
8238sub-directories for each machine architecture.  For example,
8239@samp{/vol/r+d/bin} for a Sun-4 would be stored in the sub-directory
8240@samp{bin/sun4} of the filesystem @samp{/usr/r+d}.  When it was accessed
8241a symbolic link pointing to @samp{/a/gould/usr/r+d/bin/sun4} would be
8242returned.@refill
8243
8244@example
8245/defaults    type:=nfs;opts:=rw,grpid,nosuid,intr,soft
8246wp           -opts:=rw,grpid,nosuid;rhost:=charm \
8247             host==charm;type:=link;fs:=/usr/local/wp \
8248             host!=charm;type:=nfs;rfs:=/vol/wp
8249...
8250#
8251src          -opts:=rw,grpid,nosuid;rhost:=charm \
8252             host==charm;type:=link;fs:=/usr/src \
8253             host!=charm;type:=nfs;rfs:=/vol/src
8254#
8255r+d          type:=auto;fs:=$@{map@};pref:=r+d/
8256# per architecture bin,etc,lib&ucb...
8257r+d/bin      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
8258r+d/etc      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
8259r+d/include  rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}
8260r+d/lib      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
8261r+d/man      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}
8262r+d/src      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}
8263r+d/ucb      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
8264# hades pictures
8265pictures     -opts:=rw,grpid,nosuid;rhost:=thpfs \
8266             host==thpfs;type:=link;fs:=/nbsd/pictures \
8267             host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=pictures
8268# hades tools
8269hades        -opts:=rw,grpid,nosuid;rhost:=thpfs \
8270             host==thpfs;type:=link;fs:=/nbsd/hades \
8271             host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=hades
8272# bsd tools for hp.
8273bsd          -opts:=rw,grpid,nosuid;arch==hp9000;rhost:=thpfs \
8274             host==thpfs;type:=link;fs:=/nbsd/bsd \
8275             host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=bsd
8276@end example
8277
8278@node /defaults with selectors, /tftpboot in a chroot-ed environment, /vol, Examples
8279@comment  node-name,  next,  previous,  up
8280@section @samp{/defaults} with selectors
8281@cindex /defaults with selectors
8282@cindex selectors on default
8283
8284It is sometimes useful to have different defaults for a given map.  To
8285achieve this, the @samp{/defaults} entry must be able to process normal
8286selectors.  This feature is turned on by setting
8287@samp{selectors_in_defaults = yes} in the @file{amd.conf} file.
8288@xref{selectors_in_defaults Parameter}.
8289
8290In this example, I set different default NFS mount options for hosts
8291which are running over a slower network link.  By setting a smaller size
8292for the NFS read and write buffer sizes, you can greatly improve remote
8293file service performance.
8294
8295@example
8296/defaults \
8297  wire==slip-net;opts:=rw,intr,rsize=1024,wsize=1024,timeo=20,retrans=10 \
8298  wire!=slip-net;opts:=rw,intr
8299@end example
8300
8301@node /tftpboot in a chroot-ed environment, , /defaults with selectors, Examples
8302@comment  node-name,  next,  previous,  up
8303@section @samp{/tftpboot} in a chroot-ed environment
8304@cindex /tftpboot in a chroot-ed environment
8305@cindex chroot; /tftpboot example
8306
8307In this complex example, we attempt to run an @i{Amd} process
8308@emph{inside} a chroot-ed environment.  @samp{tftpd} (Trivial FTP) is
8309used to trivially retrieve files used to boot X-Terminals, Network
8310Printers, Network routers, diskless workstations, and other such
8311devices.  For security reasons, @samp{tftpd} (and also @samp{ftpd})
8312processes are run using the @b{chroot}(2) system call.  This provides an
8313environment for these processes, where access to any files outside the
8314directory where the chroot-ed process runs is denied.
8315
8316For example, if you start @samp{tftpd} on your system with
8317
8318@example
8319chroot /tftpboot /usr/sbin/tftpd
8320@end example
8321
8322@noindent
8323then the @samp{tftpd} process will not be able to access any files
8324outside @file{/tftpboot}.  This ensures that no one can retrieve files
8325such as @file{/etc/passwd} and run password crackers on it.
8326
8327Since the TFTP service works by broadcast, it is necessary to have at
8328least one TFTP server running on each subnet.  If you have lots of files
8329that you need to make available for @samp{tftp}, and many subnets, it
8330could take significant amounts of disk space on each host serving them.
8331
8332A solution we implemented at Columbia University was to have every host
8333run @samp{tftpd}, but have those servers retrieve the boot files from
8334two replicated servers.  Those replicated servers have special
8335partitions dedicated to the many network boot files.
8336
8337We start @i{Amd} as follows:
8338
8339@example
8340amd /tftpboot/.amd amd.tftpboot
8341@end example
8342
8343That is, @i{Amd} is serving the directory @file{/tftpboot/.amd}.  The
8344@samp{tftp} server runs inside @file{/tftpboot} and is chroot-ed in that
8345directory too.  The @file{amd.tftpboot} map looks like:
8346
8347@example
8348#
8349# Amd /tftpboot directory -> host map
8350#
8351
8352/defaults  opts:=nosuid,ro,intr,soft;fs:=/tftpboot/import;type:=nfs
8353
8354tp         host==lol;rfs:=/n/lol/import/tftpboot;type:=lofs \
8355           host==ober;rfs:=/n/ober/misc/win/tftpboot;type:=lofs \
8356           rhost:=ober;rfs:=/n/ober/misc/win/tftpboot \
8357           rhost:=lol;rfs:=/n/lol/import/tftpboot
8358@end example
8359
8360To help understand this example, I list a few of the file entries that
8361are created inside @file{/tftpboot}:
8362
8363@example
8364$ ls -la /tftpboot
8365dr-xr-xr-x   2 root   512 Aug 30 23:11 .amd
8366drwxrwsr-x  12 root   512 Aug 30 08:00 import
8367lrwxrwxrwx   1 root    33 Feb 27  1997 adminpr.cfg -> ./.amd/tp/hplj/adminpr.cfg
8368lrwxrwxrwx   1 root    22 Dec  5  1996 tekxp -> ./.amd/tp/xterms/tekxp
8369lrwxrwxrwx   1 root     1 Dec  5  1996 tftpboot -> .
8370@end example
8371
8372Here is an explanation of each of the entries listed above:
8373
8374@table @code
8375
8376@item .amd
8377This is the @i{Amd} mount point.  Note that you do not need to run a
8378separate @i{Amd} process for the TFTP service.  The @b{chroot}(2) system
8379call only protects against file access, but the same process can still
8380serve files and directories inside and outside the chroot-ed
8381environment, because @i{Amd} itself was not run in chroot-ed mode.
8382
8383@item import
8384This is the mount point where @i{Amd} will mount the directories
8385containing the boot files.  The map is designed so that remote
8386directories will be NFS mounted (even if they are already mounted
8387elsewhere), and local directories are loopback mounted (since they are
8388not accessible outside the chroot-ed @file{/tftpboot} directory).
8389
8390@item adminpr.cfg
8391@itemx tekxp
8392Two manually created symbolic links to directories @emph{inside} the
8393@i{Amd}-managed directory.  The crossing of the component @file{tp} will
8394cause @i{Amd} to automount one of the remote replicas.  Once crossed,
8395access to files inside proceeds as usual.  The @samp{adminpr.cfg} is a
8396configuration file for an HP Laser-Jet 4si printer, and the @samp{tekxp}
8397is a directory for Tektronix X-Terminal boot files.
8398
8399@item tftpboot
8400This innocent looking symlink is important.  Usually, when devices boot
8401via the TFTP service, they perform the @samp{get file} command to
8402retrieve @var{file}.  However, some devices assume that @samp{tftpd}
8403does not run in a chroot-ed environment, but rather ``unprotected'', and
8404thus use a full pathname for files to retrieve, as in @samp{get
8405/tftpboot/file}.  This symlink effectively strips out the leading
8406@file{/tftpboot/}.
8407
8408@end table
8409
8410@c ################################################################
8411@node Internals, Acknowledgments & Trademarks, Examples, Top
8412@comment  node-name,  next,  previous,  up
8413@chapter Internals
8414
8415Note that there are more error and logging messages possible than are
8416listed here.  Most of them are self-explanatory.  Refer to the program
8417sources for more details on the rest.
8418
8419@menu
8420* Log Messages::
8421@end menu
8422
8423@node Log Messages, , Internals, Internals
8424@comment  node-name,  next,  previous,  up
8425@section Log Messages
8426
8427In the following sections a brief explanation is given of some of the
8428log messages made by @i{Amd}.  Where the message is in @samp{typewriter}
8429font, it corresponds exactly to the message produced by @i{Amd}.  Words
8430in @dfn{italic} are replaced by an appropriate string.  Variables,
8431@code{$@{@i{var}@}}, indicate that the value of the appropriate variable is
8432output.
8433
8434Log messages are either sent directly to a file,
8435or logged via the @b{syslog}(3) mechanism.  @xref{log_file Parameter}.
8436In either case, entries in the file are of the form:
8437@example
8438@i{date-string}  @i{hostname} @t{amd[}@i{pid}@t{]}  @i{message}
8439@end example
8440
8441@menu
8442* Fatal errors::
8443* Info messages::
8444@end menu
8445
8446@node Fatal errors, Info messages, Log Messages, Log Messages
8447@comment  node-name,  next,  previous,  up
8448@subsection Fatal errors
8449
8450@i{Amd} attempts to deal with unusual events.  Whenever it is not
8451possible to deal with such an error, @i{Amd} will log an appropriate
8452message and, if it cannot possibly continue, will either exit or abort.
8453These messages are selected by @samp{-x fatal} on the command line.
8454When @b{syslog}(3) is being used, they are logged with level
8455@samp{LOG_FATAL}.  Even if @i{Amd} continues to operate it is likely to
8456remain in a precarious state and should be restarted at the earliest
8457opportunity.
8458
8459@table @t
8460
8461@item Attempting to inherit not-a-filesystem
8462The prototype mount point created during a filesystem restart did not
8463contain a reference to the restarted filesystem.  This error ``should
8464never happen''.
8465
8466@item Can't bind to domain "@i{NIS-domain}"
8467A specific NIS domain was requested on the command line, but no server
8468for that domain is available on the local net.
8469
8470@item Can't determine IP address of this host (@i{hostname})
8471When @i{Amd} starts it determines its own IP address.  If this lookup
8472fails then @i{Amd} cannot continue.  The hostname it looks up is that
8473obtained returned by @b{gethostname}(2) system call.
8474
8475@item Can't find root file handle for @i{automount point}
8476@i{Amd} creates its own file handles for the automount points.  When it
8477mounts itself as a server, it must pass these file handles to the local
8478kernel.  If the filehandle is not obtainable the mount point is ignored.
8479This error ``should never happen''.
8480
8481@item Must be root to mount filesystems (euid = @i{euid})
8482To prevent embarrassment, @i{Amd} makes sure it has appropriate system
8483privileges.  This amounts to having an euid of 0.  The check is made
8484after argument processing complete to give non-root users a chance to
8485access the @code{-v} option.
8486
8487@item No work to do - quitting
8488No automount points were given on the command line and so there is no
8489work to do.
8490
8491@item Out of memory
8492While attempting to malloc some memory, the memory space available to
8493@i{Amd} was exhausted.  This is an unrecoverable error.
8494
8495@item Out of memory in realloc
8496While attempting to realloc some memory, the memory space available to
8497@i{Amd} was exhausted.  This is an unrecoverable error.
8498
8499@item cannot create rpc/udp service
8500Either the NFS or AMQ endpoint could not be created.
8501
8502@item gethostname: @i{description}
8503The @b{gethostname}(2) system call failed during startup.
8504
8505@item host name is not set
8506The @b{gethostname}(2) system call returned a zero length host name.
8507This can happen if @i{Amd} is started in single user mode just after
8508booting the system.
8509
8510@item ifs_match called!
8511An internal error occurred while restarting a pre-mounted filesystem.
8512This error ``should never happen''.
8513
8514@item mount_afs: @i{description}
8515An error occurred while @i{Amd} was mounting itself.
8516
8517@item run_rpc failed
8518Somehow the main NFS server loop failed.  This error ``should never
8519happen''.
8520
8521@item unable to free rpc arguments in amqprog_1
8522The incoming arguments to the AMQ server could not be free'ed.
8523
8524@item unable to free rpc arguments in nfs_program_1
8525The incoming arguments to the NFS server could not be free'ed.
8526
8527@item unable to register (AMQ_PROGRAM, AMQ_VERSION, udp)
8528The AMQ server could not be registered with the local portmapper or the
8529internal RPC dispatcher.
8530
8531@item unable to register (NFS_PROGRAM, NFS_VERSION, 0)
8532The NFS server could not be registered with the internal RPC dispatcher.
8533
8534@end table
8535
8536XXX: This section needs to be updated
8537
8538@node Info messages, , Fatal errors, Log Messages
8539@comment  node-name,  next,  previous,  up
8540@subsection Info messages
8541
8542@i{Amd} generates information messages to record state changes.  These
8543messages are selected by @samp{-x info} on the command line.  When
8544@b{syslog}(3) is being used, they are logged with level @samp{LOG_INFO}.
8545
8546The messages listed below can be generated and are in a format suitable
8547for simple statistical analysis.  @dfn{mount-info} is the string
8548that is displayed by @dfn{Amq} in its mount information column and
8549placed in the system mount table.
8550
8551@table @t
8552
8553@item "@t{$@{@i{path}@}}" forcibly timed out
8554An automount point has been timed out by the @i{Amq} command.
8555
8556@item "@t{$@{@i{path}@}}" has timed out
8557No access to the automount point has been made within the timeout
8558period.
8559
8560@item Filehandle denied for "$@{@i{rhost}@}:$@{@i{rfs}@}"
8561The mount daemon refused to return a file handle for the requested filesystem.
8562
8563@item Filehandle error for "$@{@i{rhost}@}:$@{@i{rfs}@}": @i{description}
8564The mount daemon gave some other error for the requested filesystem.
8565
8566@item Finishing with status @i{exit-status}
8567@i{Amd} is about to exit with the given exit status.
8568
8569@item Re-synchronizing cache for map @t{$@{@i{map}@}}
8570The named map has been modified and the internal cache is being re-synchronized.
8571
8572@item file server @t{$@{@i{rhost}@}} is down - timeout of "@t{$@{@i{path}@}}" ignored
8573An automount point has timed out, but the corresponding file server is
8574known to be down.  This message is only produced once for each mount
8575point for which the server is down.
8576
8577@item file server @t{$@{@i{rhost}@}} type nfs is down
8578An NFS file server that was previously up is now down.
8579
8580@item file server @t{$@{@i{rhost}@}} type nfs is up
8581An NFS file server that was previously down is now up.
8582
8583@item file server @t{$@{@i{rhost}@}} type nfs starts down
8584A new NFS file server has been referenced and is known to be down.
8585
8586@item file server @t{$@{@i{rhost}@}} type nfs starts up
8587A new NFS file server has been referenced and is known to be up.
8588
8589@item mount of "@t{$@{@i{path}@}}" on @t{$@{@i{fs}@}} timed out
8590Attempts to mount a filesystem for the given automount point have failed
8591to complete within 30 seconds.
8592
8593@item @i{mount-info} mounted fstype @t{$@{@i{type}@}} on @t{$@{@i{fs}@}}
8594A new file system has been mounted.
8595
8596@item @i{mount-info} restarted fstype @t{$@{@i{type}@}} on @t{$@{@i{fs}@}}
8597@i{Amd} is using a pre-mounted filesystem to satisfy a mount request.
8598
8599@item @i{mount-info} unmounted fstype @t{$@{@i{type}@}} from @t{$@{@i{fs}@}}
8600A file system has been unmounted.
8601
8602@item @i{mount-info} unmounted fstype @t{$@{@i{type}@}} from @t{$@{@i{fs}@}} link @t{$@{@i{fs}@}}/@t{$@{@i{sublink}@}}
8603A file system of which only a sub-directory was in use has been unmounted.
8604
8605@item restarting @i{mount-info} on @t{$@{@i{fs}@}}
8606A pre-mounted file system has been noted.
8607
8608@end table
8609
8610XXX: This section needs to be updated
8611
8612@c ################################################################
8613@node Acknowledgments & Trademarks, Index, Internals, Top
8614@comment  node-name,  next,  previous,  up
8615@unnumbered Acknowledgments & Trademarks
8616
8617Many thanks to the Am-Utils Users
8618mailing list through the months developing am-utils.  These members
8619have contributed to the discussions, ideas, code and documentation,
8620and subjected their systems to alpha quality code.  Special thanks go
8621to those @uref{http://www.am-utils.org/docs/am-utils/AUTHORS.txt,authors} who have
8622submitted patches, and especially to the maintainers:
8623
8624@itemize @bullet
8625@item @uref{http://www.cs.sunysb.edu/~ezk,Erez Zadok}
8626@item @email{ionut AT badula.org,Ion Badulescu}
8627@item @email{ro AT techfak.uni-bielefeld.de,Rainer Orth}
8628@item @email{nick.williams AT morganstanley.com,Nick Williams}
8629@end itemize
8630
8631Thanks to the Formal Methods Group at Imperial College for suffering
8632patiently while @i{Amd} was being developed on their machines.
8633
8634Thanks to the many people who have helped with the development of
8635@i{Amd}, especially Piete Brooks at the Cambridge University Computing
8636Lab for many hours of testing, experimentation and discussion.
8637
8638Thanks to the older @email{amd-workers AT majordomo.glue.umd.edu,Amd
8639Workers} mailing list (now defunct) members for many suggestions and
8640bug reports to @i{Amd}.
8641
8642@itemize @bullet
8643@item
8644@b{DEC}, @b{VAX} and @b{Ultrix} are registered trademarks of Digital
8645Equipment Corporation.
8646@item
8647@b{AIX} and @b{IBM} are registered trademarks of International Business
8648Machines Corporation.
8649@item
8650@b{Sun}, @b{NFS} and @b{SunOS} are registered trademarks of Sun
8651Microsystems, Inc.
8652@item
8653@b{UNIX} is a registered trademark in the USA and other countries,
8654exclusively licensed through X/Open Company, Ltd.
8655@item
8656All other registered trademarks are owned by their respective owners.
8657@end itemize
8658
8659@c ################################################################
8660@node Index, , Acknowledgments & Trademarks, Top
8661@comment  node-name,  next,  previous,  up
8662@unnumbered Index
8663
8664@printindex cp
8665
8666@contents
8667@bye
8668
8669@c ====================================================================
8670@c ISPELL LOCAL WORDS:
8671@c LocalWords:  setfilename amdref overfullrule settitle titlepage titlefont nz
8672@c LocalWords:  authorfont vskip ifinfo iftex cindex unnumberedsec dfn xref vol
8673@c LocalWords:  locationN pxref jpo nott concentrix Sjoerd sjoerd cwi Eitan vuw
8674@c LocalWords:  Mizrotsky eitan shumuji dgux fpx scp hcx metcalf masala hlh OTS
8675@c LocalWords:  Presnell srp cgl Trost trost ogi pyrOSx OSx tubsibr riscix iX
8676@c LocalWords:  Piete pb Lindblad cjl ai umax utek xinu Mitchum D'Souza dsouza
8677@c LocalWords:  mrc apu alliant aviion AViiON fps macII multimax tahoe vax emph
8678@c LocalWords:  mapdefault valA valB valC YPTSDIR ETCDIR substr MAKEDBM YPDBDIR
8679@c LocalWords:  NOPUSH njw dylan dk dylan njw anydir domN achilles mjh pref sel
8680@c LocalWords:  gdef loc loc loc ldots autodir remopts rwho rwho styx styx yoyo
8681@c LocalWords:  noindent gould rvdmount rvdunmount fserver mtmp unioned logfile
8682@c LocalWords:  dmn esac phjk toytown toytown toytown toytown phjk RdDir RdLnk
8683@c LocalWords:  volname attrs netif dougal inaddr hwaddr ec mountmaps passno xy
8684@c LocalWords:  freq dumpset hfs brian florence localinfo fstabs automaps defn
8685@c LocalWords:  localname fsck'd opr gummo sjv ganymede sjv fserv fserv fserv
8686@c LocalWords:  vaxA vaxB wp thpfs nbsd asis ifs amqprog free'ed printindex gov
8687@c LocalWords:  LocalWords syncodeindex Distrib bsdnet lanl AutoMounter acis ic
8688@c LocalWords:  ac uk aix bsd Mullender nl il DG lcs hpux irix ucsf NeXT cse cl
8689@c LocalWords:  mt FX hp ibm mips utils def def Domainname eg hostd getwd tmp
8690@c LocalWords:  subsubsection rw grpid intr noconn nocto nodevs nosuid retrans
8691@c LocalWords:  rsize tcp timeo nounmount utimeout DDEBUG nodaemon fd hostnames
8692@c LocalWords:  pid Amd's pendry vangogh nfsx backoff stats nomap nostats CRIT
8693@c LocalWords:  noinfo clustername RVD dsk dsk amq hostports osver statfs str
8694@c LocalWords:  ou counter's amdmaps proj src tftpboot sh mv cd sbin ypcat inet
8695@c LocalWords:  Getattr getattr localhost fhandles netmask fstype noquota addr
8696@c LocalWords:  exportfs Dumpsets dumpsets pindex ldif fixmount fixrmtab euid
8697@c LocalWords:  lostaltmail realloc netnumber itemx primnetnum primnetname ARG
8698@c LocalWords:  subsnetname subsnetnum netgrp netgroup multitable Shlib dec osf
8699@c LocalWords:  hppa pc bsdi freebsd netbsd openbsd ncr sysv rs acdirmax fsid
8700@c LocalWords:  acdirmin acregmax acregmin actimeo dumbtimr nfsv noac noauto sd
8701@c LocalWords:  nocache nodev noint nosub pgthresh posix rdonly suid symttl mfs
8702@c LocalWords:  AMFS umapfs myftpdir unionfs es mapname mapfile mapfile slocal
8703@c LocalWords:  mailspool saturn saturn notknown lol ober dr xr xr drwxrwsr cfg
8704@c LocalWords:  lrwxrwxrwx adminpr hplj adminpr cfg tekxp xterms tekxp Dupuy tp
8705@c LocalWords:  linkname hlfsddump dirname rmtab pluto rlogin direntry pg vr dn
8706@c LocalWords:  maxmem hlfsdir xmailbox showmount cn amdmap amdmapName resvport
8707@c LocalWords:  objectClass amdmapKey amdmapValue ln powerpc amdmapTimestamp ez
8708@c LocalWords:  moisil FSinfo Libtool Unmounting sublink fileservers NullProc
8709@c LocalWords:  gethostname mount's unmounts linkx remounts unmounting UAs SA's
8710@c LocalWords:  mountpoint mountpoints unescaped UIDs util's overlayed uref EFS
8711@c LocalWords:  serv maxgroups nfsl cachedir copt cfsadmin efs addopts fg ROMs
8712@c LocalWords:  nointr extatt setchapternewpage columnfractions alphaev gnulibc
8713@c LocalWords:  freebsdelf gnuoldld ifhtml defperm nodefperm norrip RRIP rrip
8714@c LocalWords:  noversion attr XXXXXX netgrpd rh mkstemp uid gid noexec mntfs
8715@c LocalWords:  nomnttab optionstr hrtime xdrtrace getpwd proplist redhat ctl
8716@c LocalWords:  texinfo texi ib sp cartouche ified xlatecookie dircategory sc
8717@c LocalWords:  AddInfo suse Novell softlookup ENOENT USB fullybrowsable LDAPv
8718@c LocalWords:  amy ie xfffffe zebedee andrew diskfull hdmail searchable si
8719@c LocalWords:  Orth ESTALE
8720