连接:http://www.askmaclean.com/archives/%E5%9C%A8linux-6%E4%B8%8A%E4%BD%BF%E7%94%A8udev%E8%A7%A3%E5%86%B3rac-asm%E5%AD%98%E5%82%A8%E8%AE%BE%E5%A4%87%E5%90%8D%E9%97%AE%E9%A2%98.html
Maclean一直是使用UDEV替代ASMLIB做RAC存储设备名绑定的拥护者,相关的专题文章可以作为读者的预读知识是:
Why ASMLIB and why not?
利用UDEV服务解决RAC ASM存储设备名
在《利用UDEV服务解决RAC ASM存储设备名 》一文中我推荐了自己写的一个脚本,该脚本会自动生成udev rule规则文件:
for i in b c d e f g h i j k ; do echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id -g -u -s %p\", RESULT==\"`scsi_id -g -u -s /block/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\"" done
以上脚本在Linux 5上是通用的, 但是有同学反映在redhat/Oracle Linux 6以上版本中该脚本失效了。
这是因为:
在OEL6或者RHEL6中,这一切都有所变化。
主要的变化是:
1. scsi_id的命令语法发生了变化,scsi_id -g -u -s这样的命令不再有效。
2. udevtest命令已经没有了,整合到了udevadm中。
How to use udev for Oracle ASM in Oracle Linux 6
下面我提供改良后的脚本,可以在redhat/Oracle Linux 6上生成正确的udev rule 规则文件:
1. #首先确认是 Linux 6.0以上版本 [root@vrh6 dev]# cat /etc/issue Oracle Linux Server release 6.2 Kernel \r on an \m 2. #添加记录到/etc/scsi_id.config echo "options=--whitelisted --replace-whitespace" >> /etc/scsi_id.config 3. #确认哪些块设备需要udev绑定 [root@vrh6 dev]# ls -l sd* brw-rw----. 1 root disk 8, 0 Jun 30 09:29 sda brw-rw----. 1 root disk 8, 1 Jun 30 09:29 sda1 brw-rw----. 1 root disk 8, 2 Jun 30 09:29 sda2 brw-rw----. 1 root disk 8, 16 Jun 30 09:29 sdb brw-rw----. 1 root disk 8, 32 Jun 30 09:29 sdc brw-rw----. 1 root disk 8, 48 Jun 30 09:29 sdd brw-rw----. 1 root disk 8, 64 Jun 30 09:29 sde brw-rw----. 1 root disk 8, 80 Jun 30 09:29 sdf 例如在本实例中 sdb-> sdf的块设备需要绑定 4. 将 b->f的编号放入for 循环中,例如: # AUTO UDEV RULE BY Maclean Liu 2012/06/30 for i in b c d e f ; 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 就会生成sdb->sdf 设备绑定的RULE,在将这些RULE写入到/etc/udev/rules.d/99-oracle-asmdevices.rules中 也可以直接利用以下脚本 ,写出RULE到99-oracle-asmdevices.rules # AUTO UDEV RULE BY Maclean Liu 2012/06/30 for i in b c d e f ; 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\"" >> /etc/udev/rules.d/99-oracle-asmdevices.rules done 5. 之后运行用root运行/sbin/start_udev 即可
实际运行示例:
[root@vrh6 dev]# echo "options=--whitelisted --replace-whitespace" >> /etc/scsi_id.config [root@vrh6 dev]# for i in b c d e f ; > 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\"" >> /etc/udev/rules.d/99-oracle-asmdevices.rules > done [root@vrh6 dev]# [root@vrh6 dev]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB09cadb31-cfbea255", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB5f097069-59efb82f", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB4e1a81c0-20478bc4", NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VBdcce9285-b13c5a27", NAME="asm-diske", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB82effe1a-dbca7dff", NAME="asm-diskf", OWNER="grid", GROUP="asmadmin", MODE="0660" [root@vrh6 dev]# [root@vrh6 dev]# /sbin/start_udev Starting udev: [ OK ] [root@vrh6 dev]# ls -l asm* brw-rw----. 1 grid asmadmin 8, 16 Jun 30 09:34 asm-diskb brw-rw----. 1 grid asmadmin 8, 32 Jun 30 09:34 asm-diskc brw-rw----. 1 grid asmadmin 8, 48 Jun 30 09:34 asm-diskd brw-rw----. 1 grid asmadmin 8, 64 Jun 30 09:34 asm-diske brw-rw----. 1 grid asmadmin 8, 80 Jun 30 09:34 asm-diskf
相关文章 | Related posts:
- 利用UDEV服务解决RAC ASM存储设备名 加入dbDao.com Oracle技术学习QQ群:171092051 在<Why ASMLIB and […]...
- 几个关于oracle 11g ASM的问题 加入dbDao.com Oracle技术学习QQ群:171092051 Question: 1.11g Ora […]...
- Oracle安装与操作系统用户组 加入dbDao.com Oracle技术学习QQ群:171092051 Oracle软件在安装维护过程中长要和 […]...
- CRS-4258: Addition and deletion of voting files are not allowed because the voting files are on ASM 加入dbDao.com Oracle技术学习QQ群:171092051 客户的一套11.2.0.1 RAC系统 […]...
- 25条评论
-
-
-
-
maclean推荐使用vbox 替代vmware, vmware 确实是有该问题,我在另一个帖子里也回复过这个问题,谢谢指出。
-
-
cuizj923
我的环境是两台机器通过多路径的方式 共享一个存储。按照您提供的方法udev 帮定wwid.oracle 安装程度提示不是共享磁盘。我的操作步骤如下:
From Configuring persistent storage in Red Hat Enterprise Linux 6
1.Create /etc/scsi_id.config add
options=--whitelisted --replace-whitespace
2.Get UUID for disks you want to created ASM on
scsi_id --whitelisted --replace-whitespace --device=/dev/sda
[root@racnode2 rules.d]# multipath -ll
mpathe (36000d3100055f5000000000000000043) dm-8 COMPELNT,Compellent Vol
size=1.0T features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
|- 1:0:3:2 sdg 8:96 active ready running
|- 2:0:2:2 sdk 8:160 active ready running
|- 1:0:2:2 sde 8:64 active ready running
`- 2:0:3:2 sdm 8:192 active ready running
mpathd (36000d3100055f5000000000000000044) dm-2 COMPELNT,Compellent Vol
size=1.5T features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
|- 1:0:3:1 sdf 8:80 active ready running
|- 1:0:2:1 sdd 8:48 active ready running
|- 2:0:2:1 sdj 8:144 active ready running
`- 2:0:3:1 sdl 8:176 active ready running
mpatha (36000d3100055f5000000000000000042) dm-7 COMPELNT,Compellent Vol
size=5.0G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
|- 1:0:0:3 sdb 8:16 active ready running
|- 1:0:1:3 sdc 8:32 active ready running
|- 2:0:0:3 sdh 8:112 active ready running
`- 2:0:1:3 sdi 8:128 active ready running
[root@racnode1 rules.d]# multipath -ll
mpathe (36000d3100055f5000000000000000042) dm-2 COMPELNT,Compellent Vol
size=5.0G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
|- 1:0:1:3 sdc 8:32 active ready running
|- 1:0:0:3 sdb 8:16 active ready running
|- 2:0:0:3 sdh 8:112 active ready running
`- 2:0:1:3 sdi 8:128 active ready running
mpathc (36000d3100055f5000000000000000043) dm-7 COMPELNT,Compellent Vol
size=1.0T features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
|- 1:0:2:2 sde 8:64 active ready running
|- 1:0:3:2 sdg 8:96 active ready running
|- 2:0:2:2 sdk 8:160 active ready running
`- 2:0:3:2 sdm 8:192 active ready running
mpathb (36000d3100055f5000000000000000044) dm-8 COMPELNT,Compellent Vol
size=1.5T features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
|- 1:0:3:1 sdf 8:80 active ready running
|- 2:0:2:1 sdj 8:144 active ready running
|- 1:0:2:1 sdd 8:48 active ready running
`- 2:0:3:1 sdl 8:176 active ready running
3. Create UDEV rules file
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
PROGRAM add scsi_id command, RESULT is UUID
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000d3100055f5000000000000000042",
NAME="asmdisk1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000d3100055f5000000000000000044",
NAME="asmdisk2", OWNER="grid", GROUP="asmadmin", MODE="0660"
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\""
4.udevadm command can test UDEV configuration
5.Start udev
/sbin/start_udev
6. Restart and check
ls -l /dev/asm*
[root@racnode1 dev]# ls -al
total 4
drwxr-xr-x. 18 root root 4380 Jan 28 17:41 .
dr-xr-xr-x. 30 root root 4096 Jan 29 2013 ..
brw-rw----. 1 grid asmadmin 8, 32 Jan 29 2013 asmdisk1
brw-rw----. 1 grid asmadmin 8, 144 Jan 29 2013 asmdisk2
[root@racnode2 dev]# ls -al
total 4
drwxr-xr-x. 18 root root 4380 Jan 29 09:42 .
dr-xr-xr-x. 30 root root 4096 Jan 29 2013 ..
brw-rw----. 1 grid asmadmin 8, 128 Jan 29 2013 asmdisk1
brw-rw----. 1 grid asmadmin 8, 144 Jan 29 2013 asmdisk2
Device Checks for ASM - This is a pre-check to verify if the specified devices meet the requirements for configuration through the Oracle Universal Storage Manager
Configuration Assistant.? Error:
?-?
"/dev/asmdisk1" is not shared ?- Cause:?Cause Of Problem Not Available ?- Action:?User Action Not Available
?-?
racnode2:Unable to determine the sharedness of /dev/sdd on nodes: The problem occurred on nodes: racnode2 ?- Cause:?Cause Of Problem Not Available ?- Action:?User
Action Not Available
?-?
racnode1:Unable to determine the sharedness of /dev/sdf on nodes: The problem occurred on nodes: racnode1 ?- Cause:?Cause Of Problem Not Available ?- Action:?User
Action Not Available
Check Failed on Nodes: [racnode2, ?racnode1]
Verification result of failed node: racnode2
?Details:
?-?
Unable to determine the sharedness of /dev/asmdisk2 on nodes: [racnode2, racnode1] ?- Cause:?Cause Of Problem Not Available ?- Action:?User Action Not Available
?-?
Unable to determine the sharedness of /dev/asmdisk1 on nodes: [racnode2, racnode1] ?- Cause:?Cause Of Problem Not Available ?- Action:?User Action Not Available
?-?
PRVF-9802 : Attempt to get udev info from node "racnode2" failed ?- Cause:? Attempt to read the udev permissions file failed, probably due to missing permissions
directory, missing or invalid permissions file, or permissions file not accessible to use account running the check. ?- Action:? Make sure that the udev permissions
directory is created, the udev permissions file is available, and it has correct read permissions for access by the user running the check.
Back to Top
Verification result of failed node: racnode1
?Details:
?-?
Unable to determine the sharedness of /dev/asmdisk2 on nodes: [racnode2, racnode1] ?- Cause:?Cause Of Problem Not Available ?- Action:?User Action Not Available
?-?
Unable to determine the sharedness of /dev/asmdisk1 on nodes: [racnode2, racnode1] ?- Cause:?Cause Of Problem Not Available ?- Action:?User Action Not Available
?-?
PRVF-9802 : Attempt to get udev info from node "racnode1" failed ?- Cause:? Attempt to read the udev permissions file failed, probably due to missing permissions
directory, missing or invalid permissions file, or permissions file not accessible to use account running the check. ?- Action:? Make sure that the udev permissions
directory is created, the udev permissions file is available, and it has correct read permissions for access by the user running the check.
Back to Top -
admxy
[root@rac1 ~]# ll /dev/asm*
brw-rw---- 1 grid asmadmin 8, 17 May 13 11:05 /dev/asm-diskb
brw-rw---- 1 grid asmadmin 8, 33 May 13 11:05 /dev/asm-diskc
请问,用udev后,是不是还需要安装oracle官网上的两个包啊
oracleasmlib-2.0.4-1.el6.x86_64
oracleasm-support-2.1.8-1.el6.x86_64
操作系统发现的硬盘,是否要在进行start_udev之前就进行分区呢? -
-
-
-
-
blue
[root@rac1 rules.d]# more 99-oracle-asmdevices.rules
KERNEL=="sd*5", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB1f438a3a-b80b7cbe_", NAME="asm-disk
5", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*6", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB1f438a3a-b80b7cbe_", NAME="asm-disk
6", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*7", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB1f438a3a-b80b7cbe_", NAME="asm-disk
7", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*8", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB1f438a3a-b80b7cbe_", NAME="asm-disk
8", OWNER="grid", GROUP="asmadmin", MODE="0660"
[root@rac1 rules.d]#
[root@rac1 rules.d]# ls -l /dev/asm*
brw-rw---- 1 grid asmadmin 8, 37 Apr 8 13:11 /dev/asm-disk5
brw-rw---- 1 grid asmadmin 8, 38 Apr 8 13:11 /dev/asm-disk6
brw-rw---- 1 grid asmadmin 8, 39 Apr 8 13:11 /dev/asm-disk7
brw-rw---- 1 grid asmadmin 8, 40 Apr 8 13:11 /dev/asm-disk8
你好,麻烦问下,我用此方式绑定asm后,为什么权限明明正确,安装检查时却任然报:device checks for asm 属主属组不正确,而且说检查到的属主是root,不知道Oracle是通过那个脚本去检测的那个文件,还是直接用ll命令取的属主属组,不应该呀! -
-
-