Floppy handling under Linux is arse, by default. Want to get stuff off a floppy? Mount the floppy first (either by clicking something on your desktop or from the command line), do whatever you need to, and then (and this is the arse bit) unmount the floppy before you take it out. Otherwise your data might get corrupted. Anyone who just said "what the fuck does unmount mean?" proves the point.
Anyway, I whined piteously about this on my LUG mailing list, and lots of people said I needed an automounter. There seem to be three: SuperMount, autofs, and amd. SuperMount needs to be in the kernel but isn't part of the Debian stock kernel, so that was out -- I'm not compiling a kernel on that machine. The old BSD daemon, amd, is in userspace, which seemed nice, but it's a bit old and people gave me fishy looks when I asked about it. So, I spent a while reading complicated documents explaining all about autofs; that's also a kernel thing, but it's in the Debian stock kernel. I didn't get very far with the documents; they're all hard and cover lots of edge cases and so on. About to give up in frustration that I couldn't understand the documentation (this is not an uncommon experience for me) I remembered that Debian packages sometimes have helpful docs written by the Debian maintainer. So, I installed autofs (the userland utilities):
root@spike # apt-get install autofs
The documentation in /usr/share/doc/autofs directed me at
two newly created files, /etc/auto.misc and
/etc/auto.master. The first, auto.misc, lists
all the stuff you want automounted. There's already a line in there for
the floppy, so we don't need to touch that. The second,
auto.master, says where the mount point is for automounted
stuff: the line in there fairly obviously says that stuff listed in
/etc/auto.misc gets automounted in
/var/autofs/misc. So, I put in a floppy and did:
root@spike # ls /var/autofs/misc/floppy
and it mounted the floppy and showed me what was on it. That was it. So all I had to do to get it working was install autofs from the Debian archive. I love Debian.
Of course, that wasn't quite it; I wanted it to work as a
user, and I wanted it to unmount the floppy really quickly after the
last activity (so it could be taken out pretty much immediately after
saving). So, I made two customisations; the first was to add a timeout
to auto.master. Change the line which says
/var/autofs/misc /etc/auto.misc
to say
/var/autofs/misc /etc/auto.misc --timeout 5
That means that the floppy will get unmounted after five seconds of inactivity, which is pretty much straight away.
The second change was to make it work for ordinary users: in
/etc/auto.misc, change the line
floppy -fstype=auto,sync,nodev,nosuid :/dev/fd0
to say
floppy -fstype=auto,sync,nodev,nosuid,gid=floppy,umask=002 :/dev/fd0
All we've done there is set permissions on the files to be rwxrwxr-x, and set te group to be "floppy". Basically, this means that anyone in group "floppy" can edit stuff on the disc.
And that's all we need.
© sil, September 2003