Not an automount article

You know what I need to write an article about? Automount. It's a great feature, it's very useful in these days of removable USB drives, and yet nobody seems to know about it.

If you don't know about automount, it's simply a feature whereby you can configure devices to be mounted on demand. So if, for example, you have an NFS share that you only access every once in a while, you can set up automount to handle it and then every time you access the mount point, if the share isn't mount, the system will mount it for you. And after the share is unused for a certain amount of time, it gets unmounted automatically. This magic happens through the combination of the kernel level autofs filesystem and the userland automount daemon.

This is really great for USB thumb drives. You can set it up so that you just stick the drive in a USB port, open it up in a file manager, do your stuff, close the file manager, and after two seconds the drive is cleanly unmounted and you just yank it out. Of course, there can be some complications. For one thing, this doesn't work if you're using a 2.4 series kernel and have multiple USB storage devices. To make this really work, you need udev, which is only supported on 2.6 kernels. That's because USB storage device names are not static - the first device you plug in gets the first available device name. Udev, however, lets the kernel assign static names to particular devices based on things like device serial numbers. Of course, it might be possible to fake this out in a 2.4 kernel by using hotplug and sniffing the output of dmesg, but that's not the easiest or most pleasant way to do things.

I wonder why it is that automount isn't more widely used by Linux distributors? Is it just because they like to handle things on the desktop level rather than the system level? I've heard that many distributions do things like automatically creating icons on the desktop when you plug in a USB stick, but, as a Slackware user, I've never actually seen it. I guess the thinking is that by using D-BUS or hotplug or whatever they use to do that, they can achieve greater flexibility than simply mounting. Maybe they see things like the Windows XP device dialog box as a goal. Although I'm not actually too fond of that feature of XP, I guess it might be useful to people new to computers.

You can reply to this entry by leaving a comment below. This entry accepts Pingbacks from other blogs.

Add your comments #

A comment body is required. No HTML code allowed. URLs starting with http:// or ftp:// will be automatically converted to hyperlinks.