[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3. Mount Maps

Amd has no built-in knowledge of machines or filesystems. External mount-maps are used to provide the required information. Specifically, Amd needs to know when and under what conditions it should mount filesystems.

The map entry corresponding to the requested name contains a list of possible locations from which to resolve the request. Each location specifies filesystem type, information required by that filesystem (for example the block special device in the case of UFS), and some information describing where to mount the filesystem (see section fs Option). A location may also contain selectors (see section Selectors).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1 Map Types

A mount-map provides the run-time configuration information to Amd. Maps can be implemented in many ways. Some of the forms supported by Amd are regular files, ndbm databases, NIS maps, the Hesiod name server, and even the password file.

A mount-map name is a sequence of characters. When an automount point is created a handle on the mount-map is obtained. For each map type configured, Amd attempts to reference the map of the appropriate type. If a map is found, Amd notes the type for future use and deletes the reference, for example closing any open file descriptors. The available maps are configured when Amd is built and can be displayed by running the command `amd -v'.

When using an Amd configuration file (see section Amd Configuration File) and the keyword `map_type' (see section map_type Parameter), you may force the map used to any type.

By default, Amd caches data in a mode dependent on the type of map. This is the same as specifying `cache:=mapdefault' and selects a suitable default cache mode depending on the map type. The individual defaults are described below. The cache option can be specified on automount points to alter the caching behavior (see section Automount Filesystem (`auto')).

The following map types have been implemented, though some are not available on all machines. Run the command `amd -v' to obtain a list of map types configured on your machine.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.1 File maps

When Amd searches a file for a map entry it does a simple scan of the file and supports both comments and continuation lines.

Continuation lines are indicated by a backslash character (`\') as the last character of a line in the file. The backslash, newline character and any leading white space on the following line are discarded. A maximum line length of 2047 characters is enforced after continuation lines are read but before comments are stripped. Each line must end with a newline character; that is newlines are terminators, not separators. The following examples illustrate this:

 
key     valA   valB;   \
          valC

specifies three locations, and is identical to

 
key     valA   valB;   valC

However,

 
key     valA   valB;\
          valC

specifies only two locations, and is identical to

 
key     valA   valB;valC

After a complete line has been read from the file, including continuations, Amd determines whether there is a comment on the line. A comment begins with a hash ("`#'") character and continues to the end of the line. There is no way to escape or change the comment lead-in character.

Note that continuation lines and comment support only apply to file maps, or ndbm maps built with the mk-amd-map program.

When caching is enabled, file maps have a default cache mode of all (see section Automount Filesystem (`auto')).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.2 ndbm maps

An ndbm map may be used as a fast access form of a file map. The program, mk-amd-map, converts a normal map file into an ndbm database. This program supports the same continuation and comment conventions that are provided for file maps. Note that ndbm format files may not be sharable across machine architectures. The notion of speed generally only applies to large maps; a small map, less than a single disk block, is almost certainly better implemented as a file map.

ndbm maps have a default cache mode of `all' (see section Automount Filesystem (`auto')).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.3 NIS maps

When using NIS (formerly YP), an Amd map is implemented directly by the underlying NIS map. Comments and continuation lines are not supported in the automounter and must be stripped when constructing the NIS server's database.

NIS maps have a default cache mode of all (see section Automount Filesystem (`auto')).

The following rule illustrates what could be added to your NIS `Makefile', in this case causing the `amd.home' map to be rebuilt:

 
$(YPTSDIR)/amd.home.time: $(ETCDIR)/amd.home
    -@sed -e "s/#.*$$//" -e "/^$$/d" $(ETCDIR)/amd.home | \
      awk '{  \
         for (i = 1; i <= NF; i++) \
             if (i == NF) { \
             if (substr($$i, length($$i), 1) == "\\") \
                 printf("%s", substr($$i, 1, length($$i) - 1)); \
             else \
                 printf("%s\n", $$i); \
             } \
             else \
             printf("%s ", $$i); \
         }' | \
    $(MAKEDBM) - $(YPDBDIR)/amd.home; \
    touch $(YPTSDIR)/amd.home.time; \
    echo "updated amd.home"; \
    if [ ! $(NOPUSH) ]; then \
        $(YPPUSH) amd.home; \
        echo "pushed amd.home"; \
    else \
        : ; \
    fi

Here $(YPTSDIR) contains the time stamp files, and $(YPDBDIR) contains the dbm format NIS files.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.4 NIS+ maps

NIS+ maps do not support cache mode `all' and, when caching is enabled, have a default cache mode of `inc'.

XXX: FILL IN WITH AN EXAMPLE.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.5 Hesiod maps

When the map name begins with the string `hesiod.' lookups are made using the Hesiod name server. The string following the dot is used as a name qualifier and is prepended with the key being located. The entire string is then resolved in the automount context, or the amd.conf parameter `hesiod_base' (see section hesiod_base Parameter). For example, if the key is `jsp' and map name is `hesiod.homes' then Hesiod is asked to resolve `jsp.homes.automount'.

Hesiod maps do not support cache mode `all' and, when caching is enabled, have a default cache mode of `inc' (see section Automount Filesystem (`auto')).

The following is an example of a Hesiod map entry:

 
jsp.homes.automount HS TXT "rfs:=/home/charm;rhost:=charm;sublink:=jsp"
njw.homes.automount HS TXT "rfs:=/home/dylan/dk2;rhost:=dylan;sublink:=njw"

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.6 Password maps

The password map support is unlike the four previous map types. When the map name is the string `/etc/passwd' Amd can lookup a user name in the password file and re-arrange the home directory field to produce a usable map entry.

Amd assumes the home directory has the format `/anydir/dom1/../domN/login'. It breaks this string into a map entry where ${rfs} has the value `/anydir/domN', ${rhost} has the value `domN.....dom1', and ${sublink} has the value login.

Thus if the password file entry was

 
/home/achilles/jsp

the map entry used by Amd would be

 
rfs:=/home/achilles;rhost:=achilles;sublink:=jsp

Similarly, if the password file entry was

 
/home/cc/sugar/mjh

the map entry used by Amd would be

 
rfs:=/home/sugar;rhost:=sugar.cc;sublink:=mhj

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.7 Union maps

The union map support is provided specifically for use with the union filesystem, see section Union Filesystem (`union').

It is identified by the string `union:' which is followed by a colon separated list of directories. The directories are read in order, and the names of all entries are recorded in the map cache. Later directories take precedence over earlier ones. The union filesystem type then uses the map cache to determine the union of the names in all the directories.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.8 LDAP maps

LDAP (Lightweight Directory Access Protocol) maps do not support cache mode `all' and, when caching is enabled, have a default cache mode of `inc'.

For example, an Amd map `amd.home' that looks as follows:

 
/defaults    opts:=rw,intr;type:=link

zing         -rhost:=shekel \
             host==shekel \
             host!=shekel;type:=nfs

when converted to LDAP (see section amd2ldif), will result in the following LDAP database:

 
$ amd2ldif amd.home CUCS < amd.home
dn: cn=amdmap timestamp, CUCS
cn             : amdmap timestamp
objectClass    : amdmapTimestamp
amdmapTimestamp: 873071363

dn: cn=amdmap amd.home[/defaults], CUCS
cn          : amdmap amd.home[/defaults]
objectClass : amdmap
amdmapName  : amd.home
amdmapKey   : /defaults
amdmapValue : opts:=rw,intr;type:=link

dn: cn=amdmap amd.home[], CUCS
cn          : amdmap amd.home[]
objectClass : amdmap
amdmapName  : amd.home
amdmapKey   :
amdmapValue :

dn: cn=amdmap amd.home[zing], CUCS
cn          : amdmap amd.home[zing]
objectClass : amdmap
amdmapName  : amd.home
amdmapKey   : zing
amdmapValue : -rhost:=shekel host==shekel host!=shekel;type:=nfs

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.9 Executable maps

An executable map is a dynamic map in which the keys and values for the maps are generated on the fly by a program or script. The program is expected to take a single parameter argument which is the key to lookup. If the key is found, the program should print on stdout the key-value pair that were found; if the key was not found, nothing should be printed out. Below is an sample of such a map script:

 
#!/bin/sh
# executable map example
case "$1" in
    "/defaults" )
	echo "/defaults   type:=nfs;rfs:=filer"
	;;
    "a" )
	echo "a   type:=nfs;fs:=/tmp"
	;;
    "b" )
	echo "b   type:=link;fs:=/usr/local"
	;;
    * )  # no match, echo nothing
	;;
esac

See section exec_map_timeout Parameter.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2 How keys are looked up

The key is located in the map whose type was determined when the automount point was first created. In general the key is a pathname component. In some circumstances this may be modified by variable expansion (see section Variable Expansion) and prefixing. If the automount point has a prefix, specified by the pref option, then that is prepended to the search key before the map is searched.

If the map cache is a `regexp' cache then the key is treated as an egrep-style regular expression, otherwise a normal string comparison is made.

If the key cannot be found then a wildcard match is attempted. Amd repeatedly strips the basename from the key, appends `/*' and attempts a lookup. Finally, Amd attempts to locate the special key `*'.

For example, the following sequence would be checked if `home/dylan/dk2' was being located:

 
   home/dylan/dk2
   home/dylan/*
   home/*
   *

At any point when a wildcard is found, Amd proceeds as if an exact match had been found and the value field is then used to resolve the mount request, otherwise an error code is propagated back to the kernel. (see section Filesystem Types).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3 Location Format

The value field from the lookup provides the information required to mount a filesystem. The information is parsed according to the syntax shown below.

 
location-list:
                  location-selection
                  location-list white-space || white-space location-selection
location-selection:
                  location
                  location-selection white-space location
location:
                  location-info
                  -location-info
                  -
location-info:
                  sel-or-opt
                  location-info;sel-or-opt
                  ;
sel-or-opt:
                  selection
                  opt-ass
selection:
                  selector==value
                  selector!=value
opt-ass:
                  option:=value
white-space:
                  space
                  tab

Note that unquoted whitespace is not allowed in a location description. White space is only allowed, and is mandatory, where shown with non-terminal white-space.

A location-selection is a list of possible volumes with which to satisfy the request. Each location-selection is tried sequentially, until either one succeeds or all fail. This, by the way, is different from the historically documented behavior, which claimed (falsely, at least for last 3 years) that Amd would attempt to mount all location-selections in parallel and the first one to succeed would be used.

location-selections are optionally separated by the `||' operator. The effect of this operator is to prevent use of location-selections to its right if any of the location-selections on its left were selected, whether or not any of them were successfully mounted (see section Selectors).

The location-selection, and singleton location-list, `type:=ufs;dev:=/dev/xd1g' would inform Amd to mount a UFS filesystem from the block special device `/dev/xd1g'.

The sel-or-opt component is either the name of an option required by a specific filesystem, or it is the name of a built-in, predefined selector such as the architecture type. The value may be quoted with double quotes `"', for example `type:="ufs";dev:="/dev/xd1g"'. These quotes are stripped when the value is parsed and there is no way to get a double quote into a value field. Double quotes are used to get white space into a value field, which is needed for the program filesystem (see section Program Filesystem (`program')).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.1 Map Defaults

A location beginning with a dash `-' is used to specify default values for subsequent locations. Any previously specified defaults in the location-list are discarded. The default string can be empty in which case no defaults apply.

The location `-fs:=/mnt;opts:=ro' would set the local mount point to `/mnt' and cause mounts to be read-only by default. Defaults specified this way are appended to, and so override, any global map defaults given with `/defaults').


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.2 Variable Expansion

To allow generic location specifications Amd does variable expansion on each location and also on some of the option strings. Any option or selector appearing in the form $var is replaced by the current value of that option or selector. For example, if the value of ${key} was `bin', ${autodir} was `/a' and ${fs} was `${autodir}/local/${key}' then after expansion ${fs} would have the value `/a/local/bin'. Any environment variable can be accessed in a similar way.

Two pathname operators are available when expanding a variable. If the variable name begins with `/' then only the last component of the pathname is substituted. For example, if ${path} was `/foo/bar' then ${/path} would be expanded to `bar'. Similarly, if the variable name ends with `/' then all but the last component of the pathname is substituted. In the previous example, ${path/} would be expanded to `/foo'.

Two domain name operators are also provided. If the variable name begins with `.' then only the domain part of the name is substituted. For example, if ${rhost} was `swan.doc.ic.ac.uk' then ${.rhost} would be expanded to `doc.ic.ac.uk'. Similarly, if the variable name ends with `.' then only the host component is substituted. In the previous example, ${rhost.} would be expanded to `swan'.

Variable expansion is a two phase process. Before a location is parsed, all references to selectors, eg ${path}, are expanded. The location is then parsed, selections are evaluated and option assignments recorded. If there were no selections or they all succeeded the location is used and the values of the following options are expanded in the order given: sublink, rfs, fs, opts, remopts, mount and unmount.

Note that expansion of option values is done after all assignments have been completed and not in a purely left to right order as is done by the shell. This generally has the desired effect but care must be taken if one of the options references another, in which case the ordering can become significant.

There are two special cases concerning variable expansion:

  1. before a map is consulted, any selectors in the name received from the kernel are expanded. For example, if the request from the kernel was for `${arch}.bin' and the machine architecture was `vax', the value given to ${key} would be `vax.bin'.
  2. the value of ${rhost} is expanded and normalized before the other options are expanded. The normalization process strips any local sub-domain components. For example, if ${domain} was `Berkeley.EDU' and ${rhost} was initially `snow.Berkeley.EDU', after the normalization it would simply be `snow'. Hostname normalization is currently done in a case-dependent manner.

@c======================================================================


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3 Selectors

Selectors are used to control the use of a location. It is possible to share a mount map between many machines in such a way that filesystem location, architecture and operating system differences are hidden from the users. A selector of the form `arch==sun3;os==sunos4' would only apply on Sun-3s running SunOS 4.x.

Selectors can be negated by using `!=' instead of `=='. For example to select a location on all non-Vax machines the selector `arch!=vax' would be used.

Selectors are evaluated left to right. If a selector fails then that location is ignored. Thus the selectors form a conjunction and the locations form a disjunction. If all the locations are ignored or otherwise fail then Amd uses the error filesystem (see section Error Filesystem (`error')). This is equivalent to having a location `type:=error' at the end of each mount-map entry.

The default value of many of the selectors listed here can be overridden by an Amd command line switch or in an Amd configuration file. See section Amd Configuration File.

The following selectors are currently implemented.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.1 arch Selector Variable

The machine architecture which was automatically determined at compile time. The architecture type can be displayed by running the command `amd -v'. You can override this value also using the -A command line option. See section Supported Platforms.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.2 autodir Selector Variable

The default directory under which to mount filesystems. This may be changed by the -a command line option. See section fs Option.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.3 byte Selector Variable

The machine's byte ordering. This is either `little', indicating little-endian, or `big', indicating big-endian. One possible use is to share `rwho' databases (see section `rwho' servers). Another is to share ndbm databases, however this use can be considered a courageous juggling act.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.4 cluster Selector Variable

This is provided as a hook for the name of the local cluster. This can be used to decide which servers to use for copies of replicated filesystems. ${cluster} defaults to the value of ${domain} unless a different value is set with the -C command line option.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.5 domain Selector Variable

The local domain name as specified by the -d command line option. See section host Selector Variable.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.6 dollar Selector Variable

This is a special variable, whose sole purpose is to produce a literal dollar sign in the value of another variable. For example, if you have a remote file system whose name is `/disk$s', you can mount it by setting the remote file system variable as follows:

 
rfs:=/disk${dollar}s

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.7 host Selector Variable

The local hostname as determined by gethostname(2). If no domain name was specified on the command line and the hostname contains a period `.' then the string before the period is used as the host name, and the string after the period is assigned to ${domain}. For example, if the hostname is `styx.doc.ic.ac.uk' then host would be `styx' and domain would be `doc.ic.ac.uk'. hostd would be `styx.doc.ic.ac.uk'.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.8 hostd Selector Variable

This resolves to the ${host} and ${domain} concatenated with a `.' inserted between them if required. If ${domain} is an empty string then ${host} and ${hostd} will be identical.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.9 karch Selector Variable

This is provided as a hook for the kernel architecture. This is used on SunOS 4 and SunOS 5, for example, to distinguish between different `/usr/kvm' volumes. ${karch} defaults to the "machine" value gotten from uname(2). If the uname(2) system call is not available, the value of ${karch} defaults to that of ${arch}. Finally, a different value can be set with the -k command line option.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.10 os Selector Variable

The operating system. Like the machine architecture, this is automatically determined at compile time. The operating system name can be displayed by running the command `amd -v'. See section Supported Platforms.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.11 osver Selector Variable

The operating system version. Like the machine architecture, this is automatically determined at compile time. The operating system name can be displayed by running the command `amd -v'. See section Supported Platforms.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.12 full_os Selector Variable

The full name of the operating system, including its version. This value is automatically determined at compile time. The full operating system name and version can be displayed by running the command `amd -v'. See section Supported Platforms.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.13 vendor Selector Variable

The name of the vendor of the operating system. This value is automatically determined at compile time. The name of the vendor can be displayed by running the command `amd -v'. See section Supported Platforms.

<HR>


The following selectors are also provided. Unlike the other selectors, they vary for each lookup. Note that when the name from the kernel is expanded prior to a map lookup, these selectors are all defined as empty strings.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.14 key Selector Variable

The name being resolved. For example, if `/home' is an automount point, then accessing `/home/foo' would set ${key} to the string `foo'. The key is prefixed by the pref option set in the parent mount point. The default prefix is an empty string. If the prefix was `blah/' then ${key} would be set to `blah/foo'.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.15 map Selector Variable

The name of the mount map being used.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.16 netnumber Selector Variable

This selector is identical to the `in_network' selector function, see in_network Selector Function. It will match either the name or number of any network interface on which this host is connected to. The names and numbers of all attached interfaces are available from the output of `amd -v'.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.17 network Selector Variable

This selector is identical to the `in_network' selector function, see in_network Selector Function. It will match either the name or number of any network interface on which this host is connected to. The names and numbers of all attached interfaces are available from the output of `amd -v'.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.18 path Selector Variable

The full pathname of the name being resolved. For example `/home/foo' in the example above.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.19 wire Selector Variable

This selector is identical to the `in_network' selector function, see in_network Selector Function. It will match either the name or number of any network interface on which this host is connected to. The names and numbers of all attached interfaces are available from the output of `amd -v'.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.20 uid Selector Variable

This selector provides the numeric effective user ID (UID) of the user which last accessed an automounted path name. This simple example shows how floppy mounting can be assigned only to machine owners:

 
floppy  -type:=pcfs \
        uid==2301;host==shekel;dev:=/dev/floppy \
        uid==6712;host==titan;dev=/dev/fd0 \
        uid==0;dev:=/dev/fd0c \
        type:=error

The example allows two machine owners to mount floppies on their designated workstations, allows the root user to mount on any host, and otherwise forces an error.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.21 gid Selector Variable

This selector provides the numeric effective group ID (GID) of the user which last accessed an automounted path name.

<HR>

The following boolean functions are selectors which take an argument ARG. They return a value of true or false, and thus do not need to be compared with a value. Each of these may be negated by prepending `!' to their name.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.22 exists Selector Function

If the file listed by ARG exists (via lstat(2)), this function evaluates to true. Otherwise it evaluates to false.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.23 false Selector Function

Always evaluates to false. ARG is ignored.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.24 netgrp Selector Function

The argument ARG of this selector is a netgroup name followed optionally by a comma and a host name. If the host name is not specified, it defaults to ${host}. If the host name (short name) is a member of the netgroup, this selector evaluates to true. Otherwise it evaluates to false.

For example, suppose you have a netgroup `ppp-hosts', and for reasons of performance, these have a local `/home' partition, while all other clients on the faster network can access a shared home directory. A common map to use for both might look like the following:

 
home/*  netgrp(ppp-hosts);type:=link;fs:=/local/${key} \
        !netgrp(ppp-hosts);type:=nfs;rhost:=serv1;rfs:=/remote/${key}

A more complex example that takes advantage of the two argument netgrp mount selector is given in the following scenario. Suppose one wants to mount the local scratch space from a each host under `scratch/<hostname>' and some hosts have their scratch space in a different path than others. Hosts in the netgroup `apple-hosts' have their scratch space in the `/apple' path, where hosts in the netgroup `cherry-hosts' have their scratch space in the `/cherry' path. For hosts that are neither in the `apple-hosts' or `cherry-hosts' netgroups we want to make a symlink pointing to nowhere but provide a descriptive error message in the link destination:

 
scratch/*	netgrp(apple-hosts,${/key});type:=nfs;rhost:=${/key};\
		    rfs:="/apple" \
		netgrp(cherry-hosts,${/key});type:=nfs;rhost:=${/key};\
		    rfs:="/cherry" \
		type:=link;rfs:="no local partition for ${/key}"

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.25 netgrpd Selector Function

The argument ARG of this selector is a netgroup name followed optionally by a comma and a host name. If the host name is not specified, it defaults to ${hostd}. If the host name (fully-qualified name) is a member of the netgroup, this selector evaluates to true. Otherwise it evaluates to false.

The `netgrpd' function uses fully-qualified host names to match netgroup names, while the `netgrp' function (see section netgrp Selector Function) uses short host names.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.26 in_network Selector Function

This selector matches against any network name or number with an optional netmask. First, if the current host has any network interface that is locally attached to the network specified in ARG (either via name or number), this selector evaluates to true.

Second, `in_network' supports a network/netmask syntax such as `128.59.16.0/255.255.255.0', `128.59.16.0/24', `128.59.16.0/0xffffff00', or `128.59.16.0/'. Using the last form, Amd will match the specified network number against the default netmasks of each of the locally attached interfaces.

If the selector does not match, it evaluates to false.

For example, suppose you have two servers that have an exportable `/opt' that smaller clients can NFS mount. The two servers are say, `serv1' on network `foo-net.site.com' and `serv2' on network `123.4.5.0'. You can write a map to be used by all clients that will attempt to mount the closest one as follows:

 
opt in_network(foo-net.site.com);rhost:=serv1;rfs:=/opt \
    in_network(123.4.5.0);rhost:=serv2;rfs:=/opt \
    rhost:=fallback-server

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.27 true Selector Function

Always evaluates to true. ARG is ignored.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.3.28 xhost Selector Function

This function compares ARG against the current hostname, similarly to the host Selector Variable. However, this function will also match if ARG is a CNAME (DNS Canonical Name, or alias) for the current host's name.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.4 Map Options

Options are parsed concurrently with selectors. The difference is that when an option is seen the string following the `:=' is recorded for later use. As a minimum the type option must be specified. Each filesystem type has other options which must also be specified. See section Filesystem Types, for details on the filesystem specific options.

Superfluous option specifications are ignored and are not reported as errors.

The following options apply to more than one filesystem type.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.4.1 addopts Option

This option adds additional options to default options normally specified in the `/defaults' entry or the defaults of the key entry being processed (see section opts Option). Normally when you specify `opts' in both the `/defaults' and the map entry, the latter overrides the former completely. But with `addopts' it will append the options and override any conflicting ones.

`addopts' also overrides the value of the `remopts' option (see section remopts Option), which unless specified defaults to the value of `opts'.

Options which start with `no' will override those with the same name that do not start with `no' and vice verse. Special handling is given to inverted options such as `soft' and `hard', `bg' and `fg', `ro' and `rw', etc.

For example, if the default options specified were

 
opts:=rw,nosuid,intr,rsize=1024,wsize=1024,quota,posix

and the ones specified in a map entry were

 
addopts:=grpid,suid,ro,rsize=2048,quota,nointr

then the actual options used would be

 
wsize=1024,posix,grpid,suid,ro,rsize=2048,quota,nointr

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.4.2 delay Option

The delay, in seconds, before an attempt will be made to mount from the current location. Auxiliary data, such as network address, file handles and so on are computed regardless of this value.

A delay can be used to implement the notion of primary and secondary file servers. The secondary servers would have a delay of a few seconds, thus giving the primary servers a chance to respond first.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.4.3 fs Option

The local mount point. The semantics of this option vary between filesystems.

For NFS and UFS filesystems the value of ${fs} is used as the local mount point. For other filesystem types it has other meanings which are described in the section describing the respective filesystem type. It is important that this string uniquely identifies the filesystem being mounted. To satisfy this requirement, it should contain the name of the host on which the filesystem is resident and the pathname of the filesystem on the local or remote host.

The reason for requiring the hostname is clear if replicated filesystems are considered. If a fileserver goes down and a replacement filesystem is mounted then the local mount point must be different from that of the filesystem which is hung. Some encoding of the filesystem name is required if more than one filesystem is to be mounted from any given host.

If the hostname is first in the path then all mounts from a particular host will be gathered below a single directory. If that server goes down then the hung mount points are less likely to be accidentally referenced, for example when getcwd(3) traverses the namespace to find the pathname of the current directory.

The `fs' option defaults to ${autodir}/${rhost}${rfs}. In addition, `rhost' defaults to the local host name (${host}) and `rfs' defaults to the value of ${path}, which is the full path of the requested file; `/home/foo' in the example above (see section Selectors). ${autodir} defaults to `/a' but may be changed with the -a command line option. Sun's automounter defaults to `/tmp_mnt'. Note that there is no `/' between the ${rhost} and ${rfs} since ${rfs} begins with a `/'.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.4.4 opts Option

The options to pass to the mount system call. A leading `-' is silently ignored. The mount options supported generally correspond to those used by mount(8) and are listed below. Some additional pseudo-options are interpreted by Amd and are also listed.

Unless specifically overridden, each of the system default mount options applies. Any options not recognized are ignored. If no options list is supplied the string `rw,defaults' is used and all the system default mount options apply. Options which are not applicable for a particular operating system are silently ignored. For example, only 4.4BSD is known to implement the compress and spongy options.

acdirmax=n

Set the maximum directory attribute cache timeout to n.

acdirmin=n

Set the minimum directory attribute cache timeout to n.

acregmax=n

Set the maximum file attribute cache timeout to n.

acregmin=n

Set the minimum file attribute cache timeout to n.

actimeo=n

Set the overall attribute cache timeout to n.

auto
ignore

Ignore this mount by df(1).

cache

Allow data to be cached from a remote server for this mount.

compress

Use NFS compression protocol.

defperm

Ignore the permission mode bits, and default file permissions to 0555, UID 0, and GID 0. Useful for CD-ROMs formatted as ISO-9660.

dev

Allow local special devices on this filesystem.

dirmask=n

For PCFS mounts, specify the maximum file permissions for directories in the file system. See the `mask' option's description for more details. The mask value of n can be specified in decimal, octal, or hexadecimal.

dumbtimr

Turn off the dynamic retransmit timeout estimator. This may be useful for UDP mounts that exhibit high retry rates, since it is possible that the dynamically estimated timeout interval is too short.

extatt

Enable extended attributes in ISO-9660 file systems.

fsid

Set ID of filesystem.

gens

Enable generations in ISO-9660 file systems. Generations allow you to see all versions of a given file.

group=n

For PCFS mounts, set the group of the files in the file system to n (which can either be a group name or a GID number). The default group is the group of the directory on which the file system is being mounted.

grpid

Use BSD directory group-id semantics.

int
intr

Allow keyboard interrupts on hard mounts.

lock

Use the NFS locking protocol (default)

longname

For PCFS mounts, force Win95 long names.

mask=n

For PCFS mounts, specify the maximum file permissions for files in the file system. For example, a mask of 755 specifies that, by default, the owner should have read, write, and execute permissions for files, but others should only have read and execute permissions. Only the nine low-order bits of mask are used. The default mask is taken from the directory on which the file system is being mounted. The mask value of n can be specified in decimal, octal, or hexadecimal.

multi

Perform multi-component lookup on files.

maxgroups

Set the maximum number of groups to allow for this mount.

nfsv3

Use NFS Version 3 for this mount.

noac

Turn off the attribute cache.

noauto

This option is used by the mount command in `/etc/fstab' or `/etc/vfstab' and means not to mount this file system when mount -a is used.

nocache

Do not allow data to be cached from a remote server for this mount.

noconn

Don't make a connection on datagram transports.

nocto

No close-to-open consistency.

nodefperm

Do not ignore the permission mode bits. Useful for CD-ROMS formatted as ISO-9660.

nodev
nodevs

Don't allow local special devices on this filesystem.

noexec

Don't allow program execution.

noint

Do not allow keyboard interrupts for this mount

nolock

Do not use the NFS locking protocol

nomnttab

This option is used internally to tell Amd that a Solaris 8 system using mntfs is in use.

norrip

Turn off using of the Rock Ridge Interchange Protocol (RRIP) extensions to ISO-9660.

nosub

Disallow mounts beneath this mount.

nosuid

Don't allow set-uid or set-gid executables on this filesystem.

noversion

Strip the extension `;#' from the version string of files recorded on an ISO-9660 CD-ROM.

nowin95

For PCFS mounts, completely ignore Win95 entries.

optionstr

Under Solaris 8, provide the kernel a string of options to parse and show as part of the special in-kernel mount file system.

overlay

Overlay this mount on top of an existing mount, if any.

pgthresh=n

Set the paging threshold to n kilobytes.

port=n

Set the NFS port to n.

posix

Turn on POSIX static pathconf for mounts.

private

Use local locking instead of the NLM protocol, useful for IRIX 6 only.

proplist

Support property lists (ACLs) for this mount, useful primarily for Tru64 UNIX.

proto=s

Use transport protocol s for NFS (can be "tcp" or "udp").

quota

Enable quota checking on this mount.

rdonly
ro

Mount this filesystem readonly.

resvport

Use a reserved port (smaller than 1024) for remote NFS mounts. Most systems assume that, but some allow for mounts to occur on non-reserved ports. This causes problems when such a system tries to NFS mount one that requires reserved ports. It is recommended that this option always be on.

retrans=n

The number of NFS retransmits made before a user error is generated by a `soft' mounted filesystem, and before a `hard' mounted filesystem reports `NFS server yoyo not responding still trying'.

retry

Set the NFS retry counter.

rrip

Uses the Rock Ridge Interchange Protocol (RRIP) extensions to ISO-9660.

rsize=n

The NFS read packet size. You may need to set this if you are using NFS/UDP through a gateway or a slow link.

rw

Allow reads and writes on this filesystem.

shortname

For PCFS mounts, force old DOS short names only.

soft

Give up after retrans retransmissions.

spongy

Like `soft' for status requests, and `hard' for data transfers.

suid

Allow set-uid programs on this mount.

symttl

Turn off the symbolic link cache time-to-live.

sync

Perform synchronous filesystem operations on this mount.

tcp

Use TCP/IP instead of UDP/IP, ignored if the NFS implementation does not support TCP/IP mounts.

timeo=n

The NFS timeout, in tenth-seconds, before a request is retransmitted.

user=n

For PCFS mounts, set the owner of the files in the file system to n (which can either be a user name or a UID number). The default owner is the owner of the directory on which the file system is being mounted.

vers=n

Use NFS protocol version number n (can be 2 or 3).

wsize=n

The NFS write packet size. You may need to set this if you are using NFS/UDP through a gateway or a slow link.

The following options are implemented by Amd, rather than being passed to the kernel.

nounmount

Configures the mount so that its time-to-live will never expire. This is the default for non-network based filesystem types (such as mounting local disks, floppies, and CD-ROMs). See also the related unmount option.

ping=n

The interval, in seconds, between keep-alive pings. When four consecutive pings have failed the mount point is marked as hung. This interval defaults to 30 seconds; if the ping interval is set to zero, Amd will use the default 30-second interval. If the interval is set to -1 (or any other negative value), no pings are sent and the host is assumed to be always up, which can cause unmounts to hang See the softlookup option for a better alternative. Turning pings off can be useful in NFS-HA (High-Availability) sites where the NFS service rarely goes down. Setting the ping value to a large value can reduce the amount of NFS_NULL chatter on your network considerably, especially in large sites.

Note that if you have multiple Amd entries using the same file server, and each entry sets a different value of N, then each time Amd mounts a new entry, the ping value will be re-evaluated (and updated, turned off, or turned back on as needed). Finally, note that NFS_NULL pings are sent for both UDP and TCP mounts, because even a hung TCP mount can cause user processes to hang.

public

Use WebNFS multi-component lookup on the public file handle instead of the mount protocol to obtain NFS file handles, as documented in the WebNFS Client Specification, RFC 2054. This means that Amd will not attempt to contact the remote portmapper or remote mountd daemon, and will only connect to the well-known NFS port 2049 or the port specified with the port mount option, thus making it easier to use NFS through a firewall.

retry=n

The number of times to retry the mount system call.

softlookup

Configures Amd's behavior with respect to already-mounted shares from NFS fileservers that are unreachable. If softlookup is specified, trying to access such a share will result in an error (EIO, which is changed from the ENOENT 6.0 used to return). If it is not specified, a regular symlink is provided and the access will probably hang in the NFS filesystem.

The default behavior depends on whether the mount is 'soft' or 'hard'; softlookup can be used to change this default. This is changed from 6.0 which always behaved as if softlookup was specified.

unmount

Configures the mount so that its time-to-live will indeed expire (and thus may be automatically unmounted). This is also the default for network-based filesystem types (e.g., NFS). This option is useful for removable local media such as CD-ROMs, USB drives, etc. so they can expire when not in use, and get unmounted (such drives can get work out when they keep spinning). See also the related nounmount option.

utimeout=n

The interval, in seconds, that looked up and mounted map entries are cached. After that period of time, Amd will attempt to unmount the entries. If, however, the unmount fails (with EBUSY), then Amd will extend the mount's time-to-live by the utimeout value before the next unmount attempt is made. In fact the interval is extended before the unmount is attempted, to avoid thrashing. The default value is 120 seconds (two minutes) or as set by the -w command line option.

xlatecookie

Translate directory cookies between 32-long and 64-long lengths.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.4.5 remopts Option

This option has the same use as ${opts} but applies only when the remote host is on a non-local network. For example, when using NFS across a gateway it is often necessary to use smaller values for the data read and write sizes. This can simply be done by specifying the small values in remopts. When a non-local host is accessed, the smaller sizes will automatically be used.

Amd determines whether a host is local by examining the network interface configuration at startup. Any interface changes made after Amd has been started will not be noticed. The likely effect will be that a host may incorrectly be declared non-local.

Unless otherwise set, the value of ${remopts} is the same as the value of ${opts}.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.4.6 sublink Option

The subdirectory within the mounted filesystem to which the reference should point. This can be used to prevent duplicate mounts in cases where multiple directories in the same mounted filesystem are used.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.4.7 type Option

The filesystem type to be used. See section Filesystem Types, for a full description of each type.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Erez Zadok on November, 27 2006 using texi2html 1.76.