Associate
- Joined
- 21 May 2007
- Posts
- 1,464
Below is me bro's example file. I've pasted it rather than my current active one because his shows how to use more ATTRs to determine the device. For my drives, I used their serial number (found using fdisk or cfdisk I think), which worked a treat for the 4 newer, aluminium sleeved ones, but went a bit t*ts up when it came to the two older black plastic shrouded ones....they both have the same serial number...oooops, not been able to determine a satisfactory way to tell them apart yet. Also my WD passport 320 2.5" seems to change it's serial at random, as fast as I change the rule, it sorts itself out with a new serial to scuper me....most most odd indeed. I think you can use volume ID, and that would certainly fix all my problems, but it has thusfar eluded me.
Note that the convention "sd*1" limits each rule to the first partition on each drive, this can of course me adjusted.
steve@hal9000 ~ $ cat /mnt/work/06-usb-drive-rules.rules
# these rules generate rules for the my Sony Ericsson Phone.
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Sony Ericsson" \
ATTRS{idVendor}=="0fce", ATTRS{idProduct}=="e039", ATTR{size}=="399527
\
KERNEL=="sd*1", SYMLINK+="sonye-sd%n" OPTIONS="last_rule"
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Sony Ericsson" \
ATTRS{idVendor}=="0fce", ATTRS{idProduct}=="e039" \
KERNEL=="sd*1", SYMLINK+="sonye-int%n"
# these rules generate rules for my USB hard disks
SUBSYSTEMS=="usb", ATTRS{serial}=="035E045402E1" \
KERNEL=="sd*1", SYMLINK+="freecom1"
SUBSYSTEMS=="usb", ATTRS{serial}=="152D203380B6" \
KERNEL=="sd*1", SYMLINK+="freecom2"
SUBSYSTEMS=="usb", ATTRS{serial}=="FD300300D888" \
KERNEL=="sd*", SYMLINK+="hitachi%n"
SUBSYSTEMS=="usb", ATTRS{serial}=="00101000100000003437" \
KERNEL=="sd*1", SYMLINK+="mp3player1"
SUBSYSTEMS=="scsi", ATTRS{model}=="USB-DRIVEUNIT " \
ATTRS{vendor}=="FUJIFILM" \
KERNEL=="sd*1", SYMLINK+="fuji-finepix-a210"
Note that the convention "sd*1" limits each rule to the first partition on each drive, this can of course me adjusted.