Subject: replacing simple NFS mount with amd
To: Hubert Feyrer <Hubert.Feyrer@rz.uni-regensburg.de>
From: Daniel Carosone <danielce@ee.mu.OZ.AU>
List: current-users
Date: 02/04/1995 11:27:42
Hubert Feyrer writes:
 > How do I replace a static NFS-mount with a automatic one done by amd
 > (AutoMountDaemon)?
 > 
 > Right now, I could do "mount srchost:/usr/src /usr/src", but as my srchost is
 > frequently down, I'd like to replace this with a automatic mount done by amd.
 > 
 > My problem is, I don't thet it done very well. Here's what I can think of:
 > 
 > - "amd /usr/src src-map", but then I don't see any directory when I do a
 >   "cd /usr/src". I'll have to go blindly to "sys" etc., which is not what I
 >   like.
 > - start amd with "amd /usr src-map", I'll probably get /usr/src mounted when I
 >   cd into it, but the minor disadvantage is I my /usr-disk is shadowed by the
 >   amd's /usr then. ;-)
 > 
 > So, any smart suggestions on how to do a "mount host:/some/path /some/path"
 > when I cd /some/path?

Here's how I do this, with a structure that allows things to be
handled pretty generically.

dan@anarres [10:43][81]~> cd /usr
dan@anarres [11:20][82]/usr> ls -Flagsd src
0 lrwxr-xr-x  1 root  wheel  20 Jan  7 23:49 src@ -> /home/f/l/NetBSD/src
dan@anarres [11:20][83]/usr> df
Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
/dev/wd0a       15095     9733     4607    68%    /
/dev/wd0e       48591    40011     6150    87%    /usr
/dev/wd0f       21895     1856    18944     9%    /var
/dev/wd0g      386351   309524    57509    84%    /fs/a
procfs              4        4        0   100%    /proc
kernfs              1        1        0   100%    /kern
amd:80              0        0        0   100%    /home
oi:/fs/c       196119   166681     9826    94%    /amd/oi/fs/c
dan@anarres [11:21][88]/usr> cd src
dan@anarres [11:21][89]/usr/src> df .
Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
oi:/fs/f       406854   305336    81175    79%    /amd/oi/fs/f
dan@anarres [11:21][90]/usr/src> 

The relevant portion of the amd.home map looks like this:

f	host==oink;type:=link;fs:=/fs/${key} \
	host!=oink;type:=nfs;rhost:=oi;rfs:=/fs/${key}

This way my amd maps are pretty straight forward.  I use this for
users home directories (in /home/?/u/$user) and all sorts of other
things. By the way, the name /home is chosen because these are
machines at home, not because they are home directories. Elsewhere, I
use /companyname with essentially the same scheme.

--
Dan.