Oracle_ using Udev to bind disk methods

Source: Internet
Author: User
Tags symlink

The SCSI_ID command emits a SCSI inquiry instruction to the device, accessing the data 0x83 the vital product data (VPD) page, which contains the Wwid and other information of the device, or the data of the page 0x80, which contains the unit serial number Serial number). The execution result of the scsi_id command (a long string of characters) is the wwid of the device and is currently mapped to/DEV/SDC (/SYS/BLOCK/SDC). Each path to the device and the wwid of each partition on the device are the same. The wwid of the device does not change, even if additional devices are added to the system or removed from the system. However, devices that are mapped to/DEV/SDC may change. This is why you need to create a static device name. You can create a device name based on Wwid.


First, how to obtain equipment wwid
(1) Redhat 5 Enterprise Linux is as follows:
#/sbin/scsi_id-g-u-s/dev/sdb
Or
#/sbin/scsi_id-g-u-s/block/sdb
Shell Script
# for I in ' cat/proc/partitions | awk {' Print $4 '} |grep SD '; Do echo "# # $i: ' scsi_id-g-u-s/block/$i '"; Done

(2) Redhat 6 Enterprise Linux is as follows:
#/sbin/scsi_id-g-u/dev/sdb
Or
#/sbin/scsi_id-g-u/block/sdb
Or
#/sbin/scsi_id--whitelist [--replace-whitespace] [--device=]/dev/sdb
Shell Script
# for I in ' cat/proc/partitions | awk {' Print $4 '} |grep SD '; Do echo "# # $i: ' scsi_id--whitelist--replace-whitespace/dev/$i '"; Done

Second, write to Udev. Rules

(1) for the entire disk binding write 99-oracle-asmdevices.rules (file name, test can be arbitrarily ordered)

RHEL5
For i in B c D E F;
Do
echo "kernel==\" sd*\ ", bus==\" scsi\ ", program==\"/sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/\$ Name\ ", result==\" '/sbin/scsi_id-g-u-s/dev/sd$i ' \ ", name=\" asm-disk$i\ ", owner=\" grid\ ", group=\" asmadmin\ ", MODE=\ "0660\" ">>/etc/udev/rules.d/99-oracle-asmdevices.rules
Done

RHEL6
For i in B c D E F;
Do
echo "kernel==\" sd*\ ", bus==\" scsi\ ", program==\"/sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/\$ Name\ ", result==\" '/sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/sd$i ' \ ", NAME=\" asm-disk$i\ ", Owner=\ "grid\", group=\ "asmadmin\", mode=\ "0660\" ">>/etc/udev/rules.d/99-oracle-asmdevices.rules
Done

Kernel [2.6.32] and later
kernel== "SDC", bus== "scsi", program== "/sbin/scsi_id-gud/dev/$name" result== "1ata_vbox_harddisk_ Vb93327385-145dda10 ", symlink+=" asmdisk/asm-crs1 ", owner=" grid ", group=" Asmadmin ", mode=" 0660 "
OR
kernel== "SDC", bus== "scsi", program== "/sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/$name" RESULT== "1ata_vbox_harddisk_vb93327385-145dda10", symlink+= "asmdisk/asm-crs1", owner= "grid", group= "Asmadmin", MODE= "0660"

(2) Bindings for disk sub-partitions
Redhat Enterprise Linux 5 with the following parameters
kernel== "SD? [1-2] ", bus==" scsi ", program=="/sbin/scsi_id-g-u-s%p ", result==" 1ata_vbox_harddisk_vbaef9fa71-c32978c8 ", NAME=" Asm-ocr%n ", owner=" grid ", group=" Asmdba ", mode=" 0660 "

Redhat Enterprise Linux 6 with the following parameters
kernel== "SD? [1-2] ", bus==" scsi ", program=="/sbin/scsi_id-g-u/dev/$name ", result==" 1ata_vbox_harddisk_vbaef9fa71-c32978c8 ", Name= "asm-ocr%n", owner= "grid", group= "Asmdba", mode= "0660"
Or
kernel== "SDB1", bus== "scsi", program== "/sbin/scsi_id-g-u-d/dev/$parent" result== "1ata_vbox_harddisk_ vb8383313d-441fd502 ", name=" asm-crs1 ", owner=" grid ", group=" Asmadmin ", mode=" 0660 "

(3) Change permissions only
[[[email protected] oracle]# cat/etc/udev/rules.d/99-asm-multipath.rules
program= "/bin/ Chown oracle:oinstall/dev/mapper/back_mpath1p1 "
program="/bin/chown oracle:oinstall/dev/mapper/back_mpath2p1 "
program= "/bin/chown oracle:oinstall/dev/mapper/data_mpath1p1"
program= "/bin/chown oracle:oinstall/dev/ Mapper/data_mpath2p1 "

Three, Udev management
# udevadm-h
# udevadm control-h
# udevadm control--reload-rules
########################### ##################
Case: IBM multipath Multi-path +vcs dual-machine +udev mode +LVM
#############################################
AEP host IBM multipath multipath device through Udev binding operations documentation (private tinkering, no availability guarantee)
1, view multipath
Aep11:/etc/multipath # Multipath-ll | grep IBM
3600507680c800091180000000000022e dm-2 IBM, 2145
3600507680c800091180000000000022d dm-1 IBM, 2145
3600507680c800091180000000000022c dm-0 IBM, 2145
2, configuring multipath aliases
Note: Because there is no/etc/multipath.conf on the machine (unknown reason), from other hosts (OS version different) Copy the/etc/multipath.conf, using only the alias portion of the multipath.conf configuration file, as follows:
Aep11:/etc/multipath # cat/etc/multipath.conf
multipaths {
Multipath {
Wwid 3600507680c800091180000000000022c
alias Aep_diska
}
Multipath {
Wwid 3600507680c800091180000000000022d
alias Aep_diskb
}
multipath {
Wwid 3600507680c800091180000000000022e
alias AEP_DISKC
}
}

To regenerate a multipath device:
Multipath-f
Multipath-v2

3. View the regenerated multipath device
aep11:~ # Multipath-ll | grep AEP
AEP_DISKC (3600507680c800091180000000000022e) dm-2 IBM, 2145
AEP_DISKB (3600507680c800091180000000000022d) dm-1 IBM, 2145
Aep_diska (3600507680c800091180000000000022c) dm-0 IBM, 2145

4. Udev Way to bind Multipath
aep11:~ # Cat/etc/udev/rules.d/99-aep-devices.rules
kernel== "dm*", subsystem== "block", program== "/lib/udev/scsi_id--whitelisted--replace-whitespace--device=/dev/$ Name ", result==" 3600507680c800091180000000000022c ", name=" Aep_diska "
kernel== "dm*", subsystem== "block", program== "/lib/udev/scsi_id--whitelisted--replace-whitespace--device=/dev/$ Name ", result==" 3600507680c800091180000000000022d ", name=" AEP_DISKB "
kernel== "dm*", subsystem== "block", program== "/lib/udev/scsi_id--whitelisted--replace-whitespace--device=/dev/$ Name ", result==" 3600507680c800091180000000000022e ", name=" AEP_DISKC "

Note: If you add permissions, you can look like this:
kernel== "dm*", subsystem== "block", program== "/lib/udev/scsi_id--whitelisted--replace-whitespace--device=/dev/$ Name ", result==" 3600507680c800091180000000000022c ", name=" Aep_diska ", owner=" grid ", group=" Asmadmin ", MODE=" 0660 "

--Reload the configuration file
aep11:~ # Udevadm Control--reload-rules
--Make the rules effective and generate Udev device files
aep11:~ # Udevadm Trigger

5. View the bundled devices:
# ls-lrt/dev/aep_disk*

6. Create PV
aep11:~ # Pvcreate/dev/aep_disk{a,b,c}
aep11:~ # PVs

Note: Due to the operation of the host AEP11 is a dual machine, so remove Step 6 to create PV, the other steps need to operate on the main standby machine.

Oracle_ using Udev to bind disk methods

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.