如何使用udev给rac asm

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何使用udev给rac asm相关的知识,希望对你有一定的参考价值。

参考技术A 机器上面使用的磁盘:

[root@rac-db2 ~]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track,
5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector
size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal):
512 bytes / 512 bytes
Disk identifier: 0x00081b38

Device Boot
Start
End Blocks Id
System
/dev/sda1
*
1 5100
40960000 83
Linux
/dev/sda2
5100
5222 982016 82 Linux swap /
Solaris

Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130
cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size
(logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512
bytes / 512 bytes
Disk identifier: 0x4af1bcf1

Device Boot
Start
End Blocks Id System

Disk /dev/sdc: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130
cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size
(logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512
bytes / 512 bytes
Disk identifier: 0x45528f9a

Device Boot
Start
End Blocks Id System

Disk /dev/sdd: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130
cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size
(logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512
bytes / 512 bytes
Disk identifier: 0xf65dbdac

Device Boot
Start
End Blocks Id System

Disk /dev/sde: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130
cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size
(logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512
bytes / 512 bytes
Disk identifier: 0xe0e7f25c

Device Boot
Start
End Blocks Id System

Disk /dev/sdf: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130
cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size
(logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512
bytes / 512 bytes
Disk identifier: 0x4b720782

Device Boot
Start
End Blocks Id System

其中sdb sdc sdd sde sdf是给oracle asm使用的磁盘

下面是配置udev的过程:

1、得到每个磁盘对应的scsi id号,使用命令如下:

[root@rac-db1 ~]# scsi_id -g -u
/dev/sdb
36000c29a982d7d5fe0af684b22046b34
[root@rac-db1 ~]# scsi_id
-g -u /dev/sdc
36000c294085e61228085d870db2173af
[root@rac-db1
~]# scsi_id -g -u
/dev/sdd
36000c29a1a053b53514c7202e9fd2658
[root@rac-db1 ~]# scsi_id
-g -u /dev/sde
36000c29ffa47abfd932ddf3a2f598633
[root@rac-db1
~]# scsi_id -g -u /dev/sdf
36000c292926acffd78b0a49f27d62c51

2、编辑udev的配置文件

编辑文件/etc/udev/rules.d/99-oracle-asmdevices.rules,内容如下:

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p",
RESULT=="36000c29a982d7d5fe0af684b22046b34", NAME="asmgrid_disk1",
OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi",
PROGRAM=="/sbin/scsi_id -g -u -s %p",
RESULT=="36000c294085e61228085d870db2173af", NAME="asmgrid_disk2",
OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi",
PROGRAM=="/sbin/scsi_id -g -u -s %p",
RESULT=="36000c29a1a053b53514c7202e9fd2658", NAME="asmgrid_disk3",
OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi",
PROGRAM=="/sbin/scsi_id -g -u -s %p",
RESULT=="36000c29ffa47abfd932ddf3a2f598633", NAME="asmgrid_disk4",
OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi",
PROGRAM=="/sbin/scsi_id -g -u -s %p",
RESULT=="36000c292926acffd78b0a49f27d62c51", NAME="asmgrid_disk5",
OWNER="grid", GROUP="asmadmin", MODE="0660"

3、加载配置文件

[root@rac-db1 /]# udevadm control reload-rules

4、重启udev服务

[root@rac-db1 /]# start_udev
Starting udev: [ OK ]

5、检查配置结果

[root@rac-db1 /]# ls -l /dev/asm*
brw-rw---- 1 grid asmadmin 8, 16 Aug 31
11:11 /dev/asmgrid_disk1
brw-rw---- 1 grid asmadmin 8, 32 Aug 31 11:11
/dev/asmgrid_disk2
brw-rw---- 1 grid asmadmin 8, 48 Aug 31 11:11
/dev/asmgrid_disk3
brw-rw---- 1 grid asmadmin 8, 64 Aug 31 11:11
/dev/asmgrid_disk4
brw-rw---- 1 grid asmadmin 8, 80 Aug 31 11:11
/dev/asmgrid_disk5

[root@rac-db1 proc]# udevadm info --query=all --path=/block/sdc
P:
/devices/pci0000:00/0000:00:11.0/0000:02:05.0/host3/target3:0:1/3:0:1:0/block/sdc
N:
asmgrid_disk2
W: 50
S: block/8:32
S:
disk/by-id/scsi-36000c294085e61228085d870db2173af
S:
disk/by-path/pci-0000:02:05.0-scsi-0:0:1:0
S:
disk/by-id/wwn-0x6000c294085e61228085d870db2173af
E: UDEV_LOG=3
E:
DEVPATH=/devices/pci0000:00/0000:00:11.0/0000:02:05.0/host3/target3:0:1/3:0:1:0/block/sdc
E:
MAJOR=8
E: MINOR=32
E: DEVNAME=/dev/asmgrid_disk2
E: DEVTYPE=disk
E:
SUBSYSTEM=block
E: ID_SCSI=1
E: ID_VENDOR=VMware
E:
ID_VENDOR_ENC=VMware\x20\x20
E: ID_MODEL=Virtual_disk
E:
ID_MODEL_ENC=Virtual\x20disk\x20\x20\x20\x20
E: ID_REVISION=1.0
E:
ID_TYPE=disk
E: ID_SERIAL_RAW=36000c294085e61228085d870db2173af
E:
ID_SERIAL=36000c294085e61228085d870db2173af
E:
ID_SERIAL_SHORT=6000c294085e61228085d870db2173af
E:
ID_WWN=0x6000c294085e6122
E: ID_WWN_VENDOR_EXTENSION=0x8085d870db2173af
E:
ID_WWN_WITH_EXTENSION=0x6000c294085e61228085d870db2173af
E:
ID_SCSI_SERIAL=6000c294085e61228085d870db2173af
E: ID_BUS=scsi
E:
ID_PATH=pci-0000:02:05.0-scsi-0:0:1:0
E: ID_PART_TABLE_TYPE=dos
E:
LVM_SBIN_PATH=/sbin
E: UDISKS_PRESENTATION_NOPOLICY=0
E:
UDISKS_PARTITION_TABLE=1
E: UDISKS_PARTITION_TABLE_SCHEME=mbr
E:
UDISKS_PARTITION_TABLE_COUNT=0
E: DEVLINKS=/dev/block/8:32
/dev/disk/by-id/scsi-36000c294085e61228085d870db2173af
/dev/disk/by-path/pci-0000:02:05.0-scsi-0:0:1:0
/dev/disk/by-id/wwn-0x6000c294085e61228085d870db2173af

[root@rac-db1 proc]#

配置了udev后,操作系统fdisk命令看不到asm使用的磁盘

[root@rac-db1 proc]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track,
5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector
size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal):
512 bytes / 512 bytes
Disk identifier: 0x000cc4c1

Device Boot
Start
End Blocks Id
System
/dev/sda1
*
1 5100
40960000 83
Linux
/dev/sda2
5100
5222 982016 82 Linux swap /
Solaris

对于rac中其他节点,把99-oracle-asmdevices.rules copy过去,再执行步骤3,4就可以了。本回答被提问者和网友采纳

以上是关于如何使用udev给rac asm的主要内容,如果未能解决你的问题,请参考以下文章

Linux下udev详细介绍

求助,RAC环境卸载oracle软件把ASM磁盘组弄丢了

如何获取 Oracle 11g RAC asm spfile 的位置

rhel 7.0 配置ASM磁盘,使用udev绑定方法

使用udev配置与ASM的对应的关系

使用udev管理asmdisk执行/sbin/scsi_id不显示UUID解决方法