189 8069 5689

linuxudev的配置是什么-创新互联

今天就跟大家聊聊有关linux udev的配置是什么,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

成都创新互联公司主要从事成都网站设计、成都做网站、外贸网站建设、网页设计、企业做网站、公司建网站等业务。立足成都服务东方,十载网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18982081108

1.查询DISK uuid

# /usr/lib/udev/scsi_id -g -u /dev/sdb

获取需要绑定ASM Disk磁盘的uuid
 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

2.编辑udev rule文件

(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'"

快速生成脚本:

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.重启UDEV使配置生效

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

看完上述内容,你们对linux udev的配置是什么有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联-成都网站建设公司行业资讯频道,感谢大家的支持。


网页标题:linuxudev的配置是什么-创新互联
当前链接:http://cdxtjz.cn/article/pdhhc.html

其他资讯