如何使用udev给rac asm

发布网友 发布时间:2022-04-24 02:11

我来回答

1个回答

热心网友 时间:2022-04-08 10:10

机器上面使用的磁盘:

[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, 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就可以了。

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com