[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: handling removable media without gnome-volume-manager



On Sun, Mar 28, 2010 at 09:58:31PM -0700, briand@aracnet.com wrote:

> That seems like a pretty good system.
> 
> I'm unclear what the order of execution is.  Does udev create the event
> which invokes automount ?
> 
> and if automount is executed first, how is it getting invoked ?

Autofs starts up the automount daemons at bootup. One is configured to
use the map file /etc/auto.removable. This is done by adding the
following line to /etc/auto.master:

/media/auto /etc/auto.removable  --timeout=2 --ghost

This is a very important detail which I inadvertantly left out of my
previoust post. It tells automount to create a directory under
/media/auto for each mapping in /etc/auto.removable. My apologies for
neglecting to mention it earlier.

When a usb or firewire device is plugged-in or unplugged, the rule
file I attached earlier checks if it it is a filesystem, and if so
runs the script /usr/local/bin/removable_drive_handler which checks if
the event is an add or remove, and then adds or removes lines from the
autofs map file /etc/auto.removable. It then sends a SIGHUP signal to
the automount process causing it to reload the new /etc/auto.removable.

Some devices such as my ipod generate spurious device names during
plugging, so there's a delayed test of the mountpoint, and if it's
bogus autofs will remove it. 

This script contains more than its fair share of crockery, and could
use improvement, but it works for me.

dt

-- 
Dave Thayer           | Whenever you read a good book, it's like the 
Denver, Colorado USA  | author is right there, in the room talking to 
dave@thayer-boyle.com | you, which is why I don't like to read 
                      | good books. - Jack Handey "Deep Thoughts"


Reply to: