What is the configuration of linux udev
Today, I will talk to you about what the configuration of linux udev is. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
1. Query DISK uuid
# / usr/lib/udev/scsi_id-g-u / dev/sdb
Get the uuid that needs to be bound to an ASM Disk disk
For i in b c d e f g
Do
Echo "sd$i"`/ usr/lib/udev/scsi_id-whitelisted-replace-whitespace-device=/dev/sd$ i`"
Done
two。 Edit the udev rule file
(1) .Create UDEV Permission Rule Prior Up-To Version 11.1.0.7
# / bin/cat / etc/udev/rules.d/99-raw.rules
KERNEL== "sd*", BUS== "scsi", PROGRAM== "/ sbin/scsi_id-g-u-s / block/%P", RESULT== "3600805f30016c0e0ad41ffa8e6d90001", NAME= "raw1", ACTION== "add | change", OWNER= "root", GROUP= "oinstall", MODE= "0640"
KERNEL== "sd*", BUS== "scsi", PROGRAM== "/ sbin/scsi_id-g-u-s / block/%P", RESULT== "3600805f30016c0e0ae51efbfb2930002", NAME= "raw2", ACTION== "add | change", OWNER= "oracle", GROUP= "oinstall", MODE= "0660"
(2). Create UDEV Permission Rule For Version 11.2 And Later
For RHEL5/OL5/OL5
# / bin/cat / etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL== "sd*", BUS== "scsi", PROGRAM== "/ sbin/scsi_id-g-u-s / block/%P", RESULT== "350002ac000010b52", NAME= "vote1", ACTION== "add | change", OWNER= "grid", GROUP= "asmadmin", MODE= "0660"
KERNEL== "sd*", BUS== "scsi", PROGRAM== "/ sbin/scsi_id-g-u-s / block/%P", RESULT== "350002ac000020b52", NAME= "vote2", ACTION== "add | change", OWNER= "grid", GROUP= "asmadmin", MODE= "0660"
KERNEL== "sd*", BUS== "scsi", PROGRAM== "/ sbin/scsi_id-g-u-s / block/%P", RESULT== "350002ac000030b52", NAME= "vote3", ACTION== "add | change", OWNER= "grid", GROUP= "asmadmin", MODE= "0660"
For RHEL6/OL6
# / bin/cat / etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL== "sd*", BUS== "scsi", PROGRAM== "/ sbin/scsi_id I-- whitelisted-- device=/dev/$name", RESULT== "350002ac000010b52", NAME= "vote1", ACTION== "add | change", OWNER= "grid", GROUP= "asmadmin", MODE= "0660"
KERNEL== "sd*", BUS== "scsi", PROGRAM== "/ sbin/scsi_id I-- whitelisted-- device=/dev/$name", RESULT== "350002ac000020b52", NAME= "vote2", ACTION== "add | change", OWNER= "grid", GROUP= "asmadmin", MODE= "0660"
KERNEL== "sd*", BUS== "scsi", PROGRAM== "/ sbin/scsi_id I-- whitelisted-- device=/dev/$name", RESULT== "350002ac000030b52", NAME= "vote3", ACTION== "add | change", OWNER= "grid", GROUP= "asmadmin", MODE= "0660"
For RHEL7
# / bin/cat / etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL== "sd* [! 0-9]", ENV {DEVTYPE} = = "disk", SUBSYSTEM== "block", PROGRAM== "/ usr/lib/udev/scsi_id-g-u-d $devnode", RESULT== "1IET_00020002", RUN+= "/ bin/sh-c 'mknod / dev/asmdisk01p1 b $major $minor; chown grid:dba / dev/asmdisk01p1; chmod 0660 / dev/asmdisk01p1'"
Quickly generate scripts:
Redhat 6
For i in b c d e f g
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\ ""
Done
Redhat 7
For i in b c d e f g
Do
Echo "KERNEL==\" sd*\ ", ENV {DEVTYPE} = =\" disk\ ", SUBSYSTEM==\" block\ ", PROGRAM==\" / usr/lib/udev/scsi_id-g-u-d\ $devnode\ ", RESULT==\" `/ usr/lib/udev/scsi_id-g-u / dev/sd$ i`\ ", RUN+=\" / bin/sh-c 'mknod / dev/asmdisk$i b\ $major\ $minor; chown grid:asmadmin / dev/asmdisk$i; chmod 0660 / dev/asmdisk$i'\ ""
Done
3. Restart UDEV to make the configuration effective
On RHEL5/OL5:
# / sbin/udevcontrol reload_rules
# / sbin/start_udev
On RHEL6/OL6:
# / sbin/udevadm control-reload-rules
# / sbin/start_udev
On RHEL7:
-Check for new device name:
# / sbin/udevadm trigger-type=devices-action=change
# / bin/ls / dev/asmdisk01p1
-To reload udev rule execute below command:
# / sbin/udevadm control-reload
-For Troubleshooting udev rule execute below command:
# / sbin/udevadm test / sys/block/sdb
After reading the above, do you have any further understanding of the configuration of linux udev? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.