Linux平台下裸设备的绑定:
[root@qs-dmm-rh2 mapper]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all theother init scripts.
# You can put your own initialization stuff inhere if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
#####
# Oracle Cluster Voting disks
#####
chown oracle:oinstall /dev/mapper/voting*
chmod 660 /dev/mapper/voting*
raw /dev/raw/raw5 /dev/mapper/votingdiskp1
raw /dev/raw/raw6 /dev/mapper/votingdiskp2
raw /dev/raw/raw7 /dev/mapper/votingdiskp3
raw /dev/raw/raw8 /dev/mapper/votingdiskp4
#sleep 2
chown oracle:oinstall /dev/raw/raw5
chown oracle:oinstall /dev/raw/raw6
chown oracle:oinstall /dev/raw/raw7
chown oracle:oinstall /dev/raw/raw8
chmod 660 /dev/raw/raw5
chmod 660 /dev/raw/raw6
chmod 660 /dev/raw/raw7
chmod 660 /dev/raw/raw8
[root@felix2 raw]# vi /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all theother init scripts.
# You can put your own initialization stuff inhere if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
chown -R oracle:oinstall /dev/raw/raw*
chmod -R 660 /dev/raw/raw*
~
[root@felix2 sysconfig]# pwd
/etc/sysconfig
[root@felix2 sysconfig]# vi rawdevices
# rw device bindings
# format: <rawdev> <major> <minor>
# <rawdev> <blockdev>
# example: /dev/raw/raw1 /dev/sda1
# /dev/raw/raw2 8 5
#--添加裸设备、块设备的绑定条目:
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdc1
/dev/raw/raw3 /dev/sdd1
/dev/raw/raw4 /dev/sde1
service rawdevices start
chkconfig rawdevices on
service rawdevicesstatus
[root@felix2 sysconfig]# service rawdevices status
/dev/raw/raw1: bound to major 8, minor 17
/dev/raw/raw2: bound to major 8, minor 33
/dev/raw/raw3: bound to major 8, minor 49
/dev/raw/raw4: bound to major 8, minor 65
再查看裸设备:
[root@felix2 sysconfig]# cd /dev/raw
[root@felix2 raw]# ll
total 0
crw-rw---- 1 oracle oinstall 162, 1 May 21 15:03raw1
crw-rw---- 1 oracle oinstall 162, 2 May 21 15:35raw2
crw-rw---- 1 oracle oinstall 162, 3 May 21 15:35raw3
crw-rw---- 1 oracle oinstall 162, 4 May 21 15:35raw4
[root@felix2 raw]#
[root@felix2 raw]# chown oracle:oinstall/dev/raw/raw*
[root@felix2 raw]# ll
total 0
crw-rw---- 1 oracle oinstall 162, 1 May 21 15:03raw1
crw-rw---- 1 oracle oinstall 162, 2 May 21 15:37raw2
crw-rw---- 1 oracle oinstall 162, 3 May 21 15:37raw3
crw-rw---- 1 oracle oinstall 162, 4 May 21 15:37raw4
修改/etc/udev/rules.d/60-raw.rules文件
# 现在我们把/dev/sdb1 知道到raw1上,就可以在/etc/udev/rules.d/60-raw.rules文件里添加如下内容:
[root@centos~]#vi /etc/udev/rules.d/60-raw.rules
Cat >> /etc/udev/rules.d/60-raw.rules<< EOF
ACTION=="add",KERNEL=="sdb1",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add",KERNEL=="sdc1",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add",KERNEL=="sdd1",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sde1",RUN+="/bin/raw/dev/raw/raw4 %N"
ACTION=="add",KERNEL=="raw[1-5]",OWNER="oracle", GROUP="oinstall", MODE="660"
EOF
重启UDEV服务:
[root@rac1 ~]# start_udev
[root@zrac1 asmfileapp-linux5.4]# ls -lat/dev/raw/raw*
crw-rw---- 1 oracle oinstall 162, 4 Apr 10 00:49/dev/raw/raw4
crw-rw---- 1 oracle oinstall 162, 3 Apr 10 00:49/dev/raw/raw3
crw-rw---- 1 oracle oinstall 162, 2 Apr 10 00:49/dev/raw/raw2
crw-rw---- 1 oracle oinstall 162, 1 Apr 10 00:49/dev/raw/raw1