rhel5安装RAC时 OCR和VOTE磁盘RAW设备绑定及权限

rhel5安装RAC时 OCR和VOTE磁盘RAW设备绑定及权限

优点:

    避免使用/etc/rc.local文件在系统启动时才执行,可随时发现设备变化

环境说明:

    • 操作系统:rhel5.11

    • 多路径版本:device-mapper-multipath-0.4.7-63.el5

要求:

    • /dev/raw/raw1需绑定到 /dev/mapper/ocr01

    • /dev/raw/raw2需绑定到 /dev/mapper/ocr02

    • 均用于ocr设备。

    • 同时需要设置/dev/raw/raw*的权限

下面是udev的规则文件:

    [root@db01 ~]# cat /etc/udev/rules.d/40-multipath.rules 

    # multipath wants the devmaps presented as meaninglful device names

    # so name them after their devmap name

    SUBSYSTEM!="block", GOTO="end_mpath"

    KERNEL!="dm-[0-9]*", GOTO="end_mpath"

    PROGRAM!="/sbin/mpath_wait %M %m", GOTO="end_mpath"

    PROGRAM!="/sbin/dmsetup info -c --noheadings -j %M -m %m", GOTO="end_mpath"

    RESULT!="*:*:*:*:*:*:*:mpath-*", GOTO="kpartx_check"

    PROGRAM!="/sbin/dmsetup info -c --noheadings -o name -j %M -m %m", GOTO="end_mpath"

    RESULT!="?*", GOTO="end_mpath"

    NAME="%k", SYMLINK="mpath/%c"

    ACTION!="change", GOTO="skip_kpartx"

    RUN+="/bin/bash -c '/sbin/mpath_wait /dev/mapper/%c; /sbin/kpartx -a -p p /dev/mapper/%c'"

    #################add by Harry####################

    KERNEL!="dm-[0-9]*", GOTO="skip_dm"

    ACTION!="change", GOTO="skip_dm"

    PROGRAM!="/sbin/dmsetup ls --exec /bin/basename -j %M -m %m", GOTO="skip_dm"

    RESULT=="mpath1", RUN+="/bin/raw /dev/raw/raw1 /dev/mapper/mpath1p1"

    LABEL="skip_dm"

    KERNEL=="raw1", ACTION=="add", OWNER="root", GROUP="oinstall", MODE="0660"

    OPTIONS="last_rule"

    #################################################

    LABEL="skip_kpartx"

    OPTIONS="last_rule"

    LABEL="kpartx_check"

    RESULT!="*:*:*:*:*:*:*:part*-mpath-*", GOTO="end_mpath"

    PROGRAM=="/sbin/dmsetup info -c --noheadings -o name -j %M -m %m", RESULT=="?*", NAME="%k",  SYMLINK="mpath/%c"

    OPTIONS="last_rule"

    LABEL="end_mpath"

    [root@db01 ~]# cat /etc/udev/rules.d/99-oracle_raw.rules 

    KERNEL=="raw[1-2]*", OWNER="root", GROUP="oinstall", MODE="640"

    KERNEL=="raw[3-5]*", OWNER="oracle", GROUP="oinstall", MODE="660"


下面是测试结果:

    

[root@db01 ~]# dmsetup ls
cell01_disk01p1 (253,   5)
mpath1  (253, 3)
cell01_disk01   (253,   2)
VolGroup00-LogVol01     (253,   1)
VolGroup00-LogVol00     (253,   0)
mpath1p1        (253,   4)
[root@db01 ~]# 
[root@db01 ~]# multipath -F
[root@db01 ~]# multipath   -r
create: cell01_disk01 (36000c292118095b2be6b990e6fa298dd)    VMware,,VMware Virtual 
[size=10G][features=0][hwhandler=0][n/a]
\_   round-robin 0 [prio=1][undef]
 \_ 0:0:1:0  sdb 8:16    [undef][ready]
create: mpath1   (14f504e46494c4552584a536330632d727238742d68674655)    OPNFILER,VIRTUAL-DISK
[size=4.0G][features=0][hwhandler=0][n/a]
\_   round-robin 0 [prio=1][undef]
 \_ 31:0:0:0 sdc 8:32    [undef][ready]
\_ round-robin 0 [prio=1][undef]
 \_ 32:0:0:0 sdd   8:48  [undef][ready]
[root@db01 ~]# raw -qa
/dev/raw/raw1:    bound to major 253, minor 4
[root@db01 ~]# ls -l /dev/raw/
total   0
crw-r----- 1 root oinstall 162, 1 Nov 17 04:59  raw1



你可能感兴趣的:(raw,rhel5,ocr,multipath)