【ASM】使用UDEV SCSI规则配置ASM

    xiaoxiao2022-07-04  163

    1. 使用vi /etc/udev/rules.d/99-oracle-asmdevices.rules命令,创建udev规则文件:

    ##OL5

    KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_", NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"

    KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_", NAME="asm-disk2", OWNER="oracle", GROUP="dba", MODE="0660"

    KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172_", NAME="asm-disk3", OWNER="oracle", GROUP="dba", MODE="0660"

    KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_", NAME="asm-disk4", OWNER="oracle", GROUP="dba", MODE="0660"

      

    ##OL6

    KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_", NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"

    KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_", NAME="asm-disk2", OWNER="oracle", GROUP="dba", MODE="0660"

    KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172_", NAME="asm-disk3", OWNER="oracle", GROUP="dba", MODE="0660"

    KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_", NAME="asm-disk4", OWNER="oracle", GROUP="dba", MODE="0660"

      

    ##OL7

    KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_", SYMLINK+="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"

    KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_", SYMLINK+="asm-disk2", OWNER="oracle", GROUP="dba", MODE="0660"

    KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172", SYMLINK+="asm-disk3", OWNER="oracle", GROUP="dba", MODE="0660"

    KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_", SYMLINK+="asm-disk4", OWNER="oracle", GROUP="dba", MODE="0660"

     

    某些参考资料有如下:

    创建配置文件

    [root@strong ~]# cat /etc/scsi_id.config

    options=-g  --配置SCSI设备为可信任的

    2.更新块设备的分区(/sbin/partprobe

    /sbin/partprobe /dev/sdb1

    /sbin/partprobe /dev/sdc1

    /sbin/partprobe /dev/sdd1

    /sbin/partprobe /dev/sde1

    3.测试规则

    ##OL5

    udevtest /block/sdb/sdb1

    udevtest /block/sdc/sdc1

    udevtest /block/sdd/sdd1

    udevtest /block/sde/sde1

     

    ##OL6 and OL7

    udevadm test /block/sdb/sdb1

    udevadm test /block/sdc/sdc1

    udevadm test /block/sdd/sdd1

    udevadm test /block/sde/sde1

    4.重新载入规则文件及启动udev服务(重启UDEV服务):

    ##OL5

    /sbin/udevcontrol reload_rules

     

    ##OL6 and OL7

    udevadm control --reload-rules

     

    ##OL5 and OL6,Not needed for OL7

    /sbin/start_udev

     

    5.检查磁盘的所属关系和权限:

    cd /dev

    ls -al asm-disk*

    brw-rw---- 1 oracle dba 8, 17 Apr  8 22:47 asm-disk1

    brw-rw---- 1 oracle dba 8, 33 Apr  8 22:47 asm-disk2

    brw-rw---- 1 oracle dba 8, 49 Apr  8 22:47 asm-disk3

    brw-rw---- 1 oracle dba 8, 65 Apr  8 22:47 asm-disk4

     

    附上一个在OL6上快速生成udev规则文件的脚本: 

    for i in b c d e f g;

    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\""  >> /etc/udev/rules.d/99-oracle-asmdevices.rules

    done

     

     

    OL7上快速生成udev规则文件的脚本:for i in c1 c2 c3;doecho "KERNEL==\"sd$i\", SUBSYSTEM=\"block\", PROGRAM==\"/usr/lib/udev/scsi_id -g -u -d /dev/\$parent\", RESULT==\"`/usr/lib/udev/scsi_id --device=/dev/sd$i`\", SYMLINK+=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""done

     

    最新回复(0)