AutoMount seems to be making somewhat of a come back as directory services become more and more common.
See also: OpenLdap
Contents
Software
- AutofsNG
- AutofsNG is intended to be completely interoperable with autofs implementations on other Unix platforms. As such, it supports some features that the current Linux automounters do not. This includes direct mounts, /net (--hosts access), lazy mounting and unmounting of hierarchical multimounts, and browsing. It also supports the usual indirect map support available elsewhere. Maps are supported from flat files, executable maps, NIS maps, NIS+ maps, LDAP maps, and hesiod (DNS) filsys namespace.
Automount and OSX
Automount in AppleOsx is similar in concept but quite different in detail from Linux or Solaris automount.
- Automount and Darwin
- Good general information about how the automounter works under OSX and Darwin.
- NIS and Automount in OSX
- Good article including lots of documentation on the nitty gritty of how automount works including documentation on the nefarious -net mount option.
General Linux Background
From a message sent to the LinuxManagers mailing list by AdamShand.
> I'm looking for some advice or a pointer to relevant documentation here > (which I've so far been unable to find). I inherited a mixed Solaris > 2.5/8 Linux (Redhat 7.x and Debian) environment which uses NIS as the > naming scheme (yes I know NIS is bad that it's way it is). > > The Linux part is relatively new and I've been integrating it into the > NIS enviroment. The one stumbling block I've found (once I got over MD5 > vs crypt) is that automount appears to use a totally different syntax > under Linux then Solaris. Is it possible for these files to be shared > between Linux and Solaris? If so should I use automount or AMD? > > Any words of advice would be appreciated and I will summarize.
Apologies for the *very* late summary, I got swamped by work and then went on vacation. Ravi Channavajhala, Gustavo Chaves and sysadmin.astro.su.se were kind enough to reply.
Things worth knowing.
- There are two main linux automounter projects. AMD and autofs, autofs is syntax compatible with the Solaris automounter but lacks features. AMD has all/most/more (?) features of the Solaris automouter but uses a totally different syntax and thus is not directly compatible.
- AMD development is rumored to be ceasing soon, though from what I can find autofs development stopped quite a while ago. At least the links from freshmeat lead to pages which haven't been updated in a long time.
- The /etc/init.d/autofs script that ships with autofs duplicates much of the functionality of the automount command under Solaris (eg. automount -v).
Linux autofs doesn't support direct maps or /net (sadly both features I need), failover or any of the nifty short hand syntax that the solaris one does (*, & and variable substitution for things like $ARCH).
- One option is to write some scripts on the linux boxes which parse the automount NIS maps and convert them to AMD syntax (ugg).
There is a beta version of autofs (4.0.0pre10) which supports /net (but not direct maps). The files on the FTP site say that they haven't been updated in almost a year but freshmeat says that project is active and updated in December. I have no information on how stable it is but it will be what i'm trying next.
Gustavo provided some scripts they he'd used to solve this problem by querying the NIS maps and using a perl script to fake direct maps.
More information.
- Home page for the 4.0.0pre10 version of autofs:
- Reports that the autofs shipped with Redhat 7.2 has the auto.net and LDAP support backported to the version 3.x version.
- Reports that the 4.x version is fairly stable (in testing now).
- In order for the 4.x version to work properly you need to have this line in your /etc/modules.conf (and remember to run "depmod -a" afterwards and check that the right module loaded etc).
alias autofs autofs4
Some useful oneliners:
- ypcat -k auto.direct | awk '{system("mkdir -p -m 755 " $1); mntopt=substr($2,2) " " $3 " " $1; system("mount -o " mntopt)}'
- To manually mount all filesystems listed in the NIS map auto.direct:
- mount | awk '/ nfs / {system("umount "$3)}'
- Manually unmount all NFS filesystems.
I've been struggling with this same problem. One idea I've tried which seems to work ok is running both amd and autofs at the same time. Just have amd manage /net and /home, and autofs do the other maps, which I get from NIS. Seems to work ok. One caveat: you need to have an /etc/auto.master which just contains
- /home
to make autofs skip that mount so amd can grab it instead.
Hey Phil, I think I just responded to one of your questions on the PhpWiki list
I think I'll stay away from that for the time being, too complicated for my tastes but it is a nice idea. In case you didn't know autofs 4.x seems to handle /net and /home just fine. -- AdamShand
Redhat Tweaks
So autofs4 is really the only version of Linux automount that is worth running, however RedhatLinux still doesn't ship version 4 by default and the packages on the software's homepage is so old that it won't run on modern versions of Redhat. So ... that means you need to rebuild the source RPM's and make some minor tweaks. Here's the cheat list (see UsingRpm for how to rebuid a source RPM):
In order for /net to work properly with a NetworkAppliance file server you need to add nostrict to the default mount options:
- # vi autofs-4.0.0pre10-1/samples/auto.net
The default run level priority starts autofs too soon for modern RedhatLinux systems, you need to bump it to 99
- # vi autofs-4.0.0pre10-1/samples/rc.autofs.in
chkconfig: 345 99 99
Unless you need it comment out the /misc map:
- # vi autofs-4.0.0pre10-1/samples/auto.master
/misc /etc/auto.misc
The package build will fail due to the different location of the init.d scripts so you need to update the spec file and change all instances of rc.d/init.d to init.d):
- # vi ../SPECS/autofs.spec
Finally remember that autofs4 requires the autofs4 kernel module to be loaded instead of the default autofs one. Make sure that you add an alias:
- # vi /etc/modules.conf
alias autofs autofs4
Useful Links
- Looks like a copy of an automount chapter from a book.