home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume21 / amd / part13 < prev    next >
Encoding:
Internet Message Format  |  1990-04-10  |  51.4 KB

  1. Subject:  v21i101:  An Automounter for NFS systems, Part13/13
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: 61f3d124 582498ed 5ead014e 5c88b119
  5.  
  6. Submitted-by: Jan-Simon Pendry <jsp@doc.ic.ac.uk>
  7. Posting-number: Volume 21, Issue 101
  8. Archive-name: amd/part13
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 13 (of 13)."
  17. # Contents:  doc/amd.tex.1
  18. # Wrapped by rsalz@papaya.bbn.com on Tue Apr 10 15:12:17 1990
  19. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  20. if test -f 'doc/amd.tex.1' -a "${1}" != "-c" ; then 
  21.   echo shar: Will not clobber existing file \"'doc/amd.tex.1'\"
  22. else
  23. echo shar: Extracting \"'doc/amd.tex.1'\" \(49780 characters\)
  24. sed "s/^X//" >'doc/amd.tex.1' <<'END_OF_FILE'
  25. X%
  26. X% Run this through \LaTeX...
  27. X%
  28. X% $Id: amd.tex,v 5.1.1.3 90/01/11 17:05:26 jsp Exp Locker: jsp $
  29. X%
  30. X% Copyright (c) 1989 Jan-Simon Pendry
  31. X% Copyright (c) 1989 Imperial College of Science, Technology & Medicine
  32. X% Copyright (c) 1989 The Regents of the University of California.
  33. X% All rights reserved.
  34. X%
  35. X% This code is derived from software contributed to Berkeley by
  36. X% Jan-Simon Pendry at Imperial College, London.
  37. X%
  38. X% Redistribution and use in source and binary forms are permitted
  39. X% provided that the above copyright notice and this paragraph are
  40. X% duplicated in all such forms and that any documentation,
  41. X% advertising materials, and other materials related to such
  42. X% distribution and use acknowledge that the software was developed
  43. X% by Imperial College of Science, Technology and Medicine, London, UK.
  44. X% The names of the College and University may not be used to endorse
  45. X% or promote products derived from this software without specific
  46. X% prior written permission.
  47. X% THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  48. X% IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  49. X% WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  50. X%
  51. X%    %W% (Berkeley) %G%
  52. X
  53. X
  54. X%
  55. X% Set this to Report for a report
  56. X% or Article for an article
  57. X%
  58. X\def\ArticleReport{Article}
  59. X
  60. X
  61. X\def\Article{Article}
  62. X\def\ifarticle{\ifx\ArticleReport\Article}
  63. X
  64. X%\documentstyle[a4,nh,11pt,twoside,openbib,draft]{report}
  65. X
  66. X%\documentstyle[a4,nh,11pt,openbib,draft]{report}
  67. X\ifarticle
  68. X\documentstyle[a4,nh]{article}
  69. X\else
  70. X\documentstyle[a4,nh,11pt,openbib]{report}
  71. X\fi
  72. X\newcommand{\DRAFT}{}%{DRAFT}
  73. X\newcommand{\VERSION}{5.1c}
  74. X
  75. X%
  76. X% The next block of commands are only used in report mode
  77. X%
  78. X\ifarticle
  79. X\newcommand{\Chapter}{\section}\renewcommand{\chapter}{\section}
  80. X\newcommand{\Section}{\subsection}
  81. X\newcommand{\Subsection}{\subsubsection}
  82. X\else
  83. X\newcommand{\Chapter}{\chapter}
  84. X\newcommand{\Section}{\section}
  85. X\newcommand{\Subsection}{\subsection}
  86. X\fi
  87. X
  88. X\pagestyle{footers}
  89. X\pagenumbering{roman}
  90. X
  91. X\newcommand{\Edition}{Second}
  92. X
  93. X\newcommand{\see}{}
  94. X
  95. X\setheader{}
  96. X\setfooter{}
  97. X\setchapterfoot{}
  98. X
  99. X\ifarticle\else
  100. X\setcounter{tocdepth}{2}
  101. X\setcounter{secnumdepth}{2}
  102. X\fi
  103. X
  104. X\newcommand{\C}{{\sf C}}
  105. X\newcommand{\Unix}{{\sc Unix}}
  106. X\newcommand{\NFS}{{\sf NFS}}
  107. X\newcommand{\UFS}{{\sf UFS}}
  108. X\newcommand{\Amd}{{\sf Amd}}
  109. X\newcommand{\Amq}{{\sf Amq}}
  110. X\newcommand{\amd}{{\sf amd}}
  111. X\newcommand{\amq}{{\sf amq}}
  112. X\newcommand{\opt}[1]{{\tt #1}}
  113. X\newcommand{\Ref}[1]{{\S\ref{#1},~p\pageref{#1}}}
  114. X\newcommand{\Var}[1]{{\tt \$\{{#1}\}}}
  115. X\newcommand{\etc}{{\em etc\/}}
  116. X\newcommand{\ie}{{\em\/ie\/}}
  117. X\newcommand{\eg}{{\em\/eg\/}}
  118. X
  119. X\begin{document}
  120. X
  121. X\begin{titlepage}
  122. X\vskip 6.6em
  123. X\begin{center}
  124. X{\LARGE\Amd\ -- An Automounter}\\[.2cm]
  125. X{
  126. X%\Large \Edition\ Edition \\[.1cm]
  127. X{\DRAFT}
  128. X}
  129. X\par
  130. X\vskip 2.2em
  131. X{\large \lineskip .75em
  132. X\begin{tabular}[t]{c}
  133. X{\Large\em Jan-Simon Pendry} \\
  134. X{\tt <jsp@doc.ic.ac.uk>}\\
  135. XDepartment of Computing,\\
  136. XImperial College,\\
  137. XLondon SW7 2BZ
  138. X\end{tabular}\par}
  139. X
  140. X\vskip 1.3em
  141. X
  142. X{\small December 1989\par}
  143. X{\small Printed \today}
  144. X\end{center}\par
  145. X
  146. X\vskip 6em
  147. X
  148. X\begin{center}
  149. X{\Large\bf Abstract}
  150. X\end{center}
  151. X{\parindent 0pt
  152. X{\bf amd}, {\em $\acute{e}$i$\acute{e}$md$\acute{\imath}$:},
  153. Xa program providing an automounting service
  154. X[fr. {\em A}uto{\em M}ount {\em D}aemon]\par
  155. X{\bf automount}, {\em \"{o}'t\={o}-mownt, v.i.}
  156. Xto mount a filesystem automatically
  157. X[Gr.\ {\em automatos}, self-moving $+$ \Unix\ {\bf mount}(2)]%---L.
  158. X%{\em m\={o}ns, montis}, mountain]
  159. X}
  160. X\par\mbox{}\par
  161. X
  162. XAn {\em automounter} maintains a cache of mounted filesystems.
  163. XFilesystems are mounted on demand when they are first referenced
  164. Xand unmounted after a period of inactivity.
  165. X\par\mbox{}\par
  166. X
  167. X\Amd\ may be used as a replacement for Sun's automounter \cite{usenix:automounter}.
  168. XThe choice of which filesystem to mount can be controlled dynamically
  169. Xwith {\em selectors}.
  170. XSelectors allow decisions of the form
  171. X``hostname is {\em this}\,'' or ``architecture is not {\em that}.''
  172. XSelectors may be combined arbitrarily.
  173. X\Amd\ also supports a variety of filesystem types,
  174. Xincluding \NFS, \UFS\ and the novel {\em program}
  175. Xfilesystem.
  176. XThe combination of selectors and multiple filesystem types allows
  177. Xidentical configuration files to be used on each machine so
  178. Xreducing the administrative overhead.
  179. X
  180. X\Amd\ ensures that it will not hang if a remote server
  181. Xgoes down.  Moreover, \amd\ can determine when a remote
  182. Xserver has become inaccessible and then mount replacement
  183. Xfilesystems as and when they become available.
  184. X\par\mbox{}\par
  185. X\Amd\ contains no proprietary source code and
  186. Xhas been ported to numerous flavours of \Unix.
  187. X
  188. X%\ifarticle\else
  189. X\newpage
  190. X\vspace*{30pt}
  191. X%{\large
  192. X%\parindent 0pt
  193. X%WARNING:
  194. X%%warnings go here
  195. X%}\par
  196. X\vspace{4in}
  197. X{\parindent 0pt
  198. XThis document describes release ``\VERSION'' of \amd.\par
  199. X\vskip 1ex
  200. XCopyright \copyright\ 1989 Jan-Simon Pendry\\
  201. XCopyright \copyright\ 1989 Imperial College of Science, Technology \& Medicine\\
  202. XCopyright \copyright\ 1989 The Regents of the University of California.
  203. X\vskip 1ex
  204. XAll Rights Reserved.
  205. X\vskip 1ex
  206. X\begin{flushleft}
  207. XPermission to copy this document, or any portion of it, as\\
  208. Xnecessary for use of this software is granted provided this\\
  209. Xcopyright notice and statement of permission are included.
  210. X\end{flushleft}
  211. X}
  212. X%\fi %!article
  213. X\end{titlepage}
  214. X
  215. X\setheader{\vbox{\hbox to\hsize{\rightmark\hfill\thepage}\vskip 2pt\hrule}}
  216. X%\setbothheaders
  217. X%{\vbox{\hbox to\hsize{\thepage\hfill\leftmark}\vskip 2pt\hrule}}%
  218. X%{\vbox{\hbox to\hsize{\rightmark\hfill\thepage}\vskip 2pt\hrule}}
  219. X
  220. X%\setfooter{\hfil\Edition\ Edition {\DRAFT}\hfil}
  221. X\setfooter{\hfil{\DRAFT}\hfil}
  222. X%\setbothfooters
  223. X%{\thepage\hfil\Edition\ Edition {\DRAFT}}%
  224. X%{\Edition\ Edition {\DRAFT}\hfil\thepage}
  225. X
  226. X%\setchapterfoot{\thepage\hfil\Edition\ Edition {\DRAFT}\hfil\thepage}
  227. X%\setchapterfoot{\Edition\ Edition {\DRAFT}\hfil\thepage}
  228. X\setchapterfoot{{\DRAFT}\hfil\thepage\hfil}
  229. X
  230. X\ifarticle\else
  231. X\tableofcontents
  232. X\fi
  233. X
  234. X\Chapter{Overview}
  235. X\pagenumbering{arabic}
  236. X
  237. X\Amd\ maintains a cache of mounted filesystems.  Filesystems are {\em demand-mounted}
  238. Xwhen they are first referenced and unmounted after a period of inactivity.
  239. X\Amd\ may be used as a replacement for Sun's {\bf automount}(8) \cite{sun:automount} program.
  240. XIt contains no proprietary source code and has been ported
  241. Xto numerous flavours of \Unix.
  242. X
  243. X\Amd\ was designed as the basis for experimenting with filesystem
  244. Xlayout and management.  Although \amd\ has many direct applications it
  245. Xis loaded with additional features which have little use.
  246. XAt some point the infrequently used components may be removed to
  247. Xstreamline the production system.
  248. X
  249. X\Amd\ supports the notion of {\em replicated} filesystems by evaluating
  250. Xeach member of a list of possible filesystem locations in parallel.
  251. X\Amd\ checks that each cached mapping remains valid.  Should a mapping be
  252. Xlost -- such as happens when a fileserver goes down -- \amd\ automatically
  253. Xselects a replacement should one be available.
  254. X
  255. XThe fundamental concept is to separate the name used to refer to
  256. Xa file from the name used to refer to its physical storage location.
  257. XThis allows the same files to be accessed with the same name regardless of where
  258. Xin the network the name is used.  This is very different from placing
  259. X{\tt /n/hostname} in front of the pathname since that includes location
  260. Xdependent information which may change if files are moved to another
  261. Xmachine.
  262. XBy placing the required mappings in a centrally administered database,
  263. Xfilesystems can be re-organised without requiring changes to password
  264. Xfiles, shell scripts and so on.
  265. X
  266. X\Section{Filesystem Namespace}
  267. X
  268. X\Unix\ provides two forms of binding between names and files.
  269. XA {\em hard link} completes the binding when the name is added to the filesystem.
  270. XA {\em soft link} delays the binding until the name is accessed.
  271. XAn {\em automounter} adds a further form in which the binding of name to
  272. Xfilesystem is delayed until the name is accessed.
  273. X
  274. X\Amd\ operates by introducing new mount points into the filesystem.
  275. XThe kernel sees these mount points as \NFS\ \cite{sun:nfs} filesystems being served by \amd.
  276. XHaving attached itself to the filesystem, \amd\ is now able to control
  277. Xthe view the rest of the system has of those mount points.
  278. X
  279. X\Section{Operational Principles}
  280. X
  281. X\Amd\ receives requests from the kernel one at a time.
  282. XThe requests are RPC \cite{sun:rpc} calls using the \NFS\ protocol.
  283. X
  284. XWhen a {\em lookup} call is received \amd\ mounts the required
  285. Xfilesystem if it is not already mounted and then returns a symbolic link
  286. Xpointing to the real mount point.
  287. XOnce the symbolic link is returned, the kernel will send all
  288. Xother requests direct to the mounted filesystem.
  289. XIf a filesystem is not yet mounted, \amd\ consults a configuration
  290. X{\em mount-map} corresponding to the automount point.
  291. X\Amd\ then makes a runtime decision on what and where to mount
  292. Xa filesystem based on the information obtained from the map.
  293. X
  294. X\Amd\ does not implement all the \NFS\ requests; only those
  295. Xrelevant to name binding such as {\em lookup}, {\em readlink}
  296. Xand {\em readdir}.  Some other calls are also implemented
  297. Xbut most simply return an error code; for example {\em mkdir}
  298. Xalways returns ``Read-only filesystem''.
  299. X
  300. X\Section{Mounting a Filesystem}
  301. X
  302. XEach automount point has a mount map.  The mount map contains
  303. Xa list of key--value pairs.  The key is the name of the filesystem to
  304. Xbe mounted.  The value is a list of locations describing where the
  305. Xfilesystem is stored.
  306. XIn the source for the map the value would look like
  307. X\begin{quote}
  308. X${\em location}_1\ \ {\em location}_2\ \ \ldots\ \ {\em location}_n$
  309. X\end{quote}
  310. X
  311. X\Amd\ examines each location in turn.  Each location may contain {\em selectors}
  312. Xwhich control whether \amd\ can use that location.  For example, the location
  313. Xmay be restricted to use by certain hosts.  Those locations which cannot be used
  314. Xare ignored.
  315. X
  316. X\Amd\ attempts to mount the filesystem described by each remaining location
  317. Xuntil a mount succeeds or \amd\ can no longer proceed.
  318. XThe latter can occur in three ways:
  319. X\begin{itemize}
  320. X\item
  321. XIf none of
  322. Xthe locations could be used, or if all of the locations caused an error,
  323. Xthen the last error is returned.
  324. X
  325. X\item
  326. XIf a location could be used but was mounted in the background then \amd\ marks
  327. Xthat mount as being in progress and continues with the next request; no reply
  328. Xis sent to the kernel.
  329. X
  330. X\item
  331. XLastly, one or more of the mounts may have been {\em deferred}.
  332. XA mount is deferred if extra information is required before the mount
  333. Xcan proceed.  When the information becomes available the mount will
  334. Xtake place, but in the mean time no reply is sent to the kernel.
  335. XIf the mount is deferred, \amd\ continues to try any remaining locations.
  336. X\end{itemize}
  337. X
  338. X\Section{Non-blocking Operation}
  339. X
  340. XSince there is only one instance of \amd\ for each automount point,
  341. Xand usually only one instance on each machine, it is important
  342. Xthat it is always available to service kernel calls.
  343. X\Amd\ goes to great lengths to ensure that it does not block in a system call.
  344. XAs a last resort \amd\ will fork before it attempts a system call that may block
  345. Xindefinitely, such as mounting an \NFS\ filesystem.
  346. XOther tasks such as obtaining filehandle information for an \NFS\ filesystem,
  347. Xare done using a purpose built non-blocking RPC library which is integrated
  348. Xwith \amd's task scheduler (\see \Ref{task scheduler}).
  349. XThis library is also used to implement \NFS\ keep-alives (\see \Ref{keepalives}).
  350. X
  351. XWhenever a mount is deferred or backgrounded, \amd\ must wait for it to complete
  352. Xbefore replying to the kernel.  However, this would cause \amd\ to block waiting
  353. Xfor a reply to be constructed.  Rather than do this, \amd\ simply {\em drops}
  354. Xthe call under the assumption that the kernel RPC mechanism will automatically
  355. Xretry the request.
  356. X
  357. X\Section{Task Scheduling}\label{task scheduler}
  358. X
  359. X\Amd\ provides a task scheduler to support its non-blocking semantics.
  360. XThe basic operation of the scheduler is to call a procedure when
  361. Xa particular event occurs.  A general sleep/wakeup mechanism is used
  362. Xand sub-process support is built on that.  The scheduler maintains
  363. Xtwo queues: one of blocked calls and one of callbacks waiting to
  364. Xbe made.
  365. XWhen a child process exits, its exit status is picked up by a signal
  366. Xhandler and a wakeup is issued on the internal job descriptor for that sub-process.
  367. XA timeout/untimeout mechanism provides for time dependent processing.
  368. X
  369. X\Section{Automatic Unmounting}
  370. X
  371. XTo avoid an ever increasing number of filesystem mounts, \amd\ unmounts
  372. Xa filesystem that appears not to have been used recently.  A time-to-live
  373. Xinterval is associated with each mounted filesystem and when that interval
  374. Xexpires, \amd\ unmounts the filesystem.
  375. XIf the unmount fails, for example the filesystem is still active,
  376. Xthe time-to-live interval is extended.
  377. XThe global default for this grace period is controlled by the ``-w'' command-line
  378. Xoption (\see \Ref{opt:wait}).  It is also possible to set this value on a per-mount basis
  379. X(\see \Ref{opt:utimeout}).
  380. X
  381. X\Section{Keep-alives}\label{keepalives}
  382. X
  383. XUse of some filesystem types requires the presence of a server on another machine.
  384. XIf a machine crashes then it is of no concern to processes on that machine
  385. Xthat the filesystem is unavailable.  However, to processes on a remote host using
  386. Xthat machine as a fileserver this event is important.  This situation is
  387. Xmost widely recognised when an \NFS\ server crashes and the behaviour observed
  388. Xon client machines is that more and more processes hang.
  389. X
  390. XIn order to provide the possibility of recovery, \amd\ implements a {\em keep-alive}
  391. Xinterval timer for some filesystem types.
  392. XCurrently only \NFS\ makes use of this service.
  393. X
  394. XThe basis of the \NFS\ keep-alive implementation is the observation that
  395. Xmost sites maintain replicated copies of common system data such as manual
  396. Xpages, most or all programs, system source code and so on.
  397. XIf one of those servers goes down it would be reasonable to mount one of
  398. Xthe others as a replacement.
  399. X
  400. X\Amd\ keeps track of which servers are up and which are down.
  401. XIt does this by sending RPC requests to the servers' \NFS\ {\sc NullProc} and
  402. Xchecking whether a reply is returned.  If no replies are received after a
  403. Xshort period, \amd\ marks the fileserver {\em down}.
  404. XRPC requests continue to be sent so that it will notice when a fileserver
  405. Xcomes back up.
  406. XICMP echo packets \cite{rfc:icmp} are not used because it is the availability
  407. Xof the \NFS\ service that is important, not the existence of a base kernel.
  408. X
  409. XWhenever a reference to a fileserver which is down is made via \amd\, an alternate
  410. Xfilesystem is mounted if one is available.  Although this action does not protect
  411. Xuser files, which are unique on the network, or processes which do not access files
  412. Xvia \amd\ or already have open files on the hung filesystem, it can prevent most new
  413. Xprocesses from hanging.
  414. X
  415. XWith a suitable combination of filesystem management and mount-maps,
  416. Xmachines can be protected against most server downtime.  This can be
  417. Xenhanced by allocating boot-servers dynamically which allows a diskless
  418. Xworkstation to be quickly restarted if necessary.  Once the root filesystem
  419. Xis mounted, \amd\ can be started and allowed to mount the remainder of
  420. Xthe filesystem from whichever fileservers are available.
  421. X
  422. X
  423. X\Chapter{Mount-maps}
  424. X
  425. X\Amd\ has no built-in knowledge of machines or filesystems.
  426. XExternal {\em mount-maps} are used to provide the required information.
  427. XSpecifically, \amd\ needs to know when and under what conditions it should
  428. Xmount filesystems.
  429. X
  430. XThe map entry corresponding to the requested name contains
  431. Xa list of possible locations from which to resolve the request.
  432. XEach location specifies  filesystem type, information required by that
  433. Xfilesystem (for example the block special device in the case of \UFS), and
  434. Xsome information describing where to mount the filesystem (\see \Ref{mount location}).
  435. XA location may also contain {\em selectors} (\see \Ref{selectors}).
  436. X
  437. X\Section{Map Types}
  438. X
  439. XA mount-map can be implemented as a regular file, an ndbm database
  440. Xa YP map \cite{sun:yp} or via
  441. Xthe {\em Hesiod} \cite{mit:hesiod} name server.\footnote{
  442. XIn future, gdbm databases will also be supported.}
  443. XA mount-map name is a sequence of characters.
  444. XWhen an automount point is created a handle on the mount-map
  445. Xis obtained.  If the the map name begins with the sequence
  446. X``{\tt hesiod.}''\ then the {\em Hesiod} name server will be used.
  447. XOtherwise the map name is referenced as a file,
  448. Xthen as an ndbm database by that name and then as a YP map.
  449. XAs soon as a valid reference is found the map type is noted
  450. Xfor future use but any resources held are released, for example
  451. Xany open file descriptors are closed.
  452. XThe available map types are a configurable component of \amd\ and
  453. Xcan be displayed by running the command {\tt amd~-v}.
  454. X
  455. XBy default, \amd\ does not cache any data retrieved from a mount map.
  456. XThis is a policy decision based on the observation that most workstations
  457. Xhave more available CPU time than spare memory.
  458. XHowever, on a multi-user service or larger workstation the faster
  459. Xresponse provided by a cache can be preferable.  The \opt{cache}
  460. Xoption can be specified on automount points to alter the
  461. Xcaching behaviour (\see \Ref{auto-fs}).
  462. X
  463. X\Subsection{File maps}
  464. XWhen \amd\ searches a file for a map entry it does some simple parsing of the file
  465. Xand supports both comments and continuation lines.
  466. X
  467. XContinuation lines are indicated by a backslash character (``{\verb+\+}'') as
  468. Xthe last character of a line in the file.  The backslash, newline character
  469. X{\em and any leading white space on the following line} are discarded.  A maximum
  470. Xline length of 2047 characters is enforced.  Each line must be terminated by
  471. Xa newline character; that is newlines are terminators, not separators.
  472. X
  473. XAfter a complete line has been read from the file, including continuations,
  474. X\amd\ determines whether there is a comment on the line.
  475. XA comment begins with a hash (``{\tt \#}'') character and continues to the
  476. Xend of the line.
  477. XThere is no way to escape or change the comment lead-in hash character.
  478. X
  479. XFile maps have a default cache mode of {\tt all} (\see \Ref{afs:cache}).
  480. X
  481. X\Subsection{ndbm maps}\label{ndbm-maps}
  482. XAn ndbm map may be used as a fast access form of a file map.
  483. XA program, {\tt mk-amd-map}, converts a normal map file into
  484. Xan ndbm database.  Note that ndbm format files {\em may not} be
  485. Xsharable across machine architectures.
  486. XThe notion of speed generally only applies to large maps;
  487. Xa small map, less than a single disk block, is almost certainly
  488. Xbetter implemented as a file map.
  489. X
  490. Xndbm maps do not support cache mode {\tt all} and
  491. Xhave a default cache mode of {\tt inc} (\see \Ref{afs:cache}).
  492. X
  493. X\Subsection{YP maps}
  494. XWhen using YP, an \amd\ map is implemented directly by the
  495. Xunderlying YP map.
  496. XComments are {\em not} supported
  497. Xin the automounter and must be stripped when constructing the YP server's database.
  498. X
  499. XYP maps do not support cache mode {\tt all} and
  500. Xhave a default cache mode of {\tt inc} (\see \Ref{afs:cache}).
  501. X
  502. X\Subsection{Hesiod}
  503. XWhen the map name begins with the string {\tt hesiod.}\ lookups
  504. Xare made using the {\em Hesiod} name server.  The string following
  505. Xthe dot is used as a name qualifier and is prepended with
  506. Xthe key being resolved.  For example, if the map name is {\tt hesiod.homes}
  507. Xand the key is {\tt jsp} then {\em Hesiod} is asked to resolve
  508. X{\tt jsp.homes.automount}.
  509. X
  510. X%\Subsection{Gdbm}
  511. X
  512. X\Section{Map Lookup}
  513. X
  514. XThe key is located in the map whose type was determined when the
  515. Xautomount point was first created.
  516. XIn general the key is a pathname component.
  517. XIn some circumstances this may be modified by variable expansion
  518. X(\see \Ref{var-expansion})
  519. Xand prefixing.
  520. XIf the automount point has a prefix, specified by the \opt{pref} option, then
  521. Xthat is prepended to the search key before the map is searched.
  522. X
  523. XIf the key cannot be found then a {\em wildcard} match is attempted.
  524. XCurrently this simply attempts to locate a special key ``{\tt *}''.
  525. XIf the wildcard is not found then an error code is propagated back to the
  526. Xkernel, otherwise \amd\ proceeds as if an exact match had been found.
  527. XThe value field is then used to resolve the mount request (\see \Ref{filesystems}).
  528. X
  529. X
  530. X\Section{Location Format}\label{opts:values}
  531. X
  532. XThe value field from the lookup provides the information required to mount a filesystem.
  533. XThe information is parsed according to the syntax shown in figure \ref{figure:so-grammar}.
  534. X\begin{figure}[htb]
  535. X\begin{tabbing}
  536. XIndent \= Long Gram Rule \= \kill
  537. X       \> {\em location-list}:\\
  538. X       \>              \> {\em location}\\
  539. X       \>              \> {\em location-selection}\ {\tt ||}\ {\em location}\\
  540. X       \> {\em location-selection}:\\
  541. X       \>              \> {\em location}\\
  542. X       \>              \> {\em location-selection}\ \ {\em location}\\
  543. X       \> {\em location}:\\
  544. X       \>              \> {\em location-info}\\
  545. X       \>              \> {\tt -}{\em location-info}\\
  546. X       \> {\em location-info}:\\
  547. X       \>              \> {\em sel-or-opt}\\
  548. X       \>              \> {\em location-info}{\tt ;}{\em sel-or-opt}\\
  549. X       \> {\em sel-or-opt}:\\
  550. X       \>              \> {\em selection}\\
  551. X       \>              \> {\em opt-ass}\\
  552. X       \> {\em selection}:\\
  553. X       \>              \> {\rm selector}{\tt ==}{\em value}\\
  554. X       \>              \> {\rm selector}{\tt !=}{\em value}\\
  555. X       \> {\em opt-ass}:\\
  556. X       \>              \> {\rm option}{\tt :=}{\em value}\\
  557. X\end{tabbing}
  558. X\caption{\label{figure:so-grammar}Location syntax}
  559. X\end{figure}
  560. XNote that unquoted whitespace is not allowed in a location description.
  561. X
  562. XA {\em location-selection} is a list of possible filesystems with which to
  563. Xsatisfy the request.  location-selections are separated by the {\tt ||}
  564. Xoperator.  The effect of this operator is to prevent use of location-selections
  565. Xon its right if any of the location-selections on its left were selected
  566. X(see \Ref{selectors}).
  567. X
  568. XThe location-selection, and singleton{\em  location-list},
  569. X{\tt type:=ufs;dev:=/dev/xd1g} would inform \amd\ to mount a
  570. X\UFS\ filesystem from the block special device {\tt /dev/xd1g}.
  571. X
  572. XThe {\em sel-or-opt} component is either the name of an option required by a
  573. Xspecific filesystem, or it is the name of a built-in, predefined selector such
  574. Xas the architecture type.
  575. XThe value may be quoted with double quotes ``{\tt "}'',
  576. Xfor example {\tt type:="ufs";dev:="/dev/xd1g"}.  These quotes are
  577. Xstripped when the value is parsed and there is no way to get a double quote
  578. Xinto a value field.  Double quotes are used to get white space into a value field
  579. Xwhich is needed for the program filesystem (\see \Ref{pfs}).
  580. X
  581. X\label{defaults}A location beginning with a dash ``{\tt -}'' is used
  582. Xto specify default values for subsequent locations.
  583. XAny previously specified defaults are discarded.  The
  584. Xdefault string can be empty in which case no defaults apply.
  585. XThe location {\tt -fs:=/mnt;opts:=ro} would set the local mount point
  586. Xto {\tt /mnt} and cause mounts to be read-only by default.
  587. XDefaults specified this way are appended to, and
  588. Xoverride, any global map defaults given
  589. Xwith {\tt /defaults}\label{/defaults}).
  590. XA {\tt /defaults} value {\em gdef} and a location list
  591. X\begin{quote}
  592. X${\tt -}{\em def}_a\ {\em loc}_{a_1}\ {\em loc}_{a_2}\ \ {\tt -}{\em def}_b\ {\em loc}_{b_1}\ \ldots$
  593. X\end{quote}
  594. Xis equivalent to
  595. X\begin{quote}
  596. X${\tt -}{\em gdef}{\tt ;}{\em def}_a\ {\em loc}_{a_1}\ {\em loc}_{a_2}\ \ {\tt -}{\em gdef}{\tt ;}{\em def}_b\ {\em loc}_{b_1}\ \ldots$
  597. X\end{quote}
  598. X
  599. X\Subsection{Variable expansion}\label{var-expansion}
  600. X
  601. XTo allow generic location specifications \amd\ does variable expansion
  602. Xon each location and also on some of the option strings.
  603. XAny option or selector appearing in the form \Var{{\em var}}
  604. Xis replaced by the current value of that option or selector.
  605. XFor example, if the value of \Var{key} was {\tt bin}, \Var{autodir} was {\tt /a}
  606. Xand \Var{fs} was \Var{autodir}{\tt /local/}\Var{key} then after
  607. Xexpansion \Var{fs} would have the value {\tt /a/local/bin}.
  608. XAny environment variable can be accessed in a similar way.
  609. X
  610. XTwo pathname operators are available when expanding a variable.
  611. XIf the variable name begins with ``{\tt /}'' then only the
  612. Xlast component of then pathname is substituted.  For example,
  613. Xif \Var{path} was {\tt /foo/bar} then \Var{/path} would be
  614. Xexpanded to {\tt bar}.
  615. XSimilarly, if the variable name ends with ``{\tt /}'' then all but
  616. Xthe last component of the pathname is substituted.
  617. XIn the previous example, \Var{path/} would be expanded to {\tt /foo}.
  618. X
  619. XTwo types of expansion are used: the options are expanded and
  620. Xthe selectors are left unexpanded, or {\em vice versa}.
  621. XBefore a map is consulted, any selectors in the name received from the kernel are expanded.
  622. XFor example, if the name is \Var{arch}{\tt .bin} and the
  623. Xmachine architecture is {\tt vax}, the value given to \Var{key}
  624. Xwill be {\tt vax.bin}.
  625. XNext, each location has any selectors expanded.
  626. XFinally, before they are used, the following options have any options expanded:
  627. X\opt{rhost}, \opt{mount}, \opt{unmount}, \opt{sublink}, \opt{rfs} and \opt{fs}.
  628. XIn general this sequence does ``the right thing'' except when one of
  629. Xthe options references one of the other options in which case the
  630. Xordering of expansions becomes significant.
  631. X
  632. X\Subsection{Selectors}\label{selectors}
  633. X
  634. XSelectors are used to control the use of a location.
  635. XIt is possible to share a mount map between many machines in
  636. Xsuch a way that filesystem location, architecture and operating
  637. Xsystem differences are hidden from the users.
  638. XA selector of the form {\tt arch==sun3;os==sos4} would only apply
  639. Xon Sun-3's running SunOS 4.$x$.
  640. X
  641. XSelectors are evaluated left to right.  If a selector fails then that
  642. Xlocation is ignored.  Thus the selectors form a conjunction and the
  643. Xlocations form a disjunction.
  644. XIf all the locations are ignored or otherwise fail then \amd\ uses
  645. Xthe {\em error} filesystem (\see \Ref{error-fs}).  This is equivalent
  646. Xto having a location {\tt type:=error} at the end of each mount-map
  647. Xentry.
  648. X
  649. XThe selectors currently implemented are:
  650. X
  651. X\begin{list}{}%
  652. X{\settowidth{\labelwidth}{{\tt autodir}}\setlength{\leftmargin}{1.2\labelwidth}}
  653. X\item[\tt arch\hfill]
  654. Xthe machine architecture which was automatically determined at compile time.
  655. XThe architecture type can be displayed by running the command {\tt amd~-v}.
  656. XThe currently supported architectures are listed in table \ref{table:arch}.
  657. X\begin{table}[htb]
  658. X\centering
  659. X\begin{tabular}{ll}
  660. XName        & Architecture \\ \hline
  661. X\tt alliant    & Alliant FX/4 \\
  662. X\tt arm        & Acorn ARM \\
  663. X\tt encore      & Encore (reserved) \\
  664. X\tt hp9000    & HP 9000/300 family \\
  665. X\tt hp9k8       & HP 9000/800 family (reserved) \\
  666. X\tt ibm032    & IBM RT PC \\
  667. X\tt macII    & Apple Mac II \\
  668. X\tt mips    & MIPS R2000 \\
  669. X\tt multimax    & Encore Multimax \\
  670. X\tt orion105    & HLH Orion 1/05 \\
  671. X\tt powernode    & Gould Powernode family \\
  672. X\tt sun3    & Sun-3 family \\
  673. X\tt sun4    & Sun-4 family \\
  674. X\tt vax        & DEC \sc Vax \\
  675. X\end{tabular}
  676. X\caption{\label{table:arch}Architectures supported by \amd}
  677. X\end{table}
  678. X
  679. X\item[\tt autodir\hfill]
  680. Xthe default directory under which to mount filesystems.
  681. XThis may be changed by the ``-a'' command line option.
  682. XSee the \opt{fs} option.
  683. X
  684. X\item[\tt byte\hfill]\label{byte-selector}
  685. Xthe machine's byte ordering.  This is either {\tt little}, indicating
  686. Xlittle-endian, or {\tt big}, indicating big-endian.
  687. XOne possible use is to share {\tt rwhod} databases.
  688. XAnother is to share ndbm databases,
  689. Xhowever this use can be considered a courageous juggling act.
  690. X
  691. X\item[\tt cluster\hfill]
  692. Xis provided as a hook for the name of the local cluster.  This can
  693. Xbe used to decide which servers to use for copies of replicated filesystems.
  694. X\Var{cluster} defaults to the value of \Var{domain} unless a different
  695. Xvalue is set with the ``-C'' command line option.
  696. X
  697. X\item[\tt domain\hfill]
  698. Xthe local domain name as specified by the ``-d'' command line option.
  699. XSee {\tt host}.
  700. X
  701. X\item[\tt host\hfill]
  702. Xthe local hostname as determined by {\bf gethostname}(2).
  703. XIf no domain name was specified on the command line
  704. Xand the hostname contains a period ``{\tt .}'' then the string
  705. Xbefore the period is used as the host name, and the string
  706. Xafter the period is assigned to \Var{domain}.
  707. XFor example, if the hostname is {\tt styx.doc.ic.ac.uk} the {\tt host}
  708. Xwould be {\tt styx} and {\tt domain} would be {\tt doc.ic.ac.uk}.
  709. X{\tt hostd} would be {\tt styx.doc.ic.ac.uk}.
  710. X
  711. X\item[\tt hostd\hfill]
  712. Xis \Var{host} and \Var{domain} concatenated with a ``{\tt .}'' inserted between them
  713. Xif required.
  714. XIf \Var{domain} is an empty string then \Var{host} and \Var{hostd} will
  715. Xbe identical.
  716. X
  717. X\item[\tt karch\hfill]
  718. Xis provided as a hook for the kernel architecture.  This is used
  719. Xby SunOS 4, for example to distinguish between different {\tt /usr/kvm} volumes.
  720. X\Var{karch} defaults to the value of \Var{arch} unless a different
  721. Xvalue is set with the ``-k'' command line option.
  722. X
  723. X\item[\tt os\hfill]
  724. Xthe operating system.
  725. XLike the machine architecture, this is automatically determined at compile time.
  726. XThe operating system name can be displayed by running the command {\tt amd~-v}.
  727. XThe currently supported operating systems are listed in table \ref{table:os}.
  728. X\begin{table}[htb]
  729. X\centering
  730. X\begin{tabular}{ll}
  731. XName        & System \\ \hline
  732. X\tt acis43    & 4.3 BSD for IBM RT PC \\
  733. X\tt aux        & System V for Mac-II \\
  734. X\tt bsd44    & 4.4 BSD \\
  735. X\tt concentrix    & Concentrix 5.0 \\
  736. X\tt hlh42    & HLH OTS 1.$x$ (4.2 BSD) \\
  737. X\tt hpux    & HP-UX 6.$x$ \\
  738. X\tt riscix    & Acorn RISC iX \\
  739. X\tt sos3    & SunOS 3.4 \& 3.5 \\
  740. X\tt sos4    & SunOS 4.$x$ \\
  741. X\tt umax43    & Umax 4.3 BSD \\
  742. X\tt u2\_2    & Ultrix 2.2 \\
  743. X\tt u3\_0    & Ultrix 3.0 \\
  744. X\tt utx32    & Gould UTX/32 Rel 2.$x$ \\
  745. X\tt xinu43    & mt Xinu MORE/bsd \\
  746. X\end{tabular}
  747. X\caption{\label{table:os}Operating systems supported by \amd}
  748. X\end{table}
  749. X\end{list}
  750. X
  751. XThe following selectors are also provided.  Unlike the other selectors,
  752. Xthey vary for each lookup.
  753. XNote that when the name from the kernel is expanded prior to a map
  754. Xlookup, these selectors are all defined as empty strings.
  755. X\begin{list}{}%
  756. X{\settowidth{\labelwidth}{{\tt autodir}}\setlength{\leftmargin}{1.2\labelwidth}}
  757. X\item[\tt key\hfill]
  758. Xthe name being resolved.
  759. XFor example, if {\tt /home} is an automount point, then accessing
  760. X{\tt /home/foo}\label{foo-path} would set \Var{key} to the string {\tt foo}.
  761. XThe key is prefixed by the \opt{pref} option set in the parent mount point.
  762. XThe default prefix is an empty string.  If the prefix was {\tt blah/} then
  763. X\Var{key} would be set to {\tt blah/foo}.
  764. X
  765. X\item[\tt map\hfill]
  766. Xthe name of the mount map being used.
  767. X
  768. X\item[\tt path\hfill]
  769. Xthe full pathname of the name being resolved.  For example {\tt /home/foo}
  770. Xin the example above.
  771. X
  772. X\end{list}
  773. X
  774. XSelectors can be negated by using {\tt !=} instead of {\tt ==}.
  775. XFor example to select a location
  776. Xon all non-{\sc Vax} machines the selector {\tt arch!=vax} would be used. 
  777. X
  778. X\Subsection{Options}\label{options}
  779. X
  780. XOptions are parsed concurrently with selectors.  The difference is that
  781. Xwhen an option is seen the string following the ``{\tt :=}'' is recorded for
  782. Xlater use.  As a minimum the \opt{type} option must be specified.
  783. XEach filesystem type has other options which must also be specified.
  784. XThe filesystem specific options are detailed in \Ref{filesystems}.
  785. X
  786. XThe following options apply to more than one filesystem type:
  787. X\begin{list}{}
  788. X{\settowidth{\labelwidth}{{\tt sublink}}\setlength{\leftmargin}{1.2\labelwidth}}
  789. X\item[\tt delay\hfill]
  790. Xthe delay, in seconds, before an attempt will be made to mount from the current location.
  791. XAuxilliary data, such as network address, file handles and so on are computed
  792. Xregardless of this value.
  793. XA delay can be used to implement the notion of primary and secondary file servers.
  794. XThe secondary servers would have a delay of a few seconds,
  795. Xthus giving the primary servers a chance to respond first.
  796. X
  797. X\item[\tt fs\hfill]\label{mount location}
  798. Xthe local mount point.
  799. XThe semantics of this option vary between filesystems.
  800. X
  801. XFor \NFS\ and \UFS\ filesystems the value of \Var{fs} is used as the local
  802. Xmount point.  It is important that this string uniquely identifies the
  803. Xfilesystem being mounted.  To satisfy this requirement, it should contain the
  804. Xname of the host on which the filesystem is resident and the pathname
  805. Xof the filesystem on the local or remote host.
  806. X
  807. XThe reason for
  808. Xrequiring the hostname is clear if replicated filesystems are considered.
  809. XIf a fileserver goes down and a replacement filesystem is mounted then the {\em local}
  810. Xmount point {\em must} be different from that of the filesystem which
  811. Xis hung.
  812. XSome encoding of the filesystem name is required if more than one filesystem
  813. Xis to be mounted from any given host.
  814. X
  815. XIf the hostname is first in the path then all mounts from a particular
  816. Xhost will be gathered below a single directory.  If that server goes
  817. Xdown then the hung mount points are less likely to be accidentally referenced,
  818. Xfor example when {\bf getwd}(3) traverses the namespace to find the pathname
  819. Xof the current directory.
  820. X
  821. XThe {\tt fs} defaults to \Var{autodir}/\Var{rhost}\Var{rfs}.
  822. XIn addition, {\tt rhost} defaults to the local host name (\Var{host}) and
  823. X{\tt rfs} defaults to the value of \Var{path}, which
  824. Xis the full path of the requested file; {\tt /home/foo}
  825. Xin the example above (\see \Ref{foo-path}).
  826. X\Var{autodir} defaults to {\tt /a} but may be changed with the ``-a''
  827. Xcommand line option\footnote{Sun's automounter defaults to {\tt /tmp\_mnt}}.
  828. XNote that there is no ``{\tt /}'' between the \Var{rhost} and \Var{rfs} since
  829. X\Var{rfs} begins with a ``{\tt /}''.
  830. X
  831. X\item[\tt opts\hfill]
  832. Xthe options to pass to the mount system call.
  833. XA leading ``{\tt -}'' is silently ignored.
  834. XThe mount options supported generally correspond to
  835. Xthose used by {\bf mount}(8) and are listed in table \ref{table:mount opts}.
  836. XSome additional pseudo-options are interpreted by \amd\ and
  837. Xare listed in table \ref{table:pseudo-mount opts}.
  838. XUnless specifically overridden, each of the system default mount
  839. Xoptions applies.
  840. XAny options not recognised are ignored.
  841. XIf no options list is supplied the string {\tt rw,defaults} is used
  842. Xand all the system default mount options apply.
  843. X\begin{table}[htb]
  844. X\centering
  845. X\begin{tabular}{lp{4in}}
  846. XOption        & Semantics \\\hline
  847. X\tt grpid    & Use BSD directory group-id semantics. \\
  848. X\tt intr    & Allow keyboard interrupts on hard mounts. \\
  849. X\tt nodevs    & Don't allow local special devices on this filesystem. \\
  850. X\tt nosuid    & Don't allow set-uid or set-gid executables on this filesystem. \\
  851. X\tt quota    & Enable quota checking on this mount. \\
  852. X\tt retrans=$n$    & The number of \NFS\ retransmits made before a user error is generated
  853. X          by a {\tt soft} mounted filesystem, and before a
  854. X          {\tt hard} mounted filesystem reports {\tt NFS server {\em yoyo}
  855. X          not responding still trying}. \\
  856. X\tt ro        & Mount this filesystem readonly. \\
  857. X\tt soft    & Give up after {\em retrans} retransmissions. \\
  858. X\tt timeo=$n$    & The \NFS\ timeout, in tenth-seconds, before a request is retransmitted. \\
  859. X\end{tabular}
  860. X\caption{Mount options passed to the mount system call\label{table:mount opts}}
  861. X\end{table}
  862. X
  863. X\begin{table}[htb]
  864. X\centering
  865. X\begin{tabular}{lp{4in}}
  866. XOption        & Semantics \\\hline
  867. X\tt notimeout    & Configures the mount so that its time-to-live will
  868. X          never expire.  This is also the default for some
  869. X          filesystem types. \\
  870. X%
  871. X% Implementation broken:
  872. X%\tt ping=$n$    & The interval, in seconds, between keep-alive pings.  When four
  873. X%          consecutive pings have failed the mount point is
  874. X%          marked as hung.  This interval defaults to 3 seconds.  \\
  875. X%
  876. X\tt retry=$n$    & The number of times to retry the mount system call. \\
  877. X\tt utimeout=$n$& The interval, in seconds, by which the mount's
  878. X          time-to-live\label{opt:utimeout}
  879. X          is extended after an unmount attempt has failed.
  880. X          In fact the interval is extended before the unmount
  881. X          is attempted to avoid thrashing. \\
  882. X\end{tabular}
  883. X\caption{Mount options interpreted by \amd\label{table:pseudo-mount opts}}
  884. X\end{table}
  885. X
  886. X\item[\tt sublink\hfill]
  887. Xthe subdirectory within the mounted filesystem to which the reference
  888. Xshould point.
  889. XThis can be used to prevent duplicate mounts in cases where multiple
  890. Xdirectories in the same mounted filesystem are used.
  891. X
  892. X\item[\tt type\hfill]
  893. Xthe filesystem type to be used.  A full description of each
  894. Xtype is given in \Ref{filesystems}.
  895. X
  896. X\end{list}
  897. X
  898. XSuperfluous option specifications are ignored and are not reported
  899. Xas errors.
  900. X
  901. X\Chapter{Command Line Options}
  902. XMany of \amd's parameters can be set from the command line.
  903. XThe command line is also used to specify automount points
  904. Xand maps.
  905. X
  906. XThe general format of a command line is
  907. X\begin{quote}
  908. X{\tt amd} {\em options} directory map-name [{\tt -}{\em map-options}] \ldots
  909. X\end{quote}
  910. XFor each directory and map-name given, \amd\ establishes an automount point.
  911. X%In addition, unless the ``-m'' option is given (see below), \amd\ enumerates
  912. X%the YP maps {\tt am.master} and {\tt auto.master} to obtain a further list of
  913. X%automount points to create.
  914. XThe {\em map-options} may be any sequence of options or selectors as described
  915. Xin \Ref{opts:values}.
  916. XThe {\em map-options} apply only to \amd's mount point.  Default options for
  917. Xa map are read from a special entry in the map whose key is the string
  918. X{\tt /defaults}.
  919. XWhen default options are given they are prepended to any
  920. Xoptions specified in the mount-map locations as explained in \Ref{/defaults}.
  921. X
  922. XThe {\em options} are any combination of the following:
  923. X
  924. X\begin{description}
  925. X\item[\tt -a \em directory]\mbox{}\\
  926. Xspecifies the default mount directory.
  927. XThis option changes the variable \Var{autodir} which
  928. Xotherwise defaults to {\tt /a}.
  929. XFor example, some sites prefer {\tt /am}.
  930. X\begin{quote}
  931. X\tt
  932. Xamd -a /am ...
  933. X\end{quote}
  934. X
  935. X\item[\tt -c \em cache-interval]\mbox{}\\
  936. Xselects the period for which a name is cached by \amd.  If no
  937. Xreference is made to the filesystem in this period,
  938. X\amd\ attempts to unmount the filesystem.
  939. XIf the unmount fails the interval is extended by a further period
  940. Xas specified by the {\tt -w} command line option or by the {\tt utimeout} mount option.
  941. XThe default {\em cache-interval} is five minutes.
  942. X
  943. X\item[\tt -d \em domain]\mbox{}\\
  944. Xspecifies the host's domain.  This sets the internal variable \Var{domain}
  945. Xand affects the \Var{hostd} variable.
  946. XIf this option is not specified and
  947. Xthe hostname already contains the local domain then that is
  948. Xused, otherwise the default value of \Var{domain} is {\tt unknown.domain}.
  949. XFor example, if the local domain was {\tt doc.ic.ac.uk}, \amd\ could be
  950. Xstarted as follows:
  951. X\begin{quote}
  952. X\tt
  953. Xamd -d doc.ic.ac.uk ...
  954. X\end{quote}
  955. X
  956. X\item[\tt -k \em kernel-architecture]\mbox{}\\
  957. Xspecifies the kernel architecture of the system.  This is usually
  958. Xthe output of {\tt arch -k} and its only effect is to set the
  959. Xvariable \Var{karch}.  If this option is not given, \Var{karch}
  960. Xhas the same value as \Var{arch}.
  961. XThis would be used as follows:
  962. X\begin{quote}
  963. X\tt
  964. Xamd -k `arch -k` ...
  965. X\end{quote}
  966. X
  967. X\item[\tt -l \em log-option]\mbox{}\\
  968. Xselects the form of logging to be made.
  969. XTwo special {\em log-option}s are recognised.
  970. XIf {\em log-option} is the string {\tt syslog}, \amd\ will use
  971. Xthe {\bf syslog}(3) mechanism.
  972. XIf {\em log-option} is the string {\tt /dev/stderr}\footnote{
  973. XThis pathname is interpreted internally by \amd; a {\tt /dev/fd}
  974. Xdriver is not required.
  975. X}, \amd\ will use
  976. Xstandard error which is also the default value.
  977. XAny other string is taken as a filename to
  978. Xuse for logging.  Log messages are appended to the file if it already
  979. Xexists, otherwise a new file is created.
  980. XIf the syslog option is specified but the system does not support syslog or
  981. Xif the named file cannot be opened or created, \amd\ will use standard error.
  982. XError messages generated before \amd\ has finished parsing the command line
  983. Xare printed on standard error.
  984. XUsing {\tt syslog} is usually best, in which case \amd\ would be
  985. Xstarted as follows:
  986. X\begin{quote}
  987. X\tt
  988. Xamd -l syslog ...
  989. X\end{quote}
  990. X
  991. X%\item[\tt -m]\mbox{}\\
  992. X%is an obsolete option that was the equivalent of appending
  993. X%{\tt `ypcat -k am.master`} to the command line.
  994. X%tells \amd\ {\em not} to obtain a list of automount points from Yellow Pages.
  995. X%By default, \amd\ attempts to enumerate the YP maps {\tt am.master} and {\tt auto.master}.
  996. X%The default YP domain is used unless the ``-y'' option is given.
  997. X%{\em This option will be removed in the next release.}
  998. X
  999. X\item[\tt -n]\mbox{}\\
  1000. Xnormalises the remote hostname before using it.
  1001. XNormalisation is done by replacing the value of \Var{rhost} with the primary name returned by
  1002. Xa hostname lookup.
  1003. XThis option should be used if several names are used to refer to a single host in a
  1004. Xmount map.
  1005. X
  1006. X\item[\tt -p]\mbox{}\\
  1007. Xcauses \amd's process id to be printed on standard output.
  1008. XThis can be redirected to a suitable file for use with kill:
  1009. X\begin{quote}
  1010. X\tt
  1011. Xamd -p > /etc/amd.pid ...
  1012. X\end{quote}
  1013. X
  1014. X\item[\tt -r]\mbox{}\\
  1015. Xtells \amd\ to restart existing mounts (see the Inheritance File System \Ref{ifs}).
  1016. X%{\em This option will be made the default in the next release.}
  1017. X
  1018. X\item[\tt -t \em afs-timeout.afs-retransmit]\mbox{}\\
  1019. Xspecifies the RPC timeout and retransmit intervals used by the kernel to communicate
  1020. Xto \amd.  These are used to set the {\tt timeo} and {\tt retrans} mount options.
  1021. X\Amd\ relies on the kernel RPC retry mechanism to trigger mount retries.  The
  1022. Xvalue of this parameter changes the retry interval.  Too long an interval
  1023. Xgives poor interactive response, too short an interval causes excessive
  1024. Xretries.
  1025. X
  1026. X\item[\tt -v]\mbox{}\\
  1027. Xprint version information on standard error and then exit.
  1028. XThe output is of the form:
  1029. X\begin{verbatim}
  1030. XAmd 5.0.1.8 of 89/10/23 12:22:00 beta20 #37: Wed Nov  1 11:03:09 GMT 1989
  1031. XBuilt by jsp@charm.doc.ic.ac.uk for a sun4 running sos4 (big-endian)
  1032. XMap support for: root, hesiod, yp, ndbm, file, error.
  1033. X\end{verbatim}
  1034. XThe information includes the version number, release date and name
  1035. Xof the release.
  1036. XThe architecture (\see \Ref{table:arch}), operating system (\see \Ref{table:os})
  1037. Xand byte ordering are also printed as they appear in the \Var{os},
  1038. X\Var{arch} and \Var{byte} variables.
  1039. X
  1040. X\item[\tt -w \em wait-timeout]\label{opt:wait}\mbox{}\\
  1041. Xselects the interval between unmount attempts after
  1042. Xthe initial time-to-live has expired.
  1043. XThis defaults to 120 seconds.
  1044. X
  1045. X\item[\tt -x \em opts]\mbox{}\\
  1046. Xspecifies the type and verbosity of log messages.  {\em opts} is
  1047. Xa comma separated list selected from the options in table \ref{table:x opts}.
  1048. X\begin{table}[htb]
  1049. X\centering
  1050. X\begin{tabular}{ll}
  1051. XLog option  & Messages logged \\\hline
  1052. X\tt fatal   & Fatal errors \\
  1053. X\tt error   & Non-fatal errors \\
  1054. X\tt user    & Non-fatal user errors \\
  1055. X\tt warn    & Recoverable errors \\
  1056. X\tt warning & Alias for \tt warn \\
  1057. X\tt info    & Information messages \\
  1058. X\tt map     & Mount map usage \\
  1059. X\tt all     & All of the above \\
  1060. X\end{tabular}
  1061. X\caption{Logging options\label{table:x opts}}
  1062. X\end{table}
  1063. XThe default logging option is {\tt -x~all,nomap}.
  1064. XIn general production use, the
  1065. Xoption {\tt -x~fatal,error} is most useful.  The {\tt info} messages
  1066. Xinclude details of what is mounted and unmounted and when filesystems
  1067. Xhave timed out.  The messages given by {\tt user} relate to errors
  1068. Xin the mount maps, so these are useful when new maps are installed.
  1069. X
  1070. XThe options can be prefixed by the string {\tt no} to indicate
  1071. Xthat this option should be turned off.  For example, to obtain all
  1072. Xbut {\tt info} messages the option {\tt -x~all,noinfo} would be used
  1073. Xor, since {\tt -x~all} is the default, simply {\tt -x~noinfo}.
  1074. X
  1075. X\item[\tt -y \em yp-domain]\mbox{}\\
  1076. Xselects an alternate YP domain.  This is useful for debugging and
  1077. Xcross-domain shared mounting.
  1078. XIf this flag is specified, \amd\ immediately attempts to
  1079. Xbind to a server for this domain.
  1080. X%\Amd\ refers to YP maps when it starts, unless the ``-m'' option
  1081. X%is specified, and whenever required in a mount map.
  1082. X
  1083. X\item[\tt -C \em cluster-name]\mbox{}\\
  1084. Xspecifies the name of the cluster of which the local machine is a member.
  1085. XThe only effect is to set the variable \Var{cluster}.
  1086. XThe {\em cluster-name} is will usually obtained by running another command which uses
  1087. Xa database to map the local hostname into a cluster name.
  1088. X\Var{cluster} can then be used as a selector to restrict mounting of
  1089. Xreplicated data.
  1090. XIf this option is not given, \Var{cluster} has the same value as \Var{domain}.
  1091. XThis would be used as follows:
  1092. X\begin{quote}
  1093. X\tt
  1094. Xamd -C `clustername` ...
  1095. X\end{quote}
  1096. X
  1097. X\item[\tt -D {\em opts}]\mbox{}\\
  1098. Xcontrols the verbosity and coverage of the debugging trace;
  1099. X{\em opts} is a comma separated list of debugging options.
  1100. XThe ``-D'' option is only available if \amd\ was compiled with {\tt -DDEBUG}.
  1101. XThe memory debugging facilities are
  1102. Xonly available if \amd\ was compiled with {\tt -DDEBUG\_MEM}
  1103. X(in addition to {\tt -DDEBUG}).
  1104. XThe most common options to use are {\tt -D~trace} and {\tt -D~test}
  1105. X(which turns on all the useful debug options).
  1106. XSee the program source for a more detailed explanation of the available options.
  1107. X
  1108. X\end{description}
  1109. X
  1110. XWhen the command line has been parsed, the automount points are mounted.
  1111. XThe mount points are created if they do not already exist, in which case they
  1112. Xwill be removed when \amd\ exits.
  1113. XFinally, \amd\ disassociates itself from its controlling terminal and
  1114. Xforks into the background.
  1115. X
  1116. X{\em Note\/}: Even if \amd\ has been built with {\tt -DDEBUG} it
  1117. Xwill still background itself and disassociate itself from the controlling terminal.
  1118. XTo use a debugger it is necessary to
  1119. Xspecify {\tt -D~nodaemon} on the command line.
  1120. X
  1121. X\Chapter{Filesystems}\label{filesystems}
  1122. X
  1123. XFrom the point of view of \amd, a {\em filesystem} is anything
  1124. Xthat can resolve an incoming name lookup.
  1125. XAn important feature is support for multiple filesystem types.
  1126. XSome of these filesystems are implemented in
  1127. Xthe local kernel and some on remote fileservers, whilst the others are implemented
  1128. Xinternally by \amd.
  1129. X
  1130. XThe two common filesystem types are \UFS\ and \NFS.
  1131. XFour other user accessible filesystems ({\tt link}, {\tt program}, {\tt auto}
  1132. Xand {\tt direct}) are also implemented
  1133. Xinternally by \amd\ and these are described below.
  1134. XThere are two additional filesystem
  1135. Xtypes internal to \amd\ which are not directly accessible
  1136. Xto the user ({\tt inherit} and {\tt error}).  Their use is described since they may
  1137. Xstill have an effect visible to the user.
  1138. X
  1139. X\Section[Network Filesystem]{Network Filesystem ({\tt type:=nfs})}
  1140. X
  1141. XThe {\em nfs} filesystem type provides access to Sun's \NFS.
  1142. XThe following options may be specified:
  1143. X\begin{description}
  1144. X\item[\tt rhost]
  1145. Xthe remote fileserver.  This must be an entry in the hosts database.
  1146. XIP addresses \cite{rfc:ip} are not accepted.
  1147. XThe default value is taken from the local host name (\Var{host})
  1148. Xif no other value is specified.
  1149. X
  1150. X\item[\tt rfs]
  1151. Xthe remote filesystem.
  1152. XIf no value is specified for this option, an internal default of
  1153. X\Var{path} is used.
  1154. X
  1155. X\end{description}
  1156. X
  1157. X\NFS\ mounts require a two stage process.  First, the {\em file handle} of
  1158. Xthe remote file system must be obtained from the server.  Then a mount
  1159. Xsystem call must be done on the local system.
  1160. X\Amd\ keeps a cache of file handles for remote file systems.  The cache
  1161. Xentries have a lifetime of a few minutes.
  1162. X
  1163. XIf a required file handle is not in the cache, \amd\ sends a request
  1164. Xto the remote server to obtain it.  \Amd\ {\em does not} wait for
  1165. Xa response; it notes that one of the locations needs retrying, but
  1166. Xcontinues with any remaining locations.  When the file handle becomes
  1167. Xavailable, and assuming none of the other locations was successfully
  1168. Xmounted, \amd\ will retry the mount.  This mechanism allows several
  1169. X\NFS\ filesystems to be mounted in parallel\footnote{The mechanism
  1170. Xis general, however \NFS\ is the only filesystem
  1171. Xfor which the required hooks have been written.}.
  1172. XThe first one which
  1173. Xresponds with a valid file handle will be used.
  1174. X
  1175. XAn \NFS\ entry might be:
  1176. X\begin{quote}
  1177. X\tt
  1178. Xjsp\ \ host!=charm;type:=nfs;rhost:=charm;rfs:=/home/charm;sublink:=jsp
  1179. X\end{quote}
  1180. X
  1181. XThe mount system call and any unmount attempts are always done
  1182. Xin a new task to avoid the possibilty of blocking \amd.
  1183. X
  1184. X\Section[\Unix\ Filesystem]{\Unix\ Filesystem ({\tt type:=ufs})}
  1185. X
  1186. XThe {\em ufs} filesystem type provides access to the system's
  1187. Xstandard disk filesystem---usually the Berkeley Fast Filesystem \cite{bsd:ufs}.
  1188. XThe following option must be specified:
  1189. X\begin{description}
  1190. X\item[\tt dev]
  1191. Xthe block special device to be mounted.
  1192. X\end{description}
  1193. X
  1194. XA \UFS\ entry might be:
  1195. X\begin{quote}
  1196. X\tt
  1197. Xjsp\ \ \ host==charm;type:=ufs;dev:=/dev/xd0g;sublink:=jsp
  1198. X\end{quote}
  1199. X
  1200. X\Section[Program Filesystem]{Program Filesystem ({\tt type:=program})}\label{pfs}
  1201. X
  1202. XThe {\em program} filesystem type allows a program to be run
  1203. Xwhenever a mount or unmount is required.  This allows easy
  1204. Xaddition of support for other filesystem types, such as MIT's
  1205. XRemote Virtual Disk (RVD) \cite{mit:rvd} which has a programmatic interface via
  1206. Xthe commands {\tt rvdmount} and {\tt rvdunmount}.
  1207. X
  1208. XThe following options must be specified:
  1209. X\begin{description}
  1210. X\item[mount]
  1211. Xthe program which will perform the mount.
  1212. X
  1213. X\item[unmount]
  1214. Xthe program which will perform the unmount.
  1215. X\end{description}
  1216. X
  1217. XThe exit code from these two programs is interpreted as a \Unix\ error
  1218. Xcode.  As usual, exit code zero indicates success.
  1219. XTo execute the program \amd\ splits the string on whitespace to
  1220. Xcreate an array of substrings.
  1221. XSingle quotes ``{\tt '}'' can be used to quote whitespace if that is
  1222. Xrequired in an argument.  There is no way to escape or change the quote character.
  1223. XTo run the program {\tt rvdmount} with a host name and filesystem as
  1224. Xarguments would be specified by {\tt mount:="/etc/rvdmount rvdmount fserver \$\{path\}"}.
  1225. X
  1226. XThe first element in the array is taken as the pathname of the program
  1227. Xto execute.  The other members of the array form the argument vector
  1228. Xto be passed to the program, {\em including argument zero}.  This means
  1229. Xthat the split string must have at least two elements.
  1230. XThe program is directly executed by \amd, not via a shell.
  1231. X
  1232. END_OF_FILE
  1233. if test 49780 -ne `wc -c <'doc/amd.tex.1'`; then
  1234.     echo shar: \"'doc/amd.tex.1'\" unpacked with wrong size!
  1235. fi
  1236. # end of 'doc/amd.tex.1'
  1237. fi
  1238. echo shar: End of archive 13 \(of 13\).
  1239. cp /dev/null ark13isdone
  1240. MISSING=""
  1241. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
  1242.     if test ! -f ark${I}isdone ; then
  1243.     MISSING="${MISSING} ${I}"
  1244.     fi
  1245. done
  1246. if test "${MISSING}" = "" ; then
  1247.     echo You have unpacked all 13 archives.
  1248.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1249. else
  1250.     echo You still need to unpack the following archives:
  1251.     echo "        " ${MISSING}
  1252. fi
  1253. ##  End of shell archive.
  1254. exit 0
  1255. exit 0 # Just in case...
  1256.