RedHat 4,5,6配置RAW或SCSI Rule
RedHat 4 RAW配置
1修改裸设备服务的配置文件: /etc/sysconfig/rawdevices. 添加下面2行。
格式:裸设备名 块设备名
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdb2
2 设置Oracle 用户对裸设备的访问权限。
编辑UDEV的权限文件:/etc/udev/permissions.d/50-udev.permissions
找到raw device部分,修改成如下格式:
# raw devices
raw*:oracle:dba:0660
raw/*:oracle:dba:0660
3 确认裸设备服务自启动,2个节点都要执行
[root@raw1 /]# chkconfig --list rawdevices
rawdevices 0:off 1:off 2:off 3:on 4:on 5:on 6:off
4. 启动raw devices 服务,确认裸设备创建成功,权限正确:
[root@raw1 /]# service rawdevices restart
Assigning devices:
/dev/raw/raw1 --> /dev/sdb1
/dev/raw/raw1: bound to major 8, minor 17
/dev/raw/raw1 --> /dev/sdb2
/dev/raw/raw1: bound to major 8, minor 18
done
[oracle@raw2 ~]$ cd /dev/raw
[oracle@raw2 raw]$ ls -lrt
total 0
crw-rw---- 1 oracle dba 162, 1 Feb 28 03:08 raw1
crw-rw---- 1 oracle dba 162, 2 Feb 28 03:08 raw2
RedHat 5 RAW配置
1修改/etc/udev/rules.d/60-raw.rules 文件
ACTION=="add", KERNEL=="/dev/sdb1", RUN+="/bin/raw /dev/raw/raw1 %N" ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="17", RUN+="/bin/raw /dev/raw/raw1 %M %m" ACTION=="add", KERNEL=="/dev/sdc1", RUN+="/bin/raw /dev/raw/raw2 %N" ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="33", RUN+="/bin/raw /dev/raw/raw2 %M %m" ACTION=="add", KERNEL=="/dev/sdd1", RUN+="/bin/raw /dev/raw/raw3 %N" ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="49", RUN+="/bin/raw /dev/raw/raw3 %M %m" ACTION=="add", KERNEL=="/dev/sde1", RUN+="/bin/raw /dev/raw/raw4 %N" ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="65", RUN+="/bin/raw /dev/raw/raw4 %M %m"
ACTION=="add", KERNEL=="raw1", OWNER="grid", GROUP="asmadmin", MODE="0660" ACTION=="add", KERNEL=="raw2", OWNER="grid", GROUP="asmadmin", MODE="0660" ACTION=="add", KERNEL=="raw3", OWNER="grid", GROUP="asmadmin", MODE="0660" ACTION=="add", KERNEL=="raw4", OWNER="grid", GROUP="asmadmin", MODE="0777" |
2 重启服务:
[root@rac1 ~]# start_udev
Starting udev: [ OK ]
3 查看raw设备:
[root@rac1 ~]# ls -lrt /dev/raw
RedHat 5 UDEV SCSI Rules配置
1 获取需要绑定为ASM Disk的磁盘uuid
# /sbin/scsi_id -g -u -s /block/sdb SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_ |
2 新建/etc/udev/rules.d/99-oracle-asmdevices.rules,增加以下内容
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" |
3 重启服务:
[root@rac1 ~]# start_udev
Starting udev: [ OK ]
RedHat 6 UDEV SCSI Rules
1 编辑/etc/scsi_id.config文件,如果该文件不存在,则创建该文件,添加如下行:
options=--whitelisted --replace-whitespace |
备注:在我的测试中,此步骤可以省略
2 获取需要绑定为ASM Disk的磁盘uuid,比如我们要使用/dev/sdc作为ASM磁盘,那么:
# scsi_id --whitelisted --replace-whitespace --device=/dev/sdc 1ATA_VBOX_HARDDISK_VB36a9e548-1838194a |
或
# /sbin/scsi_id -g -u -d /dev/sdb SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_ |
3 新建/etc/udev/rules.d/99-oracle-asmdevices.rules,增加以下内容
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=="dm-*", PROGRAM="scsi_id --page=0x83 --whitelisted --device=/dev/%k",RESULT=="3600c0ff00015c7b70253c05001000000", OWNER:="grid", GROUP:="oinstall" KERNEL=="dm-*", PROGRAM="scsi_id --page=0x83 --whitelisted --device=/dev/%k",RESULT=="3600c0ff00015c7b72553c05001000000", OWNER:="grid", GROUP:="oinstall" KERNEL=="dm-*", PROGRAM="scsi_id --page=0x83 --whitelisted --device=/dev/%k",RESULT=="3600c0ff00015c7b77165c05001000000", OWNER:="grid", GROUP:="oinstall" KERNEL=="dm-*", PROGRAM="scsi_id --page=0x83 --whitelisted --device=/dev/%k",RESULT=="3600c0ff00015c7b73753c05001000000", OWNER:="grid", GROUP:="oinstall" KERNEL=="dm-*", PROGRAM="scsi_id --page=0x83 --whitelisted --device=/dev/%k",RESULT=="3600c0ff00015c7b78065c05001000000", OWNER:="grid", GROUP:="oinstall" |
或
KERNEL=="sd*",BUS=="scsi",PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="3600c0ff00015c7b70253c05001000000",NAME="asmocrvote01", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*",BUS=="scsi",PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="3600c0ff00015c7b77165c05001000000",NAME="asmdata01", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*",BUS=="scsi",PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="3600c0ff00015c7b73753c05001000000",NAME="asmdata02", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*",BUS=="scsi",PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="3600c0ff00015c7b72553c05001000000",NAME="asmfra01", OWNER="grid", GROUP="asmadmin", MODE="0660" |
4 重启服务:
[root@rac1 ~]# start_udev
Starting udev: [ OK ]