View previous topic :: View next topic |
Author |
Message |
jhohwie n00b
Joined: 10 Jul 2006 Posts: 18 Location: germany
|
Posted: Mon Jul 02, 2007 9:49 am Post subject: [solved] udev rule for western digital mybook |
|
|
hi there,
I bought a western digital MyBook 500GB.
I thought it would be nice to have a symlink like
Code: |
/dev/mybook -> sda1
|
So I wrote a simple rule in /etc/udev/rules.d/50-udev.rules
Code: |
KERNEL=="sda1", NAME="%k", SYMLINK="mybook"
|
I think that's a minimal rule, but doesn't work.
But the rule works for /dev/hda1. So if I replace
sda1 with hda1 the rule does its job and the symlink
will be created.
Seems that the rule for sd* devices will be overwritten somewhere.
I put the rule in 90-local.rules, but also doesn't work.
Any suggestions?
Thx
joe
Last edited by jhohwie on Mon Jul 02, 2007 11:31 am; edited 1 time in total |
|
Back to top |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Mon Jul 02, 2007 11:11 am Post subject: |
|
|
I use in /etc/udev/rules.d/10-local.rules
Code: | SUBSYSTEMS=="scsi", ATTRS{model}=="ST3320620AS*", NAME="%k", SYMLINK+="windows%n" |
To get the model:
Code: | udevinfo -a --name /dev/sda1 |
Read man udev for details. |
|
Back to top |
|
|
jhohwie n00b
Joined: 10 Jul 2006 Posts: 18 Location: germany
|
Posted: Mon Jul 02, 2007 11:31 am Post subject: |
|
|
ok,
I got it working...
each partition will get its own name:
Code: |
KERNEL=="sd?[0-9]", SYSFS{model}=="5000AAKS Externa", SYMLINK="mybook%n"
|
Code: |
$ ll /dev/mybook*
188087 lrwxrwxrwx 1 root root 4 Jul 2 13:30 /dev/mybook1 -> sda1
188097 lrwxrwxrwx 1 root root 4 Jul 2 13:30 /dev/mybook2 -> sda2
|
-joe |
|
Back to top |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Mon Jul 02, 2007 11:37 am Post subject: |
|
|
It's better with SYMLINK+= rather than SYMLINK=, in case udev adds symlinks for its own purposes in a later version.
Also, using SUBSYSTEMS is more elegant. "sd?[0-9]" wouldn't work with more than 9 partitions |
|
Back to top |
|
|
jhohwie n00b
Joined: 10 Jul 2006 Posts: 18 Location: germany
|
Posted: Mon Jul 02, 2007 11:59 am Post subject: |
|
|
PaulBredbury wrote: | It's better with SYMLINK+= rather than SYMLINK=, in case udev adds symlinks for its own purposes in a later version.
Also, using SUBSYSTEMS is more elegant. "sd?[0-9]" wouldn't work with more than 9 partitions |
... good point, therefore:
Code: |
SUBSYSTEMS=="scsi", SYSFS{model}=="5000AAKS Externa", SYMLINK+="mybook%n"
|
thx
joe |
|
Back to top |
|
|
|