More Elegant udev rules

"Greg Stevenson" <[email protected]> Mon, 21 Nov 2011 08:26:56 +1300
Newsgroups gmane.org.user-groups.linux.new-zealand.general
Message-ID <[email protected]>
I found the following udev rules on the citrix forums designed to expose
hard drive devices to VMs. By adding these rules to 50-udev.rules it does
the job but exposes a bunch of other rubbish I could do without.

 

ACTION=="add", SYSFS{vendor}=="ATA     ",
ID=="1:0:0:0|2:0:0:0|3:0:0:0|4:0:0:0",

SYMLINK+="xapi/block/%k", \

RUN+="/bin/sh -c '/opt/xensource/libexec/local-device-change %k 2>&1
>/dev/null&'"

ACTION=="remove", SYSFS{vendor}=="ATA     ",
ID=="1:0:0:0|2:0:0:0|3:0:0:0|4:0:0:0", \

RUN+="/bin/sh -c '/opt/xensource/libexec/local-device-change %k 2>&1
>/dev/null&'"

 

Can anyone see how I could alter these rules to only expose my 3 2Tb Seagate
sata drives? And while we are at it, is there a way to use IOCTL or hdparm
within the rules to turn write cache off on each of my three drives without
turning it off on the drive holding the system? (a completely separate
drive, SSD in this case, which is also exposed to the VMs by the above
rules)

 

Cheers

 

Greg Stevenson

_______________________________________________
NZLUG mailing list [email protected]
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug