Binding bare devices on Linux:

Source: Internet
Author: User

Binding bare devices on Linux:

Bind with RAWMethod 1 raw configuration (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

Method 1 (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 *

Chmod-R 660/dev/raw *

~

(1) edit the configuration file of 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

# -- Add binding entries for bare devices and Block devices:

/Dev/raw/raw1/dev/sdb1

/Dev/raw/raw2/dev/sdc1

/Dev/raw/raw3/dev/sdd1

/Dev/raw/raw4/dev/sde1

(2) Start the rawdevices service:

Service rawdevices start

(3) automatically start rawdevices when the system is started:

Chkconfig rawdevices on

(4) Confirm that the rawdevices service is successfully started and the bare device is created correctly. First, check the rawdevices service status:

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

Check the bare device again:

[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 runs as an Oracle user. To enable ASM to discover these devices, you must change the owner of these devices ):

[Root @ felix2 raw] # chown oracle: oinstall/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: 37raw2

Crw-rw ---- 1 oracle oinstall 162, 3 May 21 15: 37raw3

Crw-rw ---- 1 oracle oinstall 162, 4 May 21 15: 37raw4

Method 2 Bind a device with UDEV:

Modify the/etc/udev/rules. d/60-raw.rules File

# Now we know/dev/sdb1 to raw1, And we can add the following content to the/etc/udev/rules. d/60-raw.rules file:

[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

Restart UDEV:

[Root @ rac1 ~] # Start_udev

[Root @ zrac1 asmfileapp-linux5.4] # ls-lat/dev/raw *

Crw-rw ---- 1 oracle oinstall 162, 4 Apr 10/dev/raw/raw4

Crw-rw ---- 1 oracle oinstall 162, 3 Apr 10/dev/raw/raw3

Crw-rw ---- 1 oracle oinstall 162, 2 Apr 10/dev/raw/raw2

Crw-rw ---- 1 oracle oinstall 162, 1 Apr 10/dev/raw/raw1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.