Mounttero 0.4

Mounttero is a tool for automatically mounting drives using autofs.
Mounttero automatically mounts most storage devices such as USB drives and cameras, DVDs, CDROMs, hard disks, and floppies.

Devices are mounted when users opens their directory, such as /mnt/auto/cdrom, and are unmounted when the directory remains unused for four seconds.


For example, when user opens directory /mnt/auto/usb/, digital camera is automatically mounted and all the pictures shown in the directory. After four seconds of inactivity, device is unmounted and can be detached.

Manual Configuration

The rest of this document describes manual configuration of mounttero. If you installed the rpm, it did all this configuration automatically and you don't need manual configuration. The scripts below contain some latest and greatest version 0.5 improvements that have not made it to rpm yet, namely more usb partitions.

Create the directories used by the automounter. The directory is the one mentioned in /etc/auto.master:

# mkdir -p /mnt/auto/autofs

Create auto.master to tell autofs daemon that /mnt/auto/autofs directory is handled according to auto.tero

# /etc/auto.master
# mountpoint map options # see also: man 8 autofs
/mnt/auto/autofs /etc/auto.tero --timeout=4

List the actual mountpoints and devices in the automounter map

# /etc/auto.tero
# mountpoint_key options location_device # man 5 autofs
cdrom -fstype=auto,ro,nosuid,nodev,user :/dev/cdrom
cdrom1 -fstype=auto,ro,nosuid,nodev,user :/dev/cdrom1
usb -fstype=auto,nosuid,nodev,noexec,user,gid=100,umask=000 :/dev/sda1
# second and third partitions in usb device:
usb2 -fstype=auto,nosuid,nodev,noexec,user,gid=100,umask=000 :dev/sda2
usb3 -fstype=auto,nosuid,nodev,noexec,user,gid=100,umask=000 :dev/sda3
floppy -fstype=auto,nosuid,nodev,noexec,user,gid=100,umask=000 :/dev/fd0

hda1 -fstype=auto,nosuid,nodev,user :/dev/hda1
hda2 -fstype=auto,nosuid,nodev,user :/dev/hda2
hda3 -fstype=auto,nosuid,nodev,user :/dev/hda3
hda4 -fstype=auto,nosuid,nodev,user :/dev/hda4

hdb1 -fstype=auto,nosuid,nodev,user :/dev/hdb1
hdb2 -fstype=auto,nosuid,nodev,user :/dev/hdb2
hdb3 -fstype=auto,nosuid,nodev,user :/dev/hdb3
hdb4 -fstype=auto,nosuid,nodev,user :/dev/hdb4

hdc1 -fstype=auto,nosuid,nodev,user :/dev/hdc1
hdc2 -fstype=auto,nosuid,nodev,user :/dev/hdc2
hdc3 -fstype=auto,nosuid,nodev,user :/dev/hdc3
hdc4 -fstype=auto,nosuid,nodev,user :/dev/hdc4

hdd1 -fstype=auto,nosuid,nodev,user :/dev/hdd1
hdd2 -fstype=auto,nosuid,nodev,user :/dev/hdd2
hdd3 -fstype=auto,nosuid,nodev,user :/dev/hdd3
hdd4 -fstype=auto,nosuid,nodev,user :/dev/hdd4

# Serial ATA (SATA) disks are IDE emulated in Linux 2.6
hde1 -fstype=auto,nosuid,nodev,user :/dev/hde1
hde2 -fstype=auto,nosuid,nodev,user :/dev/hde2
hde3 -fstype=auto,nosuid,nodev,user :/dev/hde3
hde4 -fstype=auto,nosuid,nodev,user :/dev/hde4

# (c) 2003, 2004-05-29, 2004-09-19 Tero.Karvinen atta

# /etc/init.d/autofs restart

Now drives are automatically mounted when you try to access them. You can test it by inserting a cdrom, and cd /mnt/auto/autofs/cdrom. The CDROM is automatically mounted, and ls should show you contents of the cd. When you cd to another directory, such as home directory (cd), CDROM is umounted in four seconds and the eject button in the drive starts working.

To see which drives are mountable (have discs in drive), you can create symlinks (similar to shortcuts) to the mountpoints. You can create the symlinks manually for each drive, for example

# cd /mnt/auto/
# ln -s autofs/cdrom cdrom

last updated on:
April 8th, 2005, 17:15 GMT
license type:
GPL (GNU General Public License) 
developed by:
Tero Karvinen
ROOT \ System \ Filesystems
Download Button

In a hurry? Add it to your Download Basket!

user rating 15



Rate it!

Add your review!