UDEV SCSI Rules Configuration for ASM in Oracle Linux 5 and 6

Source: Internet
Author: User
Tags symlink

UDEV SCSI Rules Configuration for ASM in Oracle Linux 5 and 6

For Oracle Automatic Storage Manager (ASM) to use disks, it needs to is able to identify the devices consistently and for them to the correct ownership and permissions. In Linux you can use Asmlib to manage these tasks, but it's seen as an additional layer of complexity and have never reall Y gained any popularity. Instead, many people use the Linux Device Manager "Udev" to perform these tasks. This article presents a brief overview of the setting up Udev rules with respect to disks for use with ASM in Oracle 11g. The examples is all-done using Oracle Linux 5 and 6, so they'll be consistent with RHEL and CentOS 5 and 6.

    • Background
    • Identify the Disks (/sbin/scsi_id)
    • Make SCSI Devices Trusted
    • Create UDEV Rules File
    • Load Updated Block Device partitions (/sbin/partprobe)
    • Test Rules (udevtest)
    • Restart UDEV Service
    • Check Ownership and Permissions
Background

Essentially, what Udev does are apply rules defined in files in the "/ETC/UDEV/RULES.D" directory to the device nodes Liste D in the "/dev" directory. The rules can be defined in a variety of ways, if we need to do are identify the device and say what we want Udev to Do with it.

Know all my disk devices is named "/dev/sd?1", where the "?" represents a letter from a-d, so I can Identi FY the devices of interest using the following rule parameters.

kernel== "Sd?1", bus== "SCSI"

I want to tie each specific device to a alias, so it's always identified the same, regardless of the device name Lin UX assigns it. So I need to being able to test each device this matches the previous pattern to see if it's the disk I am interested in. Each disk have a unique SCSI ID, so I can place a test into the rule, telling it what to perform the test, and the result it Should return for a positive match. The following rule parameters explain how to test the device and the "result constitutes a match in Oracle Linux 5.

program== "/sbin/scsi_id-g-u-s/block/$parent", result== "sata_vbox_harddisk_vbd306dbe0-df3367e3_"

scsi_idThe command works a little differently in Oracle Linux 6, so for, the following test works better.

program== "/sbin/scsi_id-g-u-d/dev/$parent", result== "sata_vbox_harddisk_vbd306dbe0-df3367e3_"

Once we have identified the specific device of interest, we need to indicate what actions should is performed on it. The following parameters specify an alias, the ownership and the permissions for the device.

Name= "Asm-disk1", owner= "Oracle", group= "DBA", mode= "0660"

So, the whole rule for each disk would look at something like this in Oracle Linux 5.

kernel== "Sd?1", bus== "scsi", program== "/sbin/scsi_id-g-u-s/block/$parent", result== "sata_vbox_harddisk_ Vbd306dbe0-df3367e3_ ", name=" Asm-disk1 ", owner=" Oracle ", group=" DBA ", mode=" 0660 "

Or this in Oracle Linux 6.

kernel== "Sd?1", bus== "scsi", program== "/sbin/scsi_id-g-u-d/dev/$parent", result== "sata_vbox_harddisk_ Vbd306dbe0-df3367e3_ ", name=" Asm-disk1 ", owner=" Oracle ", group=" DBA ", mode=" 0660 "

This means, the device pointing to the partition "Sd*1" on the disk with the SCSI ID of "SATA_VBOX_HARDDISK_VBD306DBE0 -df3367e3_ "would always be called"/dev/asm-disk1 ", regardless of the"? " Linux assigns when the device is discovered. In addition, the device would has the correct ownership and permissions for ASM.

There is a number of wildcards and matching patterns that can is used if you don ' t want to write device-specific rules.

Now we know roughly what we is trying to achieve, we'll look at each step necessary for setting up the disks for ASM to Use.

Identify the Disks (/sbin/scsi_id)

We is going to write device-specific rules, so we need to is able to identify each device consistently, irrespective of t He order in which Linux discovers it. To does this we is going to use the SCSI ID for each disk (not the partition), which we get using the scsi_id command. The "-S" option makes the paths relative to the "/sys" directory. For Oracle Linux 5, use the following command.

 
 
The "-S" is not a available in Oracle Linux 6, so you must use the following syntax.
 
 
Make SCSI Devices Trusted

Add the following to the '/etc/scsi_id.config ' file to configure SCSI devices as trusted. Create the file if it doesn ' t already exist.

Options=-g
Create UDEV Rules File

Create the "/etc/udev/rules.d/99-oracle-asmdevices.rules" file.

# Vi/etc/udev/rules.d/99-oracle-asmdevices.rules

The file should contain the following lines for Oracle Linux 5. The program parameter must match the command you used to retrieve the SCSI ID, and the RESULT par Ameter must match the value returned from your disks.

kernel== "Sd?1", bus== "scsi", program== "/sbin/scsi_id-g-u-s/block/$parent", result== "sata_vbox_harddisk_ Vbd306dbe0-df3367e3_ ", name=" Asm-disk1 ", owner=" Oracle ", group=" DBA ", mode=" 0660 "kernel==" sd?1 ", bus==" SCSI ", program== "/sbin/scsi_id-g-u-s/block/$parent", result== "sata_vbox_harddisk_vb46dec7e0-192e8000_", NAME= "Asm-disk2 ", owner=" Oracle ", group=" DBA ", mode=" 0660 "kernel==" sd?1 ", bus==" scsi ", program=="/sbin/scsi_id-g-u-s/block/$parent ", result==" sata_vbox_harddisk_vbce8c63bb-ac67a172_ ", name=" Asm-disk3 ", owner=" Oracle ", group=" DBA ", mode=" 0660 " kernel== "Sd?1", bus== "scsi", program== "/sbin/scsi_id-g-u-s/block/$parent", result== "sata_vbox_harddisk_ Vb7437a3b7-95b199cd_ ", name=" Asm-disk4 ", owner=" Oracle ", group=" DBA ", mode=" 0660 "

The equivalent for Oracle Linux 6 is shown below.

kernel== "Sd?1", bus== "scsi", program== "/sbin/scsi_id-g-u-d/dev/$parent", result== "sata_vbox_harddisk_ Vbd306dbe0-df3367e3_ ", name=" Asm-disk1 ", owner=" Oracle ", group=" DBA ", mode=" 0660 "kernel==" sd?1 ", bus==" SCSI ", program== "/sbin/scsi_id-g-u-d/dev/$parent", result== "sata_vbox_harddisk_vb46dec7e0-192e8000_", NAME= "Asm-disk2", Owner= "Oracle", group= "DBA", mode= "0660" kernel== "sd?1", bus== "scsi", program== "/sbin/scsi_id-g-u-d/dev/$parent", result== "Sata_vbox_harddisk_vbce8c63bb-ac67a172_", name= "Asm-disk3", owner= "Oracle", group= "DBA", mode= "0660" kernel== "Sd?1", bus== "scsi", program== "/sbin/scsi_id-g-u-d/dev/$parent", result== "sata_vbox_harddisk_ Vb7437a3b7-95b199cd_ ", name=" Asm-disk4 ", owner=" Oracle ", group=" DBA ", mode=" 0660 "
Load Updated Block Device partitions (/sbin/partprobe)

Load updated block device partition tables.

#/sbin/partprobe/dev/sdb1#/sbin/partprobe/dev/sdc1#/sbin/partprobe/dev/sdd1#/sbin/partprobe/dev/sde1
Test Rules (udevtest)

Test the rules are working as expected.

# #OL5 # udevtest/block/sdb/sdb1# udevtest/block/sdc/sdc1# udevtest/block/sdd/sdd1# udevtest/block/sde/sde1# #OL6 # Ude VAdm test/block/sdb/sdb1# udevadm test/block/sdc/sdc1# udevadm test/block/sdd/sdd1# udevadm test/block/sde/sde1

The output from the first disk should look something like this.

# udevtest/block/sdb/sdb1main:looking at device '/BLOCK/SDB/SDB1 ' from subsystem ' block ' Udev_rules_get_name:add Symlin K ' Disk/by-id/scsi-sata_vbox_harddisk_vbd306dbe0-df3367e3-part1 ' Udev_rules_get_name:add symlink ' disk/by-path/ Pci-0000:00:0d.0-scsi-1:0:0:0-part1 ' Run_program: '/lib/udev/vol_id--export/dev/.tmp-8-17 ' run_program: '/lib/udev  /VOL_ID ' returned with status 4run_program: '/sbin/scsi_id-g-u-s/block/sdb/sdb1 ' run_program: '/sbin/scsi_id ' (stdout) ' Sata_vbox_harddisk_vbd306dbe0-df3367e3_ ' run_program: '/sbin/scsi_id ' returned with status 0udev_rules_get_name: Rule applied, ' sdb1 ' becomes ' asm-disk1 ' Udev_device_event:device '/block/sdb/sdb1 ' already in database, validate current Ly present symlinksudev_node_add:creating Device node '/dev/asm-disk1 ', major = ' 8 ', minor = ' + ', mode = ' 0660 ', uid = ' 1100 ', gid = ' udev_node_add:creating symlink '/dev/disk/by-id/scsi-sata_vbox_harddisk_ Vbd306dbe0-df3367e3-part1 ' to '. /.. /asm-disk1 ' udev_node_add:creating symlink '/dev/disk/by-path/pci-0000:00:0d.0-scsi-1:0:0:0-part1 ' to '. /.. /asm-disk1 ' main:run: ' socket:/org/kernel/dm/multipath_event ' main:run: ' Socket:/org/kernel/udev/monitor ' Main:run: '/lib/udev/udev_run_devd ' main:run: ' socket:/org/freedesktop/hal/udev_event ' main:run: '/sbin/pam_console_apply/ dev/asm-disk1/dev/disk/by-id/scsi-sata_vbox_harddisk_vbd306dbe0-df3367e3-part1/dev/disk/by-path/pci-0000:0 0:0d.0-scsi-1:0:0:0-part1 ' #
Restart UDEV Service

Restart the UDEV service.

# #OL5 #/sbin/udevcontrol reload_rules# #OL6 # Udevadm control--reload-rules# #OL5 and ol6#/sbin/start_udev
Check Ownership and Permissions

Check the disks is now available with the "asm-disk*" Alias and the correct ownership and permissions.

# cd/dev# Ls-al ASM-DISK*BRW-RW----1 Oracle DBA 8, Apr  8 22:47 ASM-DISK1BRW-RW----1 Oracle DBA 8, Apr  8 22:47 ASM-DISK2BRW-RW----1 Oracle DBA 8, Apr  8 22:47 ASM-DISK3BRW-RW----1 Oracle DBA 8, Apr  8 22:47 Asm-di sk4#

The ASM_DISKSTRING initialization parameter in the ASM instance can is set to '/dev/asm-disk* ' to identify the ASM disks.

UDEV SCSI Rules Configuration for ASM in Oracle Linux 5 and 6

Related Article

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.