论坛首页 综合技术论坛

linux 5 裸设备绑定

浏览 4028 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (4) :: 隐藏帖 (0)
作者 正文
   发表时间:2010-11-17  
在以前的redhat版本中,系统通过/etc/sysconfig/rawdevices配置raw的控制文件,通过/etc/init.d/rawdevices来管理raw设备的启动和关闭。
redhat5正规的方法是通过udev来管理raw。裸设备绑定的重启命令为start_udev
今天在数据库检查过程中碰到一客户,没有在系统启动过程实现裸设备自动绑定。简单做下记录,以便不时之需。

[root@wms01 dbcheck]#  more /etc/redhat-release
CentOS release 5.2 (Final)

wms:
[root@wms01 ~]# cd /dev/raw
[root@wms01 raw]# ls -rtl
total 0
crw-rw---- 1 root   oinstall 162, 19 Aug  8 14:29 raw19
crwxr-xr-x 1 oracle oinstall 162, 12 Aug  8 14:29 raw12
crwxr-xr-x 1 oracle oinstall 162, 13 Aug  8 14:29 raw13
crwxr-xr-x 1 oracle oinstall 162,  5 Nov 17 13:54 raw5
crwxr-xr-x 1 oracle oinstall 162,  7 Nov 17 13:54 raw7
crwxr-xr-x 1 oracle oinstall 162,  4 Nov 17 13:54 raw4
crw-r--r-- 1 oracle oinstall 162, 20 Nov 17 13:54 raw20
crwxr-xr-x 1 oracle oinstall 162,  2 Nov 17 13:54 raw2
crwxr-xr-x 1 oracle oinstall 162,  3 Nov 17 13:54 raw3
crwxr-xr-x 1 oracle oinstall 162,  9 Nov 17 13:54 raw9
crwxr-xr-x 1 oracle oinstall 162,  8 Nov 17 13:54 raw8
crwxr-xr-x 1 oracle oinstall 162,  6 Nov 17 13:54 raw6
crwxr-xr-x 1 oracle oinstall 162, 11 Nov 17 13:54 raw11
crwxr-xr-x 1 oracle oinstall 162, 10 Nov 17 13:54 raw10

[root@wms01 raw]#  raw -qa
/dev/raw/raw2:  bound to major 253, minor 27
/dev/raw/raw3:  bound to major 253, minor 19
/dev/raw/raw4:  bound to major 253, minor 28
/dev/raw/raw5:  bound to major 253, minor 29
/dev/raw/raw6:  bound to major 253, minor 8
/dev/raw/raw7:  bound to major 253, minor 9
/dev/raw/raw8:  bound to major 253, minor 10
/dev/raw/raw9:  bound to major 253, minor 11
/dev/raw/raw10: bound to major 253, minor 12
/dev/raw/raw11: bound to major 253, minor 13
/dev/raw/raw12: bound to major 253, minor 14
/dev/raw/raw13: bound to major 253, minor 15
/dev/raw/raw19: bound to major 253, minor 33
/dev/raw/raw20: bound to major 253, minor 31

[root@wms01 dev]# ls -rtl |grep 253
brw-------  1 root root 253,     0 Aug  8 14:27 root
brw-rw----  1 root root 253,     9 Aug  8 14:28 dm-9
brw-rw----  1 root root 253,    10 Aug  8 14:28 dm-10
brw-rw----  1 root root 253,    11 Aug  8 14:28 dm-11
brw-rw----  1 root root 253,    12 Aug  8 14:28 dm-12
brw-rw----  1 root root 253,    13 Aug  8 14:28 dm-13
brw-rw----  1 root root 253,    14 Aug  8 14:28 dm-14
brw-rw----  1 root root 253,    15 Aug  8 14:28 dm-15
brw-rw----  1 root root 253,    16 Aug  8 14:28 dm-16
brw-rw----  1 root root 253,    17 Aug  8 14:28 dm-17
brw-rw----  1 root root 253,    18 Aug  8 14:28 dm-18
brw-rw----  1 root root 253,    19 Aug  8 14:28 dm-19
brw-rw----  1 root root 253,    22 Aug  8 14:28 dm-22
brw-rw----  1 root root 253,    20 Aug  8 14:28 dm-20
brw-rw----  1 root root 253,    24 Aug  8 14:28 dm-24
brw-rw----  1 root root 253,    21 Aug  8 14:28 dm-21
brw-rw----  1 root root 253,    23 Aug  8 14:28 dm-23
brw-rw----  1 root root 253,    26 Aug  8 14:28 dm-26
brw-rw----  1 root root 253,    27 Aug  8 14:28 dm-27
brw-rw----  1 root root 253,    28 Aug  8 14:28 dm-28
brw-rw----  1 root root 253,    29 Aug  8 14:28 dm-29
brw-rw----  1 root root 253,    31 Aug  8 14:28 dm-31
brw-rw----  1 root root 253,    30 Aug  8 14:28 dm-30
brw-rw----  1 root root 253,    32 Aug  8 14:28 dm-32
brw-rw----  1 root root 253,    33 Aug  8 14:28 dm-33
brw-rw----  1 root root 253,     8 Aug  8 14:28 dm-8
brw-rw----  1 root root 253,    25 Aug  8 14:28 dm-25


SQL> col name for a20
SQL> col path for a20
SQL> select name,path from v$asm_disk;

NAME                 PATH
-------------------- --------------------
                     /dev/raw/raw20
                     /dev/raw/raw19
LOGASM1_0001         /dev/raw/raw13
LOGASM1_0000         /dev/raw/raw12
DGASM1_0009          /dev/raw/raw11
DGASM1_0008          /dev/raw/raw10
DGASM1_0007          /dev/raw/raw9
DGASM1_0006          /dev/raw/raw8
DGASM1_0005          /dev/raw/raw7
DGASM1_0004          /dev/raw/raw6
DGASM1_0003          /dev/raw/raw5

NAME                 PATH
-------------------- --------------------
DGASM1_0002          /dev/raw/raw4
DGASM1_0001          /dev/raw/raw3
DGASM1_0000          /dev/raw/raw2

14 rows selected.

[oracle@wms01 ~]$ crsctl query css votedisk
0.     0    /dev/raw/raw20

located 1 votedisk(s).

[oracle@wms01 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :    1027888
         Used space (kbytes)      :       4600
         Available space (kbytes) :    1023288
         ID                       : 2049410580
         Device/File Name         : /dev/raw/raw19
                                    Device/File integrity check succeeded

                                    Device/File not configured

         Cluster registry integrity check succeeded
        
[oracle@wms01 dbs]$ more  init+ASM1.ora
##############################################################################
# Copyright (c) 1991, 2001, 2002 by Oracle Corporation
##############################################################################

###########################################
# Cluster Database
###########################################
cluster_database=true

###########################################
# Diagnostics and Statistics
###########################################
background_dump_dest=/oracle/admin/+ASM/bdump
core_dump_dest=/oracle/admin/+ASM/cdump
user_dump_dest=/oracle/admin/+ASM/udump

###########################################
# Miscellaneous
###########################################
instance_type=asm

###########################################
# Pools
###########################################
large_pool_size=12M

###########################################
# Security and Auditing
###########################################
remote_login_passwordfile=exclusive
asm_power_limit=5
asm_diskgroups='DGASM1','LOGASM1'
asm_diskstring='/dev/raw/*'
+ASM2.instance_number=2
+ASM1.instance_number=1

最终配置
/home/oracle/dbcheck/60-raw.rules
# This file and interface are deprecated.
# Applications needing raw device access should open regular
# block devices with O_DIRECT.
#
# Enter raw device bindings here.
#
# An example would be:
#   ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
#   ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.
[root@wms01 dbcheck]# vi 60-raw.rules

# This file and interface are deprecated.
# Applications needing raw device access should open regular
# block devices with O_DIRECT.
#
# Enter raw device bindings here.
#
# An example would be:
#   ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
#   ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.
ACTION=="add",KERNEL=="dm-27",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add",KERNEL=="dm-19",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add",KERNEL=="dm-28",RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add",KERNEL=="dm-29",RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add",KERNEL=="dm-8",RUN+="/bin/raw /dev/raw/raw6 %N"
ACTION=="add",KERNEL=="dm-9",RUN+="/bin/raw /dev/raw/raw7 %N"
ACTION=="add",KERNEL=="dm-10",RUN+="/bin/raw /dev/raw/raw8 %N"
ACTION=="add",KERNEL=="dm-11",RUN+="/bin/raw /dev/raw/raw9 %N"
ACTION=="add",KERNEL=="dm-12",RUN+="/bin/raw /dev/raw/raw10 %N"
ACTION=="add",KERNEL=="dm-13",RUN+="/bin/raw /dev/raw/raw11 %N"
ACTION=="add",KERNEL=="dm-14",RUN+="/bin/raw /dev/raw/raw12 %N"
ACTION=="add",KERNEL=="dm-15",RUN+="/bin/raw /dev/raw/raw13 %N"
ACTION=="add",KERNEL=="dm-33",RUN+="/bin/raw /dev/raw/raw19 %N"
ACTION=="add",KERNEL=="dm-31",RUN+="/bin/raw /dev/raw/raw20 %N"
KERNEL=="raw[2-13]", OWNER="oracle", GROUP="oinstall", MODE="755"
KERNEL=="raw[19]", OWNER="root", GROUP="oinstall", MODE="660"
KERNEL=="raw[20]", OWNER="oracle", GROUP="oinstall", MODE="644"


erp:
[root@erp01 ~]# cd /dev/raw
[root@erp01 raw]# ls -rtl
total 0
crwxr-xr-x 1 oracle oinstall 162, 23 Apr  7  2010 raw23
crwxr-xr-x 1 oracle oinstall 162, 18 Nov 17 14:27 raw18
crwxr-xr-x 1 oracle oinstall 162, 17 Nov 17 14:27 raw17
crwxr-xr-x 1 oracle oinstall 162, 12 Nov 17 14:27 raw12
crw-rw---- 1 root   oinstall 162,  2 Nov 17 14:27 raw2
crwxr-xr-x 1 oracle oinstall 162,  8 Nov 17 14:27 raw8
crwxr-xr-x 1 oracle oinstall 162, 14 Nov 17 14:27 raw14
crwxr-xr-x 1 oracle oinstall 162, 19 Nov 17 14:27 raw19
crwxr-xr-x 1 oracle oinstall 162, 21 Nov 17 14:27 raw21
crwxr-xr-x 1 oracle oinstall 162, 16 Nov 17 14:27 raw16
crwxr-xr-x 1 oracle oinstall 162, 13 Nov 17 14:27 raw13
crwxr-xr-x 1 oracle oinstall 162, 11 Nov 17 14:27 raw11
crwxr-xr-x 1 oracle oinstall 162, 15 Nov 17 14:27 raw15
crwxr-xr-x 1 oracle oinstall 162,  9 Nov 17 14:27 raw9
crwxr-xr-x 1 oracle oinstall 162,  7 Nov 17 14:27 raw7
crwxr-xr-x 1 oracle oinstall 162, 20 Nov 17 14:27 raw20
crw-r--r-- 1 oracle oinstall 162,  3 Nov 17 14:27 raw3
crwxr-xr-x 1 oracle oinstall 162, 22 Nov 17 14:27 raw22
crwxr-xr-x 1 oracle oinstall 162, 10 Nov 17 14:27 raw10
[root@erp01 raw]# raw -qa
/dev/raw/raw2:  bound to major 253, minor 25
/dev/raw/raw3:  bound to major 253, minor 27
/dev/raw/raw7:  bound to major 253, minor 29
/dev/raw/raw8:  bound to major 253, minor 30
/dev/raw/raw9:  bound to major 253, minor 31
/dev/raw/raw10: bound to major 253, minor 32
/dev/raw/raw11: bound to major 253, minor 33
/dev/raw/raw12: bound to major 253, minor 34
/dev/raw/raw13: bound to major 253, minor 35
/dev/raw/raw14: bound to major 253, minor 36
/dev/raw/raw15: bound to major 253, minor 37
/dev/raw/raw16: bound to major 253, minor 8
/dev/raw/raw17: bound to major 253, minor 9
/dev/raw/raw18: bound to major 253, minor 10
/dev/raw/raw19: bound to major 253, minor 11
/dev/raw/raw20: bound to major 253, minor 12
/dev/raw/raw21: bound to major 253, minor 13
/dev/raw/raw22: bound to major 253, minor 7
/dev/raw/raw23: bound to major 253, minor 14

root@erp01 dev]# ls -rtl |grep 253
brw-------  1 root root 253,     0 Sep 13  2009 root
brw-rw----  1 root root 253,     8 Sep 13  2009 dm-8
brw-rw----  1 root root 253,     9 Sep 13  2009 dm-9
brw-rw----  1 root root 253,    10 Sep 13  2009 dm-10
brw-rw----  1 root root 253,    11 Sep 13  2009 dm-11
brw-rw----  1 root root 253,    12 Sep 13  2009 dm-12
brw-rw----  1 root root 253,    13 Sep 13  2009 dm-13
brw-rw----  1 root root 253,    14 Sep 13  2009 dm-14
brw-rw----  1 root root 253,    15 Sep 13  2009 dm-15
brw-rw----  1 root root 253,    16 Sep 13  2009 dm-16
brw-rw----  1 root root 253,    18 Sep 13  2009 dm-18
brw-rw----  1 root root 253,    17 Sep 13  2009 dm-17
brw-rw----  1 root root 253,    19 Sep 13  2009 dm-19
brw-rw----  1 root root 253,    20 Sep 13  2009 dm-20
brw-rw----  1 root root 253,    22 Sep 13  2009 dm-22
brw-rw----  1 root root 253,    21 Sep 13  2009 dm-21
brw-rw----  1 root root 253,    24 Sep 13  2009 dm-24
brw-rw----  1 root root 253,    23 Sep 13  2009 dm-23
brw-rw----  1 root root 253,    25 Sep 13  2009 dm-25
brw-rw----  1 root root 253,    28 Sep 13  2009 dm-28
brw-rw----  1 root root 253,    27 Sep 13  2009 dm-27
brw-rw----  1 root root 253,    26 Sep 13  2009 dm-26
brw-rw----  1 root root 253,    29 Sep 13  2009 dm-29
brw-rw----  1 root root 253,    30 Sep 13  2009 dm-30
brw-rw----  1 root root 253,    32 Sep 13  2009 dm-32
brw-rw----  1 root root 253,    33 Sep 13  2009 dm-33
brw-rw----  1 root root 253,    34 Sep 13  2009 dm-34
brw-rw----  1 root root 253,    35 Sep 13  2009 dm-35
brw-rw----  1 root root 253,    36 Sep 13  2009 dm-36
brw-rw----  1 root root 253,    37 Sep 13  2009 dm-37
brw-rw----  1 root root 253,     7 Sep 13  2009 dm-7
brw-rw----  1 root root 253,    31 Sep 13  2009 dm-31



SQL> col name for a20
SQL> col path for a20
SQL> select name,path from v$asm_disk;

NAME                 PATH
-------------------- --------------------
                     /dev/raw/raw3
                     /dev/raw/raw2
LOGASM1_0001         /dev/raw/raw23
LOGASM1_0000         /dev/raw/raw22
DGASM1_0011          /dev/raw/raw21
DGASM1_0010          /dev/raw/raw20
DGASM1_0009          /dev/raw/raw19
DGASM1_0008          /dev/raw/raw18
DGASM1_0007          /dev/raw/raw17
DGASM1_0006          /dev/raw/raw16
DGASM1_0005          /dev/raw/raw15

NAME                 PATH
-------------------- --------------------
DGASM1_0004          /dev/raw/raw14
DGASM1_0003          /dev/raw/raw13
DGASM1_0002          /dev/raw/raw12
DGASM1_0001          /dev/raw/raw11
DGASM1_0000          /dev/raw/raw10
DGASM1_0014          /dev/raw/raw9
DGASM1_0013          /dev/raw/raw8
DGASM1_0012          /dev/raw/raw7

19 rows selected.


[oracle@erp01 dbs]$ more init+ASM1.ora
##############################################################################
# Copyright (c) 1991, 2001, 2002 by Oracle Corporation
##############################################################################

###########################################
# Cluster Database
###########################################
cluster_database=true

###########################################
# Diagnostics and Statistics
###########################################
background_dump_dest=/oracle/admin/+ASM/bdump
core_dump_dest=/oracle/admin/+ASM/cdump
user_dump_dest=/oracle/admin/+ASM/udump

###########################################
# Miscellaneous
###########################################
instance_type=asm

###########################################
# Pools
###########################################
large_pool_size=12M

###########################################
# Security and Auditing
###########################################
remote_login_passwordfile=exclusive
asm_power_limit=5
asm_diskgroups='DGASM1','LOGASM1'
asm_diskstring='/dev/raw/raw*'
+ASM2.instance_number=2
+ASM1.instance_number=1

[oracle@erp01 dbs]$ crsctl query css votedisk
0.     0    /dev/raw/raw3

located 1 votedisk(s).


[oracle@erp01 dbs]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :    1027888
         Used space (kbytes)      :       4588
         Available space (kbytes) :    1023300
         ID                       :  499063683
         Device/File Name         : /dev/raw/raw2
                                    Device/File integrity check succeeded

                                    Device/File not configured

         Cluster registry integrity check succeeded
        
最终配置
/home/oracle/dbcheck/60-raw.rules      
ACTION=="add",KERNEL=="dm-25",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add",KERNEL=="dm-27",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add",KERNEL=="dm-29",RUN+="/bin/raw /dev/raw/raw7 %N"
ACTION=="add",KERNEL=="dm-30",RUN+="/bin/raw /dev/raw/raw8 %N"
ACTION=="add",KERNEL=="dm-31",RUN+="/bin/raw /dev/raw/raw9 %N"
ACTION=="add",KERNEL=="dm-32",RUN+="/bin/raw /dev/raw/raw10 %N"
ACTION=="add",KERNEL=="dm-33",RUN+="/bin/raw /dev/raw/raw11 %N"
ACTION=="add",KERNEL=="dm-34",RUN+="/bin/raw /dev/raw/raw12 %N"
ACTION=="add",KERNEL=="dm-35",RUN+="/bin/raw /dev/raw/raw13 %N"
ACTION=="add",KERNEL=="dm-36",RUN+="/bin/raw /dev/raw/raw14 %N"
ACTION=="add",KERNEL=="dm-37",RUN+="/bin/raw /dev/raw/raw15 %N"
ACTION=="add",KERNEL=="dm-8",RUN+="/bin/raw /dev/raw/raw16 %N"
ACTION=="add",KERNEL=="dm-9",RUN+="/bin/raw /dev/raw/raw17 %N"
ACTION=="add",KERNEL=="dm-10",RUN+="/bin/raw /dev/raw/raw18 %N"
ACTION=="add",KERNEL=="dm-11",RUN+="/bin/raw /dev/raw/raw19 %N"
ACTION=="add",KERNEL=="dm-12",RUN+="/bin/raw /dev/raw/raw20 %N"
ACTION=="add",KERNEL=="dm-13",RUN+="/bin/raw /dev/raw/raw21 %N"
ACTION=="add",KERNEL=="dm-7",RUN+="/bin/raw /dev/raw/raw22 %N"
ACTION=="add",KERNEL=="dm-14",RUN+="/bin/raw /dev/raw/raw23 %N"
KERNEL=="raw[7-23]",OWNER="oracle", GROUP="oinstall", MODE="755"
KERNEL=="raw[2]", OWNER="root", GROUP="oinstall", MODE="660"
KERNEL=="raw[3]", OWNER="oracle", GROUP="oinstall", MODE="644"
论坛首页 综合技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics