How to Use udev for Oracle ASM in Oracle Linux 6
Original article: http://www.dbform.com/html/2011/1708.html
Most of the documents available on the Internet are set up with udev in rhel5 or oel5. udev is most useful for Linux to prevent the disk used as an ASM disk from changing after the operating system is restarted.
For example, Tim Hall's article: udev SCSI rules configuration for ASM in Oracle Linux 5.
For example, Maclean's article: uses the udev service to solve the rac asm storage device name.
But in oel6 or rhel6, all of this has changed.
The main changes are:
1. The command syntax of scsi_id has changed. commands such as scsi_id-g-u-s are no longer valid.
2. The udevtest command is no longer available and integrated into udevadm.
Refer to Redhat's official document (this document contains some errors and-device = is missing in udev rules. For the correct method, refer to Step 1 below ):
Using ing persistent storage in Red Hat Enterprise Linux 6.
The procedure is as follows:
1. Edit the/etc/scsi_id.config file. If the file does not exist, create the file and add the following lines:
Options = -- whitelisted -- replace-whitespace
Note: In my tests, this step can be omitted.
2. Obtain the uuid of the disk to be bound to the ASM disk. For example, if we want to use/dev/SDC and/dev/SDD as the ASM disk, then:
# Scsi_id -- whitelisted -- replace-whitespace -- device =/dev/SDC
1ata_vbox_harddisk_vb36a9e548-1838194a
# Scsi_id -- whitelisted -- replace-whitespace -- device =/dev/SDD
1ata_vbox_harddisk_vb9808fc7f-cdf35030
3. Write the udev rules file, write the scsi_id command in program, and write the uuid returned in the above command in result. This is no different from oel5, but the syntax of the scsi_id command has changed.
VI/etc/udev/rules. d/99-oracle-asmdevices.rules
Kernel = "SD *", subsystem = "Block", program = "/sbin/scsi_id -- whitelisted -- replace-whitespace -- device =/dev/$ name ", result = "1ata_vbox_harddisk_vb36a9e548-1838194a", name = "asm-disk1", owner = "Grid", group = "dba", mode = "0660"
Kernel = "SD *", subsystem = "Block", program = "/sbin/scsi_id -- whitelisted -- replace-whitespace -- device =/dev/$ name ", result = "1ata_vbox_harddisk_vb9808fc7f-cdf35030", name = "asm-disk2", owner = "Grid", group = "dba", mode = "0660"
4. Use udevadm for testing. Note that the udevadm command does not accept mount device names such as/dev/SDC. The original device names such as/sys/block/SDC must be used.
Udevadm test/sys/block/SDC
Udevadm info -- query = all -- Path =/sys/block/SDC
Udevadm info -- query = all -- name = asm-disk1
In the display, there is an output similar to the following, indicating that the test is correct, the/dev/SDC device will be bound to/dev/asm-disk1 after udev is started:
Udevadm_test: udev_log = 6
Udevadm_test: devpath =/devices/pci0000: 00/0000: 00: 0d. 0/host4/target4: 0: 0/4: 0: 0: 0/block/SDC
Udevadm_test: Major = 8
Udevadm_test: minor = 32
Udevadm_test: devname =/dev/asm-disk1
Udevadm_test: devtype = Disk
Udevadm_test: Action = add
Udevadm_test: subsystem = block
5. Start udev
#/Sbin/start_udev
6. Check whether the device is correctly bound.
# Ls-L/dev/ASM *
BRW-RW ---- 1 grid DBA 8, 32 Oct 26 21:24/dev/asm-disk1
BRW-RW ---- 1 grid DBA 8, 48 Oct 26 21:17/dev/asm-disk2