• Linux平台下裸设备的绑定:


    Linux平台下裸设备的绑定:

    运用RAW绑定


    方法一 raw的配置(1)

    [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

    方法一(2)

    [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*

    ~

    (1)编辑rawdevices的配置文件:

    [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

    (2)启动rawdevices服务:

    service rawdevices start

    (3)配置系统启动时,自己主动启动rawdevices服务:

    chkconfig rawdevices on

    (4)确认rawdevices服务成功启动,而且裸设备正确创建。先查看rawdevices服务状态:

    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]#

    (5)ASM是以Oracle用户身份执行的,要让ASM可以发现这些设备,必须更改这些设备的属主(owner):

    [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

    方法二 运用UDEV设备绑定:

    改动/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

  • 相关阅读:
    [第二届构建之法论坛] 预培训文档(Java版)
    避免走进熟人社交的误区——给新手助教的几个建议
    BugPhobia发布篇章:Beta版本学霸在线系统正式发布
    BugPhobia回顾篇章:团队Beta 阶段工作分析
    BugPhobia终章篇章:学霸在线系统Beta阶段展示
    BugPhobia发布篇章:学霸在线系统测试报告
    BugPhobia开发终结篇章:Beta阶段第XI次Scrum Meeting
    BugPhobia开发篇章:Beta阶段第X次Scrum Meeting
    BugPhobia开发篇章:Beta阶段第IX次Scrum Meeting
    BugPhobia休息篇章:Beta阶段第IX次Scrum Meeting前奏
  • 原文地址:https://www.cnblogs.com/hrhguanli/p/4073171.html
Copyright © 2020-2023  润新知