Rhel5

[root@rh64 ~]# /sbin/scsi_id -g -u -d /dev/sdc

1ATA_VBOX_HARDDISK_VB3d5ccb5e-9c197b67

查看磁盘信息,取出KERNEL ,SIZE作为规则

udevadm info -a -p /sys/block/sdc/sdc1


rhel6

/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sdb

Udev脚本 

for i in sdb sdc sdd sde sdf; do UUID=`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$i` ; echo 'KERNEL=="sd*", BUS=="scsi", PROGRAM=="scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="'$UUID'", NAME="asm-'$i'", OWNER="grid", GROUP="asmadmin", MODE="0660"'; done >> /etc/udev/rules.d/99-oracle.rules ; cat /etc/udev/rules.d/99-oracle.rules

start_udev

ll /dev/asm*

scp /etc/udev/rules.d/99-oracle.rules 2.2.2.20:/etc/udev/rules.d/99-oracle.rules


rhel7: 

99-oracle.asmdevices.rules 

for i in b c d e f

do

UUID=`/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`

echo 'KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="'$UUID'", SYMLINK+="asm-disk'$i'",OWNER="grid", GROUP="asmadmin",MODE="0660"'

done >> /etc/udev/rules.d/99-oracle.rules

/sbin/udevadm trigger --type=devices --action=change

udevadm control --reload-rules