In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how to solve the problem of using udev to manage asmdisk execution / sbin/scsi_id does not display UUID. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
When building a RAC, use udev to create an ASM disk, execute the / sbin/scsi_id command for no known reason, get no UUID alive or dead, and the execution result shows nothing.
[root@seiang2] # scsi_id-u-g / dev/sdb
It seems impossible to configure the udev rules file without uuid. By consulting relevant materials, the partition information is obtained through the following two ways: udevinfo (version 6 operating system udevadm replaces udevinfo) command. You can use these two pieces of information in the partition SYSFS {start} = = "63" and SYSFS {size} = = "16771797" (version 6 becomes ATTR {start} = "4241160" and ATTR {size} = "2120580") to uniquely identify this device.
Experimental environment:
Operating system: Redhat5.5 Hostname:seiang2.comsys.com
Operating system: Redhat6.4 Hostname:test.comsys.com
Catalogue
First, use udevinfo/udevadm to obtain the unique identity of the partition
Use bare devices to create asm disks
Detailed introduction to udev under Linux: http://blog.itpub.net/31015730/viewspace-2142429/
First, use udevinfo/udevadm to obtain the unique identity of the partition
Add a new disk and partition it, and then use the udevinfo/udevadm command to obtain the unique identity of the partition
Redhat5 version
[root@seiang2 ~] # ll / sbin/udev*
-rwxr-xr-x 1 root root 15176 May 5 2009 / sbin/udevcontrol
-rwxr-xr-x 1 root root 61864 May 5 2009 / sbin/udevd
-rwxr-xr-x 1 root root 899928 May 5 2009 / sbin/udevd.static
-rwxr-xr-x 1 root root 23680 May 5 2009 / sbin/udevsettle
-rwxr-xr-x 1 root root 24144 May 5 2009 / sbin/udevtrigger
[root@seiang2 ~] # cd / sys/block/sdb
[root@seiang2] # udevinfo-a-p / sys/block/sdb
Udevinfo starts with the device specified by the devpath and then
Walks up the chain of parent devices. It prints for every device
Found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
And the attributes from one single parent device.
Looking at device'/ block/sdb':
KERNEL== "sdb"
SUBSYSTEM== "block"
SYSFS {stat} = "63 93 1248 19 000 0 19"
SYSFS {size} = "10485760"
SYSFS {removable} = = "0"
SYSFS {range} = = "16"
SYSFS {dev} = = "8:16"
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host1/target1:0:0/1:0:0:0':
ID== "1VOV 0VOUR 0UR 0"
BUS== "scsi"
DRIVER== "sd"
SYSFS {dh_state} = = "detached"
SYSFS {ioerr_cnt} = = "0x0"
SYSFS {iodone_cnt} = = "0x51"
SYSFS {iorequest_cnt} = = "0x51"
SYSFS {iocounterbits} = "32"
SYSFS {timeout} = = "60"
SYSFS {state} = = "running"
SYSFS {rev} = = "1.0"
SYSFS {model} = = "VBOX HARDDISK"
SYSFS {vendor} = = "ATA"
SYSFS {scsi_level} = = "6"
SYSFS {type} = = "0"
SYSFS {queue_type} = = "simple"
SYSFS {queue_depth} = "31"
SYSFS {device_blocked} = = "0"
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host1/target1:0:0':
ID== "target1:0:0"
BUS== ""
DRIVER== ""
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host1':
ID== "host1"
BUS== ""
DRIVER== ""
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0':
ID== "0000:00:0d.0"
BUS== "pci"
DRIVER== "ahci"
SYSFS {broken_parity_status} = = "0"
SYSFS {enable} = = "1"
SYSFS {modalias} = = "pci:v00008086d00002829sv00000000sd00000000bc01sc06i01"
SYSFS {local_cpus} = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
SYSFS {irq} = "177"
SYSFS {class} = = "0x010601"
SYSFS {subsystem_device} = = "0x0000"
SYSFS {subsystem_vendor} = = "0x0000"
SYSFS {device} = = "0x2829"
SYSFS {vendor} = = "0x8086"
Looking at parent device'/ devices/pci0000:00':
ID== "pci0000:00"
BUS== ""
DRIVER== ""
[root@seiang2 ~] # fdisk / dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only
Until you decide to write them. After that, of course, the previous
Content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w (rite)
Command (m for help): n
Command action
E extended
P primary partition (1-4)
P
Partition number (1-4): 1
First cylinder (1,652, default 1):
Using default value 1
Last cylinder or + size or + sizeM or + sizeK (1,652, default 652): + 1G
Command (m for help): n
Command action
E extended
P primary partition (1-4)
P
Partition number (1-4): 2
First cylinder (124,652, default):
Using default value 124
Last cylinder or + size or + sizeM or + sizeK: + 1G
Command (m for help): n
Command action
E extended
P primary partition (1-4)
P
Partition number (1-4): 3
First cylinder (12652, default 126):
Using default value 126
Last cylinder or + size or + sizeM or + sizeK: + 1G
Command (m for help): P
Disk / dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/ dev/sdb1 1 123 987966 83 Linux
/ dev/sdb2 124 125 16065 83 Linux
/ dev/sdb3 126248987997 + 83 Linux
Command (m for help): W
The partition table has been altered!
Calling ioctl () to re-read partition table.
Syncing disks.
[root@seiang2 ~] # ll / dev/sdb*
Brw-r- 1 root disk 8, 16 Jul 20 02:57 / dev/sdb
Brw-r- 1 root disk 8, 17 Jul 20 02:57 / dev/sdb1
Brw-r- 1 root disk 8, 18 Jul 20 02:57 / dev/sdb2
Brw-r- 1 root disk 8, 19 Jul 20 02:57 / dev/sdb3
Use the udevinfo command to view detailed partition information
[root@seiang2] # udevinfo-a-p / sys/block/sdb/sdb1
Udevinfo starts with the device specified by the devpath and then
Walks up the chain of parent devices. It prints for every device
Found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
And the attributes from one single parent device.
Looking at device'/ block/sdb/sdb1':
KERNEL== "sdb1"
SUBSYSTEM== "block"
SYSFS {stat} = "31 67 392 19 000 0 0 17 19"
SYSFS {size} = "1975932"
SYSFS {start} = "63"
SYSFS {dev} = = "8:17"
Looking at parent device'/ block/sdb':
ID== "sdb"
BUS== "block"
DRIVER== ""
SYSFS {stat} = "196575 3152 94 1 0 8 2 0 71 96"
SYSFS {size} = "10485760"
SYSFS {removable} = = "0"
SYSFS {range} = = "16"
SYSFS {dev} = = "8:16"
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host1/target1:0:0/1:0:0:0':
ID== "1VOV 0VOUR 0UR 0"
BUS== "scsi"
DRIVER== "sd"
SYSFS {dh_state} = = "detached"
SYSFS {ioerr_cnt} = = "0x0"
SYSFS {iodone_cnt} = = "0xe1"
SYSFS {iorequest_cnt} = = "0xe1"
SYSFS {iocounterbits} = "32"
SYSFS {timeout} = = "60"
SYSFS {state} = = "running"
SYSFS {rev} = = "1.0"
SYSFS {model} = = "VBOX HARDDISK"
SYSFS {vendor} = = "ATA"
SYSFS {scsi_level} = = "6"
SYSFS {type} = = "0"
SYSFS {queue_type} = = "simple"
SYSFS {queue_depth} = "31"
SYSFS {device_blocked} = = "0"
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host1/target1:0:0':
ID== "target1:0:0"
BUS== ""
DRIVER== ""
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host1':
ID== "host1"
BUS== ""
DRIVER== ""
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0':
ID== "0000:00:0d.0"
BUS== "pci"
DRIVER== "ahci"
SYSFS {broken_parity_status} = = "0"
SYSFS {enable} = = "1"
SYSFS {modalias} = = "pci:v00008086d00002829sv00000000sd00000000bc01sc06i01"
SYSFS {local_cpus} = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
SYSFS {irq} = "177"
SYSFS {class} = = "0x010601"
SYSFS {subsystem_device} = = "0x0000"
SYSFS {subsystem_vendor} = = "0x0000"
SYSFS {device} = = "0x2829"
SYSFS {vendor} = = "0x8086"
Looking at parent device'/ devices/pci0000:00':
ID== "pci0000:00"
BUS== ""
DRIVER== ""
[root@seiang2 rules.d] # udevinfo-a-p / sys/block/sdb/sdb3/
Udevinfo starts with the device specified by the devpath and then
Walks up the chain of parent devices. It prints for every device
Found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
And the attributes from one single parent device.
Looking at device'/ block/sdb/sdb3':
KERNEL== "sdb3"
SUBSYSTEM== "block"
SYSFS {stat} = "27 355 382 31 0 000 0 31"
SYSFS {size} = "1975995"
SYSFS {start} = "2008125"
SYSFS {dev} = = "8:19"
Looking at parent device'/ block/sdb':
ID== "sdb"
BUS== "block"
DRIVER== ""
SYSFS {stat} = "395 1754 5700 383 2 0 16 8 0 242 391"
SYSFS {size} = "10485760"
SYSFS {removable} = = "0"
SYSFS {range} = = "16"
SYSFS {dev} = = "8:16"
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host1/target1:0:0/1:0:0:0':
ID== "1VOV 0VOUR 0UR 0"
BUS== "scsi"
DRIVER== "sd"
SYSFS {dh_state} = = "detached"
SYSFS {ioerr_cnt} = = "0x0"
SYSFS {iodone_cnt} = = "0x1b3"
SYSFS {iorequest_cnt} = = "0x1b3"
SYSFS {iocounterbits} = "32"
SYSFS {timeout} = = "60"
SYSFS {state} = = "running"
SYSFS {rev} = = "1.0"
SYSFS {model} = = "VBOX HARDDISK"
SYSFS {vendor} = = "ATA"
SYSFS {scsi_level} = = "6"
SYSFS {type} = = "0"
SYSFS {queue_type} = = "simple"
SYSFS {queue_depth} = "31"
SYSFS {device_blocked} = = "0"
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host1/target1:0:0':
ID== "target1:0:0"
BUS== ""
DRIVER== ""
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host1':
ID== "host1"
BUS== ""
DRIVER== ""
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0':
ID== "0000:00:0d.0"
BUS== "pci"
DRIVER== "ahci"
SYSFS {broken_parity_status} = = "0"
SYSFS {enable} = = "1"
SYSFS {modalias} = = "pci:v00008086d00002829sv00000000sd00000000bc01sc06i01"
SYSFS {local_cpus} = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
SYSFS {irq} = "177"
SYSFS {class} = = "0x010601"
SYSFS {subsystem_device} = = "0x0000"
SYSFS {subsystem_vendor} = = "0x0000"
SYSFS {device} = = "0x2829"
SYSFS {vendor} = = "0x8086"
Looking at parent device'/ devices/pci0000:00':
ID== "pci0000:00"
BUS== ""
DRIVER== ""
Edit the rule file for udev
[root@seiang2 ~] # cd / etc/udev/rules.d/
[root@seiang2 rules.d] # vim 99-oracle-asmdevices.rules
KERNEL== "sdb1", SUBSYSTEM== "block", SYSFS {size} = = "1975932", SYSFS {start} = = "63", OWNER= "grid", NAME= "asmdisk-data1", GROUP= "asmadmin", MODE= "0660"
KERNEL== "sdb3", SUBSYSTEM== "block", SYSFS {size} = = "1975995", SYSFS {start} = = "2008125", OWNER= "grid", NAME= "asmdisk-data2", GROUP= "asmadmin", MODE= "0660"
After editing the rule file, you can use udevtest to test udev for device management, naming, links, and permissions settings
[root@seiang2 rules.d] # udevtest / block/sdb
Main: looking at device'/ block/sdb' from subsystem 'block'
Run_program:'/ lib/udev/usb_id-x'
Run_program:'/ lib/udev/usb_id' returned with status 1
Run_program:'/ lib/udev/scsi_id-g-x-s / block/sdb-d / dev/.tmp-8-16'
Run_program:'/ lib/udev/scsi_id' (stdout) 'ID_VENDOR=ATA'
Run_program:'/ lib/udev/scsi_id' (stdout) 'ID_MODEL=VBOX_HARDDISK'
Run_program:'/ lib/udev/scsi_id' (stdout) 'ID_REVISION=1.0'
Run_program:'/ lib/udev/scsi_id' (stdout) 'ID_SERIAL=SATA_VBOX_HARDDISK_VBda65d90d-e2055c6a'
Run_program:'/ lib/udev/scsi_id' (stdout) 'ID_TYPE=disk'
Run_program:'/ lib/udev/scsi_id' (stdout) 'ID_BUS=scsi'
Run_program:'/ lib/udev/scsi_id' returned with status 0
Udev_rules_get_name: add symlink 'disk/by-id/scsi-SATA_VBOX_HARDDISK_VBda65d90d-e2055c6a'
Run_program:'/ lib/udev/path_id / block/sdb'
Run_program:'/ lib/udev/path_id' (stdout) 'ID_PATH=pci-0000:00:0d.0-scsi-1:0:0:0'
Run_program:'/ lib/udev/path_id' returned with status 0
Udev_rules_get_name: add symlink 'disk/by-path/pci-0000:00:0d.0-scsi-1:0:0:0'
Run_program:'/ lib/udev/vol_id-- export / dev/.tmp-8-16'
Run_program:'/ lib/udev/vol_id' returned with status 4
Run_program:'/ lib/udev/edd_id-- export / dev/.tmp-8-16'
Run_program:'/ lib/udev/edd_id' (stderr)'no kernel EDD support'
Run_program:'/ lib/udev/edd_id' returned with status 2
Udev_rules_get_name: no node name set, will use kernel name 'sdb'
Udev_device_event: device'/ block/sdb' already in database, validate currently present symlinks
Udev_node_add: creating device node'/ dev/sdb', major = '813, minor =' 1600, mode = '06404, uid =' 01, gid ='6'
Udev_node_add: creating symlink'/ dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VBda65d90d-e2055c6a' to'.. /.. / sdb'
Udev_node_add: creating symlink'/ dev/disk/by-path/pci-0000:00:0d.0-scsi-1:0:0:0' to'.. /.. / sdb'
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/sdb / dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VBda65d90d-e2055c6a / dev/disk/by-path/pci-0000:00:0d.0-scsi-1:0:0:0'
Restart udev, first use the command udevcontrol to reload rules before starting (this step can be omitted)
[root@seiang2 rules.d] # udevcontrol reload_rules
[root@seiang2 rules.d] # start_udev
Starting udev: [OK]
[root@seiang2 rules.d] # ll / dev/asm*
Brw-rw---- 1 grid asmadmin 8, 17 Jul 20 03:09 / dev/asmdisk-data1
Brw-rw---- 1 grid asmadmin 8, 19 Jul 20 03:09 / dev/asmdisk-data2
[root@seiang2 rules.d] #
Redhat6 version
[root@test rules.d] # udevadm info-a-p / sys/block/sdb/sdb2
Udevadm info starts with the device specified by the devpath and then
Walks up the chain of parent devices. It prints for every device
Found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
And the attributes from one single parent device.
Looking at device'/ devices/pci0000:00/0000:00:0d.0/host3/target3:0:0/3:0:0:0/block/sdb/sdb2':
KERNEL== "sdb2"
SUBSYSTEM== "block"
DRIVER== ""
ATTR {partition} = = "2"
ATTR {start} = "2120580"
ATTR {size} = "2120580"
ATTR {alignment_offset} = = "0"
ATTR {discard_alignment} = = "0"
ATTR {stat} = "238 84 1288 247 000 000 232 247"
ATTR {inflight} = = "0"
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host3/target3:0:0/3:0:0:0/block/sdb':
KERNELS== "sdb"
SUBSYSTEMS== "block"
DRIVERS== ""
ATTRS {range} = = "16"
ATTRS {ext_range} = = "256"
ATTRS {removable} = = "0"
ATTRS {ro} = = "0"
ATTRS {size} = "10485760"
ATTRS {alignment_offset} = = "0"
ATTRS {discard_alignment} = = "0"
ATTRS {capability} = "52"
ATTRS {stat} = "2082 4734 15818 2580 98980 99628 48250 0 2549 50830"
ATTRS {inflight} = = "0"
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host3/target3:0:0/3:0:0:0':
KERNELS== "3VOV 0VOUR 0UR 0"
SUBSYSTEMS== "scsi"
DRIVERS== "sd"
ATTRS {device_blocked} = = "0"
ATTRS {type} = = "0"
ATTRS {scsi_level} = = "6"
ATTRS {vendor} = = "ATA"
ATTRS {model} = = "VBOX HARDDISK"
ATTRS {rev} = = "1.0"
ATTRS {state} = = "running"
ATTRS {timeout} = = "30"
ATTRS {iocounterbits} = "32"
ATTRS {iorequest_cnt} = = "0xb10"
ATTRS {iodone_cnt} = = "0xb0e"
ATTRS {ioerr_cnt} = = "0xf"
ATTRS {modalias} = = "scsi:t-0x00"
ATTRS {evt_media_change} = = "0"
ATTRS {dh_state} = = "detached"
ATTRS {queue_depth} = "31"
ATTRS {queue_ramp_up_period} = "120000"
ATTRS {queue_type} = = "simple"
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host3/target3:0:0':
KERNELS== "target3:0:0"
SUBSYSTEMS== "scsi"
DRIVERS== ""
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host3':
KERNELS== "host3"
SUBSYSTEMS== "scsi"
DRIVERS== ""
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0':
KERNELS== "0000:00:0d.0"
SUBSYSTEMS== "pci"
DRIVERS== "ahci"
ATTRS {vendor} = = "0x8086"
ATTRS {device} = = "0x2829"
ATTRS {subsystem_vendor} = = "0x0000"
ATTRS {subsystem_device} = = "0x0000"
ATTRS {class} = = "0x010601"
ATTRS {irq} = "21"
ATTRS {local_cpus} = = "1"
ATTRS {local_cpulist} = = "0"
ATTRS {modalias} = = "pci:v00008086d00002829sv00000000sd00000000bc01sc06i01"
ATTRS {numa_node} = "- 1"
ATTRS {enable} = = "1"
ATTRS {broken_parity_status} = = "0"
ATTRS {msi_bus} = ""
Looking at parent device'/ devices/pci0000:00':
KERNELS== "pci0000:00"
SUBSYSTEMS== ""
DRIVERS== ""
[root@test rules.d] # udevadm info-a-p / sys/block/sdb/sdb3
Udevadm info starts with the device specified by the devpath and then
Walks up the chain of parent devices. It prints for every device
Found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
And the attributes from one single parent device.
Looking at device'/ devices/pci0000:00/0000:00:0d.0/host3/target3:0:0/3:0:0:0/block/sdb/sdb3':
KERNEL== "sdb3"
SUBSYSTEM== "block"
DRIVER== ""
ATTR {partition} = = "3"
ATTR {start} = "4241160"
ATTR {size} = "2120580"
ATTR {alignment_offset} = = "0"
ATTR {discard_alignment} = = "0"
ATTR {stat} = "200 122 1288 255 00 00 0 250 255"
ATTR {inflight} = = "0"
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host3/target3:0:0/3:0:0:0/block/sdb':
KERNELS== "sdb"
SUBSYSTEMS== "block"
DRIVERS== ""
ATTRS {range} = = "16"
ATTRS {ext_range} = = "256"
ATTRS {removable} = = "0"
ATTRS {ro} = = "0"
ATTRS {size} = "10485760"
ATTRS {alignment_offset} = = "0"
ATTRS {discard_alignment} = = "0"
ATTRS {capability} = "52"
ATTRS {stat} = "2082 4734 15818 2580 98980 99628 48250 0 2549 50830"
ATTRS {inflight} = = "0"
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host3/target3:0:0/3:0:0:0':
KERNELS== "3VOV 0VOUR 0UR 0"
SUBSYSTEMS== "scsi"
DRIVERS== "sd"
ATTRS {device_blocked} = = "0"
ATTRS {type} = = "0"
ATTRS {scsi_level} = = "6"
ATTRS {vendor} = = "ATA"
ATTRS {model} = = "VBOX HARDDISK"
ATTRS {rev} = = "1.0"
ATTRS {state} = = "running"
ATTRS {timeout} = = "30"
ATTRS {iocounterbits} = "32"
ATTRS {iorequest_cnt} = = "0xb10"
ATTRS {iodone_cnt} = = "0xb0e"
ATTRS {ioerr_cnt} = = "0xf"
ATTRS {modalias} = = "scsi:t-0x00"
ATTRS {evt_media_change} = = "0"
ATTRS {dh_state} = = "detached"
ATTRS {queue_depth} = "31"
ATTRS {queue_ramp_up_period} = "120000"
ATTRS {queue_type} = = "simple"
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host3/target3:0:0':
KERNELS== "target3:0:0"
SUBSYSTEMS== "scsi"
DRIVERS== ""
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0/host3':
KERNELS== "host3"
SUBSYSTEMS== "scsi"
DRIVERS== ""
Looking at parent device'/ devices/pci0000:00/0000:00:0d.0':
KERNELS== "0000:00:0d.0"
SUBSYSTEMS== "pci"
DRIVERS== "ahci"
ATTRS {vendor} = = "0x8086"
ATTRS {device} = = "0x2829"
ATTRS {subsystem_vendor} = = "0x0000"
ATTRS {subsystem_device} = = "0x0000"
ATTRS {class} = = "0x010601"
ATTRS {irq} = "21"
ATTRS {local_cpus} = = "1"
ATTRS {local_cpulist} = = "0"
ATTRS {modalias} = = "pci:v00008086d00002829sv00000000sd00000000bc01sc06i01"
ATTRS {numa_node} = "- 1"
ATTRS {enable} = = "1"
ATTRS {broken_parity_status} = = "0"
ATTRS {msi_bus} = ""
Looking at parent device'/ devices/pci0000:00':
KERNELS== "pci0000:00"
SUBSYSTEMS== ""
DRIVERS== ""
[root@test rules.d] # vim 99-oracle-asmdevices.rules
KERNEL== "sdb2", SUBSYSTEM== "block", ATTR {size} = = "2120580", ATTR {start} = = "2120580", OWNER= "grid", NAME= "asmdisk-data1", GROUP= "asmadmin", MODE= "0660"
KERNEL== "sdb3", SUBSYSTEM== "block", ATTR {size} = = "2120580", ATTR {start} = = "4241160", OWNER= "grid", NAME= "asmdisk-data2", GROUP= "asmadmin", MODE= "0660"
[root@test rules.d] # start_udev
Starting udev: [OK]
[root@test rules.d] # ll / dev/asm*
Brw-rw----. 1 grid asmadmin 8, 18 Jul 20 15:57 / dev/asmdisk-data1
Brw-rw----. 1 grid asmadmin 8, 19 Jul 20 15:57 / dev/asmdisk-data2
Note: you can see here that by configuring the 99-oracle-asmdevices.rules file, the device is created as a block type.
You can compare and observe the following types of devices created from bare devices
Use bare devices to create asm disks
Add a new disk and partition it
[root@seiang2 rules.d] # fdisk / dev/sdb
Command (m for help): n
Command action
E extended
P primary partition (1-4)
E
Selected partition 4
First cylinder (249652, default 249):
Using default value 249
Last cylinder or + size or + sizeM or + sizeK (249652, default 652):
Using default value 652
Command (m for help): n
First cylinder (249652, default 249):
Using default value 249
Last cylinder or + size or + sizeM or + sizeK (249652, default 652): + 1G
Command (m for help): n
First cylinder (37262, default 372):
Using default value 372
Last cylinder or + size or + sizeM or + sizeK: + 1G
Command (m for help): W
The partition table has been altered!
Calling ioctl () to re-read partition table.
Syncing disks.
[root@seiang2 rules.d] # fdisk-l
Disk / dev/sda: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/ dev/sda1 * 1 13 104391 83 Linux
/ dev/sda2 14 1958 15623212 + 8e Linux LVM
Disk / dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/ dev/sdb1 1 123 987966 83 Linux
/ dev/sdb2 124 125 16065 83 Linux
/ dev/sdb3 126248987997 + 83 Linux
/ dev/sdb4 249 652 3245130 5 Extended
/ dev/sdb5 249 371 987966 83 Linux
/ dev/sdb6 372 494 987966 83 Linux
Configure bare device mapping, modify / etc/udev/rules.d/60-raw.rules file
[root@seiang2 rules.d] # vim 60-raw.rules
ACTION== "add", KERNEL== "/ dev/sdb5", RUN+= "/ bin/raw / dev/raw/raw5% N"
ACTION== "add", ENV {MAJOR} = = "8", ENV {MINOR} = = "1", RUN+= "/ bin/raw / dev/raw/raw5% M% m"
ACTION== "add", KERNEL== "/ dev/sdb6", RUN+= "/ bin/raw / dev/raw/raw6% N"
ACTION== "add", ENV {MAJOR} = = "8", ENV {MINOR} = = "2", RUN+= "/ bin/raw / dev/raw/raw6% M% m"
ACTION== "add", KERNEL== "raw5", OWNER= "grid", GROUP= "asmadmin", MODE= "0660"
ACTION== "add", KERNEL== "raw6", OWNER= "grid", GROUP= "asmadmin", MODE= "0660"
Restart the udev service and query raw
[root@seiang2 rules.d] # start_udev
Starting udev: [OK]
[root@seiang2 rules.d] # raw-qa
/ dev/raw/raw5: bound to major 8, minor 1
/ dev/raw/raw6: bound to major 8, minor 2
[root@seiang2 rules.d] # ll / dev/raw*
Crw- 1 root root 162, 0 Jul 20 02:53 / dev/rawctl
/ dev/raw:
Total 0
Crw-rw---- 1 grid asmadmin 162, 5 Jul 20 03:31 raw5
Crw-rw---- 1 grid asmadmin 162, 6 Jul 20 03:31 raw6
Note: you can see here that by configuring the 60-raw.rules file, you create a device with a character type.
After this configuration, the bare device file is automatically mapped to the corresponding partition device file and the correct users and groups are set.
Introduction to bare Devices (from http://blog.itpub.net/26736162/viewspace-1401193/)
Bare device: also known as bare partition (raw partition), is a special character device that is not formatted and is not read by Unix/Linux through the file system. Bare devices can be bound to either a partition or a disk.
Character device: reading and writing to character device does not need to go through OS's buffer. It cannot be used by the file system mount.
Block devices: read and write to block devices need to go through OS's buffer, which can be mount to the file system.
This is related to the version of linux. In the old version, you can only have up to 256bare devices. Under Linux 4, you can bind 81Array2 bare devices by doing more. However, under linux, there can only be a maximum of 255partitions, so if you bind a partition with a bare device, you can only bind a maximum of 255bare devices. If you are using lvm, there is no such restriction.
There can be up to 15 partitions on a single disk under Linux. 3 primary partitions + 1 extended partition + 11 logical partitions.
The proposed partition method is to first divide into 3 primary partitions, the fourth partition is an extended partition, and then divide it into 11 logical partitions in the extended partition.
Note: bare devices should not be bound to extended partitions. If you need to use bare devices in linux, you need to bind them manually, but not in unix.
Major and minor device number
In the unix/linux system, everything is a file. All hard drives, keyboards and other devices are represented by files, corresponding to the files under / dev. For applications, you can open, close, read and write these device files just like ordinary files. But such filenames, such as / dev/sda and / dev/ raw/raw1, are user space names, and OS Kernel has no idea what the name refers to. In kernel space, devices are distinguished by major and minor device number.
Major device number can be thought of as a device driver, and devices managed by the same device driver have the same major device number. This number is actually the index of device driver table in Kernel, and this table holds different device drivers. Minor device number is used to represent the specific device being accessed. In other words, Kernel finds the device driver based on major device number, and then obtains attributes such as device location from minor device number. All of these major device number are pre-assigned. For example, the bare device is 162 and the SCSI block device is 8.
The configuration of raw devices on the Redhat platform has changed since redhat 5. Prior to redhat 5, / etc/sysconfig/rawdevices components were configured directly, and / etc/init.d/rawdevices was used to manage the startup and shutdown of raw devices. After Redhat 5, the original raw device interface has been cancelled, and redhat 5 is configured through udev rules. To configure, you need to edit the file / etc/udev/rules.d/60-raw.rules.
Cat / etc/udev/rules.d/60-raw.rules
# Enter raw device bindings here.
#
# An example would be:
# ACTION== "add", KERNEL== "sda", RUN+= "/ bin/raw / dev/raw/raw1% N"
# to bind / dev/raw/raw1 to / dev/sda, or
# ACTION== "add", ENV {MAJOR} = = "8", ENV {MINOR} = = "1", RUN+= "/ bin/raw / dev/raw/raw2% M% m"
# to bind / dev/raw/raw2 to the device with major 8, minor 1.
Among them
ACTION== "add", KERNEL= "", RUN+= "raw/ dev/raw/rawX% N"
Configure the device name and replace it with the device name you need to bind (e.g. / dev/sda1). X is the naked device number.
Primary / minor number:
ACTION== "add", ENV {MAJOR} = "A", ENV {MINOR} = "B", RUN+= "raw/ dev/raw/rawX M% m"
"A" and "B" are the primary / secondary numbers of the device, and X is the raw device number used by the system.
The personal understanding of the process of redhat managing raw is that in redhat 5, raw devices are managed through udev, while udev identifies raw devices through MAJOR and MINOR. Therefore, it is necessary to bind the device number and the bare equipment number, and the primary and secondary equipment numbers can be specified or assigned automatically by the system. According to the example of raw.rule in red hat's official documentation, KERNEL==.. Or ENV {MAJOR}... You only need to configure one at will, but some netizens have tested and verified that they must be configured at the same time.
If you have more than one raw device, you can write as follows:
ACTION== "add", KERNEL== "raw [1-4]", OWNER= "dave", GROUP= "tianlesoftware", MODE= "0660"
Note: use / etc/sysconfig/rawdevices and / etc/udev/permissions.d/50-udev.permissions for raw device configuration and rights management prior to kernel 2.6.9-89.5AXS2. After kernel 2.6.18-128.7AXS3, the / etc/udev/rules.d/60-raw.rules introduced in this article is used to manage raw devices.
Considerations for using bare devices as data files for Oracle
1. A bare device can only place one data file.
2. The size of the data file cannot exceed the size of the bare device.
If it is a log file, the maximum available size of the bare device = the partition size corresponding to the bare device-1 * 512 (keep one redo lock)
If it is a data file, the maximum available size of the bare device = the partition size corresponding to the bare device-2 * db_block_size (two block reserved)
For simplicity, set all files to be 1m smaller than the bare device.
3. It is best not to set the data file to be called automatic extension. If the setting is called automatic extension, be sure to set the maxsize setting to be smaller than the bare device.
4. Oracle under linux cannot directly use logical volumes as bare devices, but also binds them. Not under unix.
Thank you for reading! This is the end of this article on "how to solve the problem of using udev to manage asmdisk execution / sbin/scsi_id does not display UUID". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.