Troy's autofs configuration for removable media

One of the favorite whines of Windows 95 and NT bigots about Linux is "What, you mean I can't just stick my floppy/CDROM/Zip/[fill in removable media format] in the drive and have the OS automatically mount it? That sucks!" Well, with the autofs automounter kernel driver in Linux, that's no longer a problem.

I have autofs set up to automatically mount my CDROM, floppy, and Zip drives whenever someone tries to access them; it unmounts the disk five seconds after the last access. The disks are mounted on /removable/cdrom/, /removable/floppy/, and /removable/zip/ respectively. Since these are a little too long to type regularly, I have symbolic links (/cdrom, /floppy, and /zip) which point to these directories. Changing into one of the directories (or the symbolic link) or accessing a file under it then causes autofs to mount that disk. For instance, typing more /zip/Quake2/readme.linux will cause autofs to automatically mount the Zip drive.

This process is not entirely bug free, of course. CDROMs generally won't mount until after they've been though an initial spinup, which can take anywhere from 3 to 15 seconds. Programs which load entire files into memory and write them back periodically, like emacs's ange-ftp remote file access mode, will sometimes complain about not being to write backup files. Finally, any problems the OS has with the underlying filesystems (vfat and iso9660, in my case) will not be masked by automounting. Still, these minor problems are worth it to not have to deal with the mount command for removable media.

These files have been tested with the autofs drivers that shipped with the stock Linux 2.0.18 kernel that shipped with Red Hat Linux 5.0, as well as a custom 2.0.32 kernel I built myself.


Troy A. Baer, tbaer@columbus.rr.com

Last modified: Fri Apr 10 20:18:36 XXX 1998