[svlug] usb device automounting on linux

Brian J. Tarricone bjt23 at cornell.edu
Mon Jun 4 13:45:17 PDT 2007

On Mon, 4 Jun 2007 12:23:15 -0700 Akkana Peck wrote:

>Joe Brenner writes:

>> Pointers to write-ups on how linux usb automount stuff *really* works
>If you're really asking about automount, that's normally handled
>by hal (the Hardware Abstraction Layer) these days. But I don't
>think you are if you're running icewm and you're willing to type
>your own mount commands.

Well, actually, in this case, HAL just provides the information another
app could use to enumerate devices and be notified of device
addition/removal.  HAL also has methods to mount/unmount/eject volumes,
but HAL won't do automounting on your behalf.   It's up to another
application (gnome-volume-manager on GNOME, thunar-volman on Xfce, not
sure what does it on KDE) to actually do the mount if the user has
enabled automount.

There are other non-desktop-environment ways to automount removable
devices, like ivman, but I don't have much experience with it/them.

>Creating the /dev/sdXX devices is normally handled by udev (but
>sometimes with hal's help, depending on the distro and the device).

HAL only reacts to the device plug/unplug.  udev or devfs always handles
creating the device node -- or you can just have a static /dev tree,
but that seems to be much less common these days.

>Neither hal nor udev is very well documented, though you already
>found the main udev doc.

Don't worry about either HAL or udev -- any recent distro should be set
up already with those bits doing their thing.  Just make sure you're
set up to have these guys starting on boot (grepping through the ps
list for 'udevd' and 'hald' will show you that).  Neither HAL or udev
should require any configuration to work properly; usually it just
requires changes if you want to tweak things.

If you want to be desktop-agnostic, you'll need ivman or perhaps
something else.  If you're ok with GNOME or Xfce, one of
gnome-volume-manager or thunar-volman is what you want.  (Again, I don't
know how KDE works.)

Usually these volumes get automounted under /media/<volume label>
or /media/<device node name>, though you can tweak HAL and/or the
automount daemons to change this.

>There are some issues with particular types of devices, like
>flash card readers with multiple slots. And of course, there are
>lots of USB devices that don't act like a usb-storage device at
>all, like Canon cameras that require gphoto2. If you give more
>details on what devices you're trying to use and what distro+version
>you're using, folks might be able to help you figure out why the
>device isn't showing up.

Yep.  Especially cameras and music players can be difficult, but
thunar-volman, and I believe gnome-volume-manager as well, both have
facilities for launching a libgphoto2-capable GUI app for cameras or a
user-defined music player manager app for DMPs.

But really, as others have asked, we really need to know the device
type to help you out, as well as dmesg output as the device is plugged
in so we know if it's actually a usb-storage device, or something else
entirely.  If it's not usb-storage, and it happens to have a special
kernel-space driver (kinda rare, I think), you can tell by looking
in /proc/bus/usb/devices for a line that has a 'Driver=' entry on it to
know what driver it's using.  You can also verify there that it's
usb-storage, though usually dmesg output makes that obvious.


More information about the svlug mailing list