determining the real directory when using automounts
Brent Callaghan
brent at sun.com
Wed Apr 5 07:46:52 AEST 1989
The symbolic links for the 4.0.1 automounter were made more attractive by
attempting to recreate the original path, with the exception of "/tmp_mnt"
stuck on the front. The 4.0 version used to invent disgusting pathnames
via tmpnam(3).
The symbolic links look pretty good for most mounts - except if you use
the subdirectory feature in a map (i.e. a second colon). This feature
allows the automounter to do the mount at a higher level and thus allow
several map entries to share a common mount. One side effect of this
shared mount point is that it's now impossible to build a completely
satisfying symbolic link. The 4.0.1 automounter fudges a path by
incorporating the key used in the first reference that caused the mount.
This is best illustrated with an example:
An automounter map to mount user's home directories. The map is looked up
by loginname - not servername.
brent sparky:/home/sparky:brent
derek sparky:/home/sparky:derek
cindy sparky:/home/sparky:cindy
fred gurgle:/home/gurgle:fred
I mount this map on /home thus:
automount /home /etc/auto.home
Then I do the following:
$ ls -l /home/brent
lrwxrwxrwx /home/brent -> /tmp_mnt/home/brent/brent
$ ls -l /home/derek
lrwxrwxrwx /home/derek -> /tmp_mnt/home/brent/derek
$ ls -l /home/cindy
lrwxrwxrwx /home/cindy -> /tmp_mnt/home/brent/cindy
$ ls -l /home/fred
lrwxrwxrwx /home/fred -> /tmp_mnt/home/fred/fred
The symbolic links are all pointing to the right places, it's just that
the names look a little weird. If you use this scheme for mounting your
home directory you can "fix up" the name by having the shell keep track
for you. Both the C shell an Korn shell keep the original path in $PWD.
You can set up an alias so a "pwd" will echo $PWD. If you still don't
like the idea of weird symbolic links, then just replace second colon in
the map entry with a slash and put up with the overhead of extra mounting.
The pathname will still be longer than you expect, but not quite so weird
and unpredictable.
Brent
More information about the Comp.sys.sun
mailing list