Re: [udev] Specifying a fall-through rule for USB drives and keys



On Wed, 19 Oct 2011 16:13:36 -0400, <fab@xxxxxxxxxxxxxxxxxxxxxx> wrote:

Hello.

I've been trying to devise a fall-through rule, ideally I'd like to
automount some devices I own on precise mountpoints (these devices are
identified by serial number and/or manufacturer name), and use pmount
to mount anything else to /media/sd??.

$ cat /etc/udev/rules.d/00-myusb.rules
# udev rules file for my usb drive
ACTION!="add", GOTO="myusb_rules_end"
SUBSYSTEM!="block", GOTO="myusb_rules_end"
ATTR{partition}=="1", RUN+="/bin/logger -t myusb drive inserted %k"
LABEL="myusb_rules_end"

The above runs the logger command. Change it to run a script. The %k
gets replaced by the device name such as sdc1.

In the script, you can use blkid /dev/$1 to get the label or uuid
of the filesystem, to use to decide where to mount it.

Regards, Dave Hodgins

--
Change nomail.afraid.org to ody.ca to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)
.