[comp.sys.sun] automounter peculiarity, and a nice automount example

bob@kahala.hig.hawaii.edu (Bob Cunningham) (12/22/88)

If you accidentally specify non-existent map for an invocation of
automount (or, a map which say isn't correctly published by your yp
server(s)), then you can get some strange effects.  The most obvious is
console messages on the system on which automount is running that it
"cannot read mountopts.bysitepair map".

This is the name of some sort of default map, hard-coded in automount at
least in SunOS4.0, for a feature which was never--and will never--be
implemented.  The fix is to make sure you didn't make a typo in specifying
the map name, and the map is properly published.

Also, ome of the examples of how to use the automounter that have appeared
in Sun-Spots aren't too clear.  Here is a (hopefully clear) way in which I
use it to manage bits and pieces of /usr/local spread around various
servers here.  The "server1" and "server2" machines have identical copies
of /usr/local/bin, etc., while "server3" just has /usr/local/src.

At the tail end of /etc/rc.local on all the diskless machines, I put
something like this:

# Automounter
if [ -f /usr/etc/automount ]; then
 /usr/etc/automount /usr/local auto.local; (echo "auto local") >/dev/console
fi

The yellow pages master has a file called /etc/auto.local, which I publish
in the yellow pages (via some minor additions to /var/yp/Makefile which
should be obvious, so I'm not outlining them here), which contains:

bin	-ro,soft	server1:/usr/local/bin	server2:/usr/local/bin
lib	-ro,soft	server1:/usr/local/lib	server2:/usr/local/lib
src	-ro,soft	server3:/usr/local/src

The effect on each diskless client is to create an invocation of automount
that "lives" in /usr/local.  When it sees references to /usr/local/bin or
/usr/local/lib (or any of their sub-directories) it mounts them from
either server1 or server2 (doesn't matter which).  When it sees a
reference to the /usr/local/src (or a sub-directory), it mounts that from
server3.

brent%terra@sun.com (Brent Callaghan) (01/04/89)

Watch out for relative references between filesystems.  There may be an
implicit assumption that all three filesystems within /usr/local are
concurrently mounted - this may not be true using a map like the above
example.

For example: a symbolic link "/usr/local/bin/foo" could be a reference to
"../lib/foo".  The symbolic link will fail if "/usr/local/lib" isnt
currently mounted.  The automounter will not do the mount because the
relative pathname doesn't go through the automounter's mount point
(/usr/local).

BTW: It's not a good idea to mount executables "soft".  If the server goes
down while the executable is running you can get a SEGV or similar crash
when a page-in fails.  I prefer "hard,intr".

	Brent Callaghan  @ Sun Microsystems
	uucp: sun!bcallaghan
	phone: (415) 336 6188