Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] udev rule for western digital mybook
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
jhohwie
n00b
n00b


Joined: 10 Jul 2006
Posts: 18
Location: germany

PostPosted: Mon Jul 02, 2007 9:49 am    Post subject: [solved] udev rule for western digital mybook Reply with quote

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
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Mon Jul 02, 2007 11:11 am    Post subject: Reply with quote

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
View user's profile Send private message
jhohwie
n00b
n00b


Joined: 10 Jul 2006
Posts: 18
Location: germany

PostPosted: Mon Jul 02, 2007 11:31 am    Post subject: Reply with quote

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
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Mon Jul 02, 2007 11:37 am    Post subject: Reply with quote

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 :wink:
Back to top
View user's profile Send private message
jhohwie
n00b
n00b


Joined: 10 Jul 2006
Posts: 18
Location: germany

PostPosted: Mon Jul 02, 2007 11:59 am    Post subject: Reply with quote

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 :wink:


... good point, therefore:
Code:

SUBSYSTEMS=="scsi", SYSFS{model}=="5000AAKS Externa", SYMLINK+="mybook%n"


thx :wink:
joe
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum