Part 4 of the Linux Newbie Administrator Guide
4.2.8 Can I mount automatically?
(continued after ads...)
Yes, you can automatically mount a filesystem as you access it and unmount when you stop using it. It works similar to what you have experienced under MS Windows. Yet, if you used removable media extensively under DOS or Windows, you must have noticed that automounting is not entirely foolproof.
There are two utilities for automounting under Linux, and they are callled "supermount" and "automount".
Supermount. Mandrake 7.2 gives you the option of using "supermount" as a setup option. So the simplest way to "supermount" is to install latest Mandrake and select this option. My /etc/fstab on a computer running Mandrake may contain the following lines:
/ ext2 defaults 1 1
In the example above, you may notice that I selected to supermount 3 filesystems: cdrom, floppy and zipdrive. I can edit the file /etc/fstab manually (e.g. with pico) or use the supermount command to customize the supermount to my needs.
Automount. To set up "automount", I first run the programs ntsysv (as root) and make sure that automount service ("autofs") is enabled.
Then, I configure automount by editing the files /etc/auto.master and /etc/auto.misc, e.g. (as root):
My /etc/auto.master looks like that:
/misc /etc/auto.misc --timeout 1
This says that my automount devices will be mounted in the directory /misc (which must exist and be empty). My automount drives will automatically unmount one second after I stop using them (for example, after I exit the directory). This is a short time--you may choose a longer one. The detailed config file is /etc/auto.misc . Here is mine:
Each line consists of 3 space delimited fields. The first field is the "key" which will be the name of the subdirectory (under /misc) to which the device will be mounted. This directory must NOT exist. It will not be visible when I use the command ls , but I can "cd" to it and my device will then mount. Don't ask me why it is so, and how to use this automount in GUI. I don't know. The hacker stuff in my auto.misc is the cdrom and floppy from another computer in my home network.
I automount to the directory /misc (not /mnt) so that I can also mount filesystems manually, without using automount, to the directory /mnt.