home *** CD-ROM | disk | FTP | other *** search
/ PC World 1999 August / PCWorld_1999-08_cd.bin / doc / HOWTO / mini / Automount < prev    next >
Text File  |  1999-04-27  |  11KB  |  331 lines

  1.   Automount mini-Howto
  2.   don@sabotage.org
  3.   v0.4, 17 April 1999
  4.  
  5.   This file describes the autofs automounter, how to configure it, and
  6.   points out some problems to avoid.
  7.   ______________________________________________________________________
  8.  
  9.   Table of Contents
  10.  
  11.  
  12.   1. Introduction
  13.  
  14.      1.1 Automount - what and why
  15.      1.2 Types of automounting
  16.  
  17.   2. Installation
  18.  
  19.   3. Configuration
  20.  
  21.   4. That long wait to unmount
  22.  
  23.   5. Questions
  24.  
  25.      5.1 I don't see /auto/floppy, or whatever mountpoint I'm looking for.
  26.      5.2 How do I see what's mounted?
  27.      5.3 I put in a win95 disk ("vfat") and it was autodetected as only a regular FAT disk.
  28.      5.4 My filesystem
  29.      5.5 What happens if I make / the directory for the automounter
  30.      5.6 Can I have two map files on the same directory?
  31.      5.7 I'm using SuSE 6.0 and needed
  32.      5.8 How do I set the permissions and ownership for the filesystem (IE FAT)
  33.      5.9 Who do I thank for autofs?
  34.      5.10 Where can I learn more about automounting?
  35.  
  36.  
  37.   ______________________________________________________________________
  38.  
  39.   1.  Introduction
  40.  
  41.   1.1.  Automount - what and why
  42.  
  43.   Automouting is the process where mounting (and unmounting) of certain
  44.   filesystems is done automatically by a daemon. If the filesystem is
  45.   unmounted, and a user attempts to access it, it will be automatically
  46.   (re)mounted. This is especially useful in large networked environments
  47.   and for crossmounting filesystems between a few machines (especially
  48.   ones which are not always online). It may also be very useful for
  49.   removable devices, or a few other uses, such as easy switching between
  50.   a forced-on ascii conversion mount of a dos filesystem and a forced-
  51.   off ascii conversion mount of the same dos fs.
  52.  
  53.  
  54.   1.2.  Types of automounting
  55.  
  56.   There are two types of automounters in linux; AMD and autofs. AMD is
  57.   the automount daemon, and supposedly works like the SunOS AMD. It is
  58.   implemented in user space, meaning it's not part of the kernel. It's
  59.   not necessary for the kernel to understand automounting if you NFS
  60.   mount to the local host, through the AMD daemon, which routes all
  61.   automount filesystem traffic through the NFS system. Autofs is a newer
  62.   system assisted by the kernel, meaning that the kernel's filesystem
  63.   code knows where the automount mount points are on an otherwise normal
  64.   underlying fs, and the automount program takes it from there. Only
  65.   autofs will be described in this mini-howto.
  66.  
  67.   2.  Installation
  68.  
  69.   Because autofs is implemented in kernel-space, your kernel must have
  70.   support compiled in. In 2.0.xx it is an experimental option, but
  71.   appears to be quite stable. In 2.2.xx it is a normal option.
  72.  
  73.  
  74.   The automount program and its configuration files are also necessary;
  75.   using the rpms (from RedHat, as part of the install) is a great way to
  76.   go. The automount program should be started by an rc script under the
  77.   /etc/rc.d/init.d directory . The rpm installs this, but you will need
  78.   to make sure it gets started, either by linking it from your rc?.d
  79.   directory, using Redhat's control-panel, or on another distribution by
  80.   getting the thing started anyway you care to.  Non-rpm distros will
  81.   have to do whatever's applicable to their system. And don't look too
  82.   hard at what the rc script does; if you're reading this howto you
  83.   probably don't want to know.
  84.  
  85.  
  86.   3.  Configuration
  87.  
  88.   Installing the RPM's will get you to this point easily enough, but
  89.   here's the part you might not be sure about if you haven't done this
  90.   before.
  91.  
  92.  
  93.   There are two files in /etc, one called auto.master and one called
  94.   auto.misc.  My auto.master looks like this:
  95.  
  96.   /auto   /etc/auto.misc  --timeout 60
  97.  
  98.  
  99.  
  100.   The first entry is not the mount point. It's where the set of mount
  101.   points (found in the second entry) are going to be. The third option
  102.   says that the mounted filesystems can try to unmount themselves 60
  103.   seconds after use. They can't unmount if being used, of course.
  104.  
  105.   Auto.misc is a "map file". The map file can have any name; this one is
  106.   named auto.misc because it originally controlled /misc. Multiple map
  107.   files can be defined in auto.master.  My auto.misc looks like this:
  108.  
  109.   kernel          -ro,soft,intr           ftp.kernel.org:/pub/linux
  110.   cd              -fstype=iso9660,ro      :/dev/cdrom
  111.   zip             -fstype=auto            :/dev/hdd4
  112.   floppy          -fstype=vfat            :/dev/fd0
  113.  
  114.  
  115.  
  116.   The first column (the "key") is the mount point. In this case it would
  117.   be /auto/floppy or whatever. The middle set are the options; read the
  118.   mount manpage for details on this. And the last column specifies where
  119.   the fs comes from. The "kernel" entry is supposed to be an NFS mount.
  120.   The : on all the other lines means its a local device.
  121.  
  122.  
  123.  
  124.   4.  That long wait to unmount
  125.  
  126.   Some of you may be eyeing that 60 second timeout and thinking, that's
  127.   a long time to wait to eject a floppy.. Maybe I'll just sync the disks
  128.   and pop it out mounted and nobody will notice. Let me suggest saner
  129.   alternatives.  First of all, you can change the timeout. But that
  130.   could be a little inefficient; telling the system to unmount stuff
  131.   after only 15 seconds or whatever. Depending on your setup, you may be
  132.   able to simply run the umount command as a normal user.  But there is
  133.   actually a way to ask the automount program to umount. If you send
  134.   (with the program kill) the signal SIGUSR1 to the automount process,
  135.   it will unmount everything it can. But before people start making
  136.   unmount buttons on their window managers, there's a little problem.
  137.  
  138.   The automount process is run by root, and it will only accept signals
  139.   from root. Half of the reason you're probably doing automounting is so
  140.   you can mount an unmount *without* being root. It would be easy to
  141.   make a suid-root C program which does the dirty deed. However, by
  142.   using sudo it is possible to allow users to send the proper kill
  143.   signal. The only problem is that sudo will not let you use ` to
  144.   process subcommands, which you would have to do to find the current
  145.   PID. You should have a program called killall, which will let you do
  146.   this: (thanks for the suggestions)
  147.  
  148.   ALL     ALL=NOPASSWD:/usr/bin/killall -USR1 automount
  149.  
  150.  
  151.   Otherwise, you would have to allow your users to send -SIGUSR1 to all
  152.   processes.  That has various effects on programs; it will recycle some
  153.   window managers, but kills xemacs. So here's hoping there's no buffer
  154.   overruns in killall...
  155.  
  156.  
  157.   5.  Questions
  158.  
  159.  
  160.  
  161.   5.1.  I don't see /auto/floppy, or whatever mountpoint I'm looking
  162.   for.
  163.  
  164.   If automount is setup properly, whatever mount point you're looking
  165.   for will be there if you try and use it, even though you don't see it
  166.   when not in use. If you're browsing the directory with a graphical
  167.   tool, you may need to type in the name manually; most programs will
  168.   try what you give it, and the drive will be mounted before it notices.
  169.   Unfortunately not being able to choose from the available invisible
  170.   mount points is probably the major drawback of autofs. If it really
  171.   bugs you, edit the configuration files.  (Hint, the ones that end in
  172.   .c for "configuration")
  173.  
  174.   One workaround several people have tried is to create symbolic links
  175.   to where automount will create something once it's mounted. This will
  176.   likely prevent the program from complaining a directory doesn't exist
  177.   (if the mount works, that is) but careless directory listings will
  178.   cause filesystems to be mounted.
  179.  
  180.  
  181.   5.2.  How do I see what's mounted?
  182.  
  183.   The df command. mount with no options will do the same, plus show the
  184.   options its mounted with.
  185.  
  186.  
  187.  
  188.  
  189.   5.3.  I put in a win95 disk ("vfat") and it was autodetected as only a
  190.   regular FAT disk.
  191.  
  192.   This is not a problem with automount. As of this writing, the "auto"
  193.   fs type does not attempt a vfat mount before it successfully mounts an
  194.   msdos filesystem. VFAT is the Win95 and WinNT long filenames crammed
  195.   into a FAT/MSDOS filesystem.
  196.  
  197.   According to one of the authors of mount, since mount is only a
  198.   wrapper around a system call which must specify the filesystem type,
  199.   it's still the responsibility of the user to come up with the fs type.
  200.   Having mount take a list of filesystems to try in order, rather than
  201.   the current "heuristic" is under consideration. Some users have simply
  202.   not compiled msdos into the kernel; this prevents it from being tested
  203.   prior to vfat. This will work for most people; a few actually need
  204.   msdos fs and it caused me quite some frustration to not have a module
  205.   handy when I actually needed it.
  206.  
  207.   I'm sure that if anyone wants to go to the effort of finding the
  208.   owner(s) of the mount program, your comments would be welcome. So
  209.   unless you don't compile msdos in, for now this means that you can't
  210.   mount vfat unless you give up the ability to autodetect all other
  211.   fs's. Hopefully it will be configurable someday. In the mean time,
  212.   feel free to create multiple mount points with different fs types
  213.   specified.
  214.  
  215.  
  216.  
  217.   5.4.  My filesystem /auto/grumblesmurf  is mounted and kill -SIGUSR1
  218.   won't unmount it.
  219.  
  220.   It's being used by something. Root probably can't manually unmount it
  221.   either. If you're the one who caused it to be mounted (i.e. it can't
  222.   be someone else using it) look around for a shell that might be in
  223.   that directory. If there are none, look for something else
  224.   (particularly something that might have gone though that directory
  225.   like a directory browser) that might have left an invisible foot in
  226.   the door so to speak. If you've given up looking, try using the fuser
  227.   program.
  228.  
  229.  
  230.   5.5.  What happens if I make / the directory for the automounter
  231.  
  232.   Oooh. Well, out of a statistical sample of only one person, none of
  233.   the results were positive. You have been warned. If you want
  234.   /grumblesmurf, then I suggest a symbolic link. Much safer.
  235.  
  236.  
  237.   5.6.  Can I have two map files on the same directory?
  238.  
  239.   Not as far as I know. Try using one map file, with specific options
  240.   for individual entries.
  241.  
  242.  
  243.   5.7.  I'm using SuSE 6.0 and needed ---timeout  instead of --timeout
  244.  
  245.   Uh. Ok, I've made a note about it. Another solution to "timeout not
  246.   working" problems would be to add a -t time option to the autofs
  247.   script.
  248.  
  249.  
  250.   5.8.  How do I set the permissions and ownership for the filesystem
  251.   (IE FAT)
  252.  
  253.   Check the man page for mount for some of the options, such as setting
  254.   the uid=value or umask=value options. One option that appears to be
  255.   missing for FAT filesystems is mode=value. Sorry. Check in with the
  256.   people who do mounting.
  257.  
  258.  
  259.   5.9.  Who do I thank for autofs?
  260.  
  261.   Not me. I didn't have anything to do with it. I just wanted to bring
  262.   everyone's attention to what a great job had been done with autofs,
  263.   and how easy it is to use. Compared to the original perpetrators of
  264.   AMD (Hint, they sell an overpriced unice with prehistoric versions of
  265.   free tools) the autofs is very well documented and the implementors
  266.   have my sincere thanks. Everything is stamped copyright Transmeta so
  267.   sorry I can't provide a credits list, but I would bet Peter Anvin is
  268.   responsible for quite a bit of it. Peter also held a session on autofs
  269.   at linuxworldexpo on March 3, 1999.
  270.  
  271.  
  272.   5.10.  Where can I learn more about automounting?
  273.  
  274.   There's a autofs tutorial at  <
  275.   http://www.linuxhq.com/lg/issue24/nielsen.html>.  See also am-utils at
  276.   <http://www.cs.columbia.edu/~ezk/am-utils>
  277.  
  278.   (Thanks for these URLs)
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.