udev rules not working

Derek Broughton news at pointerstop.ca
Thu Dec 11 23:10:04 UTC 2008

mparrilla at ono.com wrote:

> I have a usb pen drive and I want it to be mounted in a
> particular directory when I plug it.
> I have written a udev rule in the
> file /etc/udev/rules.d/50-MyRule.rules:
> BUS=="usb", KERNEL=="sd?1",
> ATTRS{product}=="USB DISK 2.0", ATTRS{serial}=="078A184502BD", NAME="%
> k", SYMLINK+="usb16GB%n"

OK, but there's no mount command there...
> and added to /etc/fstab the line:
> /dev/usb16GB1 /mnt/usbdisk    ext3  users,noauto,exec,suid  0     0

It's "noauto" - how do you expect it to be automatically mounted there?

> But when I plug the pen drive, it is automounted in /media/usb0,
> ignoring my udev rule.

Itclearly didn't ignore the rule, because...
> If I umount the device and do:
> mount
> /mnt/usbdisk
> It is correctly mounted.

How could it be mounted on /dev/usb16GB1, unless your udev rule worked?

> How can I get what I want?

You could probably execute a "mount" command from udev, but you probably 
really should be modify hal's .fdi files (and I have no idea how to do 
that).  fwiw, I thought gnome let you just rename the /media mountpoint 
by renaming the mounted device icon on your desktop (KDE 3.5 did, I have 
no idea about 4.1).

More information about the ubuntu-users mailing list