From: Chris Bannister on
On Sat, Mar 27, 2010 at 12:41:45PM +0000, Clive Standbridge wrote:
> usbmount does this (apart from different behaviour for different
> devices).
>
> To set up:
> - Install the usbmount package.
> - Modify/add lines in /etc/usbmount/usbmount.conf:
> FILESYSTEMS="ext2 ext3 vfat"
> MOUNTOPTIONS="sync,noexec,nodev,noatime"
> FS_MOUNTOPTIONS="-fstype=vfat,flush,gid=plugdev,dmask=0002,fmask=0113"
> - Add user(s) to plugdev group.
> - Load kernel modules:
> sudo modprobe usb-storage
> sudo modprobe sd_mod
> (and add them to /etc/modules)

Do you still need to add them to /etc/modules if you are using udev?

--
Chris.


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/20100328140336.GH21054(a)fischer
From: Dave Thayer on
On Fri, Mar 26, 2010 at 09:46:05PM -0700, briand(a)aracnet.com wrote:
> Hi all,
>
> I'd like something where I can encode the behavior for particular
> devices, i.e. as I'm using the same devices over and over I'd like a
> way to make sure that the same device gets mapped to the same thing.
>
> Not needing X to be up and running is nice too.

I use automount with a udev-fired script which generates automount
maps based upon the usb (or firewire) device's label.

For instance, my backup drive is labeled rsnapshot_backup. When I plug
it in, an automount map is created for /media/auto/rsnapshot_backup/.
When unplugged, the map and mount directory is removed.

My script still has some rough edges, It contains a fair amount of
crockery to deal with devices which generate multiple add events, such
as my ipod.

It's fairly short so I'll attach a copy to this posting.

HTH

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(a)thayer-boyle.com | you, which is why I don't like to read
| good books. - Jack Handey "Deep Thoughts"

From: briand on
On Sun, 28 Mar 2010 20:21:20 -0600
Dave Thayer <debian1008610.dmthayer(a)recursor.net> wrote:

> On Fri, Mar 26, 2010 at 09:46:05PM -0700, briand(a)aracnet.com wrote:
> > Hi all,
> >
> > I'd like something where I can encode the behavior for particular
> > devices, i.e. as I'm using the same devices over and over I'd like a
> > way to make sure that the same device gets mapped to the same thing.
> >
> > Not needing X to be up and running is nice too.
>
> I use automount with a udev-fired script which generates automount
> maps based upon the usb (or firewire) device's label.
>
> For instance, my backup drive is labeled rsnapshot_backup. When I plug
> it in, an automount map is created for /media/auto/rsnapshot_backup/.
> When unplugged, the map and mount directory is removed.
>
> My script still has some rough edges, It contains a fair amount of
> crockery to deal with devices which generate multiple add events, such
> as my ipod.
>

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 ?


Brian


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/20100328215831.28815d24(a)windy.deldotd.com
From: Clive Standbridge on
> > - Load kernel modules:
> > sudo modprobe usb-storage
> > sudo modprobe sd_mod
> > (and add them to /etc/modules)
>
> Do you still need to add them to /etc/modules if you are using udev?

I'm not certain, but I believe usbmount has always needed udev, and at
some point it seems to have been necessary to load those modules
explicitly.


--


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/20100329094717.GA8480(a)rimmer.esmertec.com
From: Dave Thayer on
On Sun, Mar 28, 2010 at 09:58:31PM -0700, briand(a)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(a)thayer-boyle.com | you, which is why I don't like to read
| good books. - Jack Handey "Deep Thoughts"


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/20100330041658.GA3317(a)thayer-boyle.com