home *** CD-ROM | disk | FTP | other *** search
/ Freelog 2 / Freelog002.iso / Linux / Slackware / docs / mini / Automount < prev    next >
Encoding:
Text File  |  1999-02-08  |  7.9 KB  |  265 lines

  1.   Automount mini-Howto
  2.   don@sabotage.org
  3.   v0.2, 7 September 1998
  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 autodetected it as only a regular FAT disk.
  28.      5.4 My filesystem
  29.      5.5 Who do I thank for autofs?
  30.  
  31.  
  32.   ______________________________________________________________________
  33.  
  34.   1.  Introduction
  35.  
  36.   1.1.  Automount - what and why
  37.  
  38.   Automouting is the process where mounting (and unmounting) of certain
  39.   filesystems is done automatically by a daemon. If the filesystem is
  40.   unmounted, and a user attempts to access it, it will be automatically
  41.   (re)mounted. This is especially useful in large networked environments
  42.   and for crossmounting filesystems between a few machines (especially
  43.   ones which are not always online). It may also be very useful for
  44.   removable devices, or a few other uses, such as easy switching between
  45.   a forced-on ascii conversion mount of a dos filesystem and a forced-
  46.   off ascii conversion mount of the same dos fs.
  47.  
  48.  
  49.   1.2.  Types of automounting
  50.  
  51.   There are two types of automounters in linux; AMD and autofs. AMD is
  52.   the automount daemon, and supposedly works like the SunOS AMD. It is
  53.   implemented in user space, meaning it's not part of the kernel. Autofs
  54.   is a newer system assisted by the kernel, meaning that the kernel's
  55.   filesystem code knows where the automount mount points are on an
  56.   otherwise normal underlying fs, and the automount program takes it
  57.   from there. Only autofs will be described in this mini-howto.
  58.  
  59.  
  60.  
  61.   2.  Installation
  62.  
  63.   Because autofs is implemented in kernel-space, your kernel must have
  64.   support compiled in. In 2.0.xx it is an experimental option, but
  65.   appears to be quite stable. In 2.1.xx (and presumably 2.2.xx) it is
  66.   not experimental.
  67.   The automount program and its configuration files are also necessary;
  68.   using the rpms (from the usual places) is a great way to go. The
  69.   automount program should be started by an rc script under the
  70.   /etc/rc.d/init.d directory. The rpm installs this, but you will need
  71.   to make sure it gets started, either by linking it from your rc?.d
  72.   directory, using Redhat's control-panel, or on another distribution by
  73.   getting the thing started anyway you care to. Don't look too hard at
  74.   what the rc script does; if you're reading this howto you probably
  75.   don't want to know.
  76.  
  77.  
  78.   3.  Configuration
  79.  
  80.   Installing the RPM's is fun, but here's the part you might not be sure
  81.   about if you haven't done this before.
  82.  
  83.  
  84.   There are two files in /etc, one called auto.master and one called
  85.   auto.misc.  My auto.master looks like this:
  86.  
  87.   /auto   /etc/auto.misc  --timeout 60
  88.  
  89.  
  90.  
  91.   The first entry is not the mount point. It's where the set of mount
  92.   points (found in the second entry) are going to be. The third option
  93.   says that the mounted filesystems can try to unmount themselves 60
  94.   seconds after use. They can't unmount if being used, of course.
  95.  
  96.   Auto.misc is a "map file". Multiple map files can be defined in
  97.   auto.master.  My auto.misc looks like this:
  98.  
  99.   kernel          -ro,soft,intr           ftp.kernel.org:/pub/linux
  100.   cd              -fstype=iso9660,ro      :/dev/cdrom
  101.   zip             -fstype=auto            :/dev/hdd4
  102.   floppy          -fstype=vfat            :/dev/fd0
  103.  
  104.  
  105.  
  106.   The first column (the "key") is the mount point. In this case it would
  107.   be /auto/floppy or whatever. The middle set are the options; read the
  108.   mount manpage for details on this. And the last column specifies where
  109.   the fs comes from. The "kernel" entry is supposed to be an NFS mount.
  110.   The : on all the other lines means its a local device.
  111.  
  112.  
  113.  
  114.   4.  That long wait to unmount
  115.  
  116.   Some of you may be eyeing that 60 second timeout and thinking, that's
  117.   a long time to wait to eject a floppy.. Maybe I'll just sync the disks
  118.   and pop it out unmounted and nobody will notice. Let me suggest saner
  119.   alternatives.  First of all, you can change the timeout. But that
  120.   could be a little inefficient; telling the system to unmount stuff
  121.   after only 15 seconds or whatever. There is actually a way to ask the
  122.   automount program to umount. If you send (with the program kill) the
  123.   signal SIGUSR1 to the automount process, it will unmount everything it
  124.   can. But before people start making unmount buttons on their window
  125.   managers, there's a little problem.
  126.  
  127.   The automount process is run by root, and it will only accept signals
  128.   from root. Half of the reason you're probably doing automounting is so
  129.   you can mount an unmount *without* being root. It would be easy to
  130.   make a suid-root C program which does the dirty deed, which is the
  131.   suggested way of solving the problem if users aren't expected to
  132.   behave themselves.
  133.   If the users can be trusted somewhat, a compromise is possible with
  134.   the program sudo. By installing sudo with the following line:
  135.  
  136.   ALL     ALL=NOPASSWD:/bin/kill -SIGUSR1 [0-9]*
  137.  
  138.  
  139.  
  140.   you have made it possible for *anyone* on the system to send a SIGUSR1
  141.   signal to *any* process. This will have various effects on programs;
  142.   it will recycle afterstep window manager, but kill xemacs. So if your
  143.   users can be trusted to only send the process id of the automount
  144.   daemon (as found by pidof, for example) then this single command can
  145.   unmount things. That would be done with something like this:
  146.  
  147.   /usr/bin/sudo /bin/kill -SIGUSR1 `/sbin/pidof automount`
  148.  
  149.  
  150.   5.  Questions
  151.  
  152.  
  153.  
  154.   5.1.  I don't see /auto/floppy, or whatever mountpoint I'm looking
  155.   for.
  156.  
  157.   If automount is setup properly, whatever mount point you're looking
  158.   for will be there if you try and use it. If you're browsing the
  159.   directory with a graphical tool, you may need to type in the name
  160.   manually. Unfortunately not being able to choose from the available
  161.   invisible mount points is probably the major drawback of autofs. If it
  162.   really bugs you, edit the configuration files.  (Hint, they end in .c
  163.   for "configuration")
  164.  
  165.  
  166.  
  167.  
  168.   5.2.  How do I see what's mounted?
  169.  
  170.   The df command. mount with no options will do the same, plus show the
  171.   options its mounted with.
  172.  
  173.  
  174.  
  175.  
  176.   5.3.  FAT disk.  I put in a win95 disk ("vfat") and it autodetected it
  177.   as only a regular
  178.  
  179.   This is not a problem with automount. As of this writing, the "auto"
  180.   fs type does not attempt a vfat mount before it successfully mounts an
  181.   msdos filesystem. VFAT is the Win95 and WinNT long filenames crammed
  182.   into a FAT/MSDOS filesystem. This means that you can't mount vfat
  183.   unless you give up the ability to autodetect all other fs's. Hopefully
  184.   it will be fixed soon. In the mean time, feel free to create multiple
  185.   mount points.
  186.  
  187.  
  188.  
  189.  
  190.   5.4.  My filesystem /grumblesmurf  is mounted and kill -SIGUSR1  won't
  191.   unmount it.
  192.  
  193.   It's being used by something. Root probably can't manually unmount it
  194.   either. If you're the one who caused it to be mounted (i.e. it can't
  195.   be someone else using it) look around for a shell that might be in
  196.   that directory. If there are none, look for something else
  197.   (particularly something that might have gone though that directory
  198.   like a directory browser) that might have left an invisible foot in
  199.   the door so to speak.
  200.  
  201.  
  202.   5.5.  Who do I thank for autofs?
  203.  
  204.   Not me. I didn't have anything to do with it. I just wanted to bring
  205.   everyone's attention to what a great job had been done with autofs,
  206.   and how easy it is to use. Compared to the original perpetrators of
  207.   AMD (Hint, they sell an overpriced unice with prehistoric versions of
  208.   free tools) the autofs is very well documented and the implementors
  209.   have my sincere thanks.
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.