1、添加记录到/etc/scsi_id.config
echo "options=--whitelisted --replace-whitespace" >> /etc/scsi_id.config
2、在本实例中 sdb-> sdd的块设备需要绑定
命令如下:
for i in b c d;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""
done
[root@jason1 ~]# for i in b c d;
> do
> echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""
> done
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="291bbf9b896a0f503", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="24d3963ec66158aac", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="2a188df0f367ec9ad", NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"
3、将这些RULE写入到/etc/udev/rules.d/99-oracle-asmdevices.rules中,根据需要修改name的值。
[root@jason1 rules.d]# vi 99-oracle-asmdevices.rules
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="291bbf9b896a0f503", NAME="asm-data", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="24d3963ec66158aac", NAME="asm-ocr", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="2a188df0f367ec9ad", NAME="asm-fra", OWNER="grid", GROUP="asmadmin", MODE="0660"
4、启动udev
[root@jason1 rules.d]# /sbin/start_udev
Starting udev: [ OK ]
[root@jason1 rules.d]# ll /dev/asm*
brw-rw---- 1 grid asmadmin 8, 16 Jun 25 22:43 /dev/asm-data
brw-rw---- 1 grid asmadmin 8, 48 Jun 25 22:43 /dev/asm-fra
brw-rw---- 1 grid asmadmin 8, 32 Jun 25 22:43 /dev/asm-ocr
[root@jason1 rules.d]#
备注:RHEL5的命令与RHEL6有所不同
RHEL5的命令为:/sbin/scsi_id -g -u -s
例如:
for i in b c d;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id -g -u -s %p\", RESULT==\"`scsi_id -g -u -s /block/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""
done