Christopher Taylor wrote: > I'm trying to set the group ownership of a specific harddrive so that > it is accessible as a raw device inside a virtual machine. I think I > have the correct rule but it doesn't appear to work: > > SUBSYSTEM=="block", PROGRAM="/lib/udev/scsi_id --whitelisted --export > --page=0x80 --device=/dev/sdc | grep ^ID_SERIAL= | cut -f2 -d'='", > RESULT="SATA_WDC_WD2002FYPS-_WD-WCAVY0######", GROUP="vmware" RESULT== is what you need for this rule to work syntactically, I think. = assigns; == tests. However, this is still the wrong way to go about this. :-) The way (I think) you should match this device is, let the existing udev rules call scsi_id for you (since they will regardless, in order to generate /dev/disk/by-* links), and match on their result. So put the file containing this rule after 60-persistent-storage.rules (start its name with 61 or higher), and change it to something like: SUBSYSTEM=="block", ENV{ID_SERIAL}=="<whatever string>", GROUP="vmware" Where <whatever string> is what's shown in the environment by e.g. "udevadm test /block/sdX" (for whatever the correct sdX is at the moment) when it runs scsi_id. (Or you can probably ask the udev database somehow or other. You might even have the correct serial # already...) > Also, I have not successfully limited the rule by only the scsi serial > id ... the /dev/sdc is still in there. You could use $tempnode (or %N possibly?) for that, but I wouldn't bother. Just go with the results of the previous run of scsi_id. :-)
Attachment:
signature.asc
Description: OpenPGP digital signature