Tero Karvinen - Articles - Downloads - Courses - Contact

Table of Contents

MountTero - Mount USB, Camera, DVD, Hard Disk and CDROM Automatically

USB drives, DVDs, CDROMs and other drives must be mounted before they are used. This article explains how any drive can be mounted automatically when it is needed. For most Linux distributions, such as Fedora Core, automounting works by just installing mounttero, a generic configuration for aufofs.

Benefits of method described here: works with or without graphical desktop, uses standard software (mounttero is an autofs map), configuration works for many users out-of-the-box, no need to install new software. Fedora RPM available.

© 2004-2005 Tero Karvinen http://www.iki.fi/karvinen. Latest version of this document is at http://www.iki.fi/karvinen/mounttero.html


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.


Fedora and Red Hat

If you want it to just work,

su -

to root, install the rpm and start autofs automounting daemon:

# rpm -Uvh http://www.iki.fi/karvinen/linux/doc/automatic-mounting-autofs-files/mounttero-0.4-4.i386.rpm
# /etc/init.d/autofs restart
# chkconfig autofs on

On some systems you must specifically allow normal users to use /mnt/auto:

# chmod -R a+rx /mnt/auto

Insert a cdrom in drive and

cd /mnt/auto/cdrom

. That’s it, you just installed mounttero.

Other Linuxes

Mounttero is availble for other Linuxes as a tarball. I have heard that Debian package is on the way. Once that is done, mounttero hopefully finds it way to Ubuntu too.

Technical Details

Programmers might want to read about mounttero technical details.


Sundaram 2002: Automount mini-Howto

Autofs is the kernel based automounter included in many distributions, such as Fedora. Many automounters actually use autofs: mounttero, auto-autofs and mkautosmb. fm pop 2,50%, vit 0,01% rat 7,81

auto-autofs perl script to create autofs map. fm pop 0,98%, vit 0,02%, rat nr

Mntd “is an automount daemon and shared library written in C for automatically mount hotplug devices like USB sticks, Compact Flash cards or other mountable devices on linux 2.6.x kernels.” GPL. fm pop 0,12%, vit 0,00%, rat nr.

Magic Mounter is a user space automounter that uses volume names as mountpoints. fm pop 0,15%, vit 0,00%, rat nr

Usb-mount adds icons of usb devices on desktop when hotplug notices them.

Amount “mounts all the partitions mentioned in a command line, runs the command, and then unmounts them again.”

Virtualfs virtual file system mounter with plugins for various things. GPL. pop 0,19% vit 0,00%, rat nr

Supermount kernel patch for 2.0, 2.2 and 2.4. fm. As a competing program, autofs, comes with most distributions, recompiling the kernel looks like too much trouble.

am-utils fm

Gnome automounter. Can pop up a window when a medium is inserted to drive. Implemented on window manager/desktop, so that it does not work on text only mode. Does not work if you are not using Gnome. For me, it (gnome, nautilus?) sometimes refuses to eject cdrom even though no program seems to use the drive: “Device busy”. Fixed with

lsof|grep /mnt/cdrom

and then

kill -9 123456

, where 123456 is the process number.

KDE automounter.

To automount samba network neighbourhood, there are SMB for Fuse (fm) and mkautosmb (fm)

AVFS - a virtual filesystem allows mounting of compressed files and remote volumes (sf). FUSE is part of AVFS. LUFS is similar tool with less plugins.

Ribeiro: Autofs no Slackware. Fix for Slackware 9 problem with rc.autofs “Unknown system, please port and contact autofs@linux.kernel.org”.

Mounttero on the Press

Fresmeat record on mounttero, published 2004-05-30.

Notes and Copyright

Todo: screenshot of automounted camera in nautilus or konqueror. Change cdrom fstype from iso9660 to auto in rpm too, or dvds won’t work. Remove “dvd” entry that duplicates cdrom or cdrom1 unnecessarily. Recompile rpm to include more usb partitions.

Thanks to Lauri Sandelin for usb partitions fix and Kosti Kartano for bugreport. Thanks to alias “xlynx” for Slackware 9 autofs fix.

Copyright Tero Karvinen http://www.iki.fi/karvinen

2003 (initial release of configuration files only)

2004-05-29 (html file, explanations, RPM)

2004-05-30 (Quick RPM installation instructions, links to tutorial and alternative automounters)

2004-09-19 (more usb partitions, link to Slackware 9 fix).

2005-11-07 (Web page clean up)

GNU Free Document License with no Invariant Sections, with the Front-Cover Texts and Back-Cover Texts being “Contains a document by Tero Karvinen http://www.iki.fi/karvinen“.

Last modified: 2005-11-07. Permanent url: http://www.iki.fi/karvinen/mounttero.html

Tero Karvinen www.iki.fi/karvinen - Top - Validate HTML - Validate CSS