利用UDEV管理配置ASMDISK

startay發表於2016-03-31

#### udev方式配置ASM ####

1. 檢視可用磁碟
[root@cnlvs118 tmp]# fdisk -l |grep "Disk /dev"
Disk /dev/sda: 53.7 GB, 53687091200 bytes
Disk /dev/sdb: 107.4 GB, 107374182400 bytes
Disk /dev/sdc: 549.8 GB, 549755813888 bytes
Disk /dev/sdd: 1073 MB, 1073741824 bytes
Disk /dev/sdf: 1073 MB, 1073741824 bytes
Disk /dev/sde: 1073 MB, 1073741824 bytes

2. 初始化磁碟
[root@cnlvs118 tmp]# fdisk /dev/sdd
Command (m for help): n

[root@cnlvs118 tmp]# partprobe /dev/sdd
[root@cnlvs118 tmp]# partprobe /dev/sdd1
... ...

[root@cnlvs118 tmp]# ls -l /dev/sdd
brw-rw---- 1 root disk 8, 48 Dec 23 16:25 /dev/sdd
[root@cnlvs118 tmp]# ls -l /dev/sdd1
brw-rw---- 1 root disk 8, 49 Dec 23 16:25 /dev/sdd1


3. 檢視磁碟資訊
[root@cnlvs118 sdd1]# udevadm info -a -p /sys/block/sdd/sdd1

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
... ...
  looking at device '/devices/pci0000:00/0000:00:17.0/0000:13:00.0/host3/target3:0:1/3:0:1:0/block/sdd/sdd1':
    KERNEL=="sdd1"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{partition}=="1"
    ATTR{start}=="61"
    ATTR{size}=="2096753"
    ATTR{alignment_offset}=="0"
    ATTR{discard_alignment}=="0"
    ATTR{stat}=="     316     1851     2699       49        0        0        0        0 4294967295   420493 4294546803"
    ATTR{inflight}=="4294967295        0"
... ...

4. 新增rules
[root@cnlvs118 ~]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sdd1", SUBSYSTEM=="block", ATTR{size}=="2096753", ATTR{start}=="61", NAME="asmdisk1_udev_a1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sde1", SUBSYSTEM=="block", ATTR{size}=="2096753", ATTR{start}=="61", NAME="asmdisk1_udev_a2", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdf1", SUBSYSTEM=="block", ATTR{size}=="2096753", ATTR{start}=="61", NAME="asmdisk1_udev_a3", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdc1", SUBSYSTEM=="block", ATTR{size}=="1073736342", ATTR{start}=="63", NAME="asmdisk1_udev_p1", OWNER="grid", GROUP="asmadmin", MODE="0660"

5. Reload and Restart the udev rules:
[root@cnlvs118 ~]# udevadm control --reload-rules
[root@cnlvs118 ~]# start_udev
Starting udev: [  OK  ]

[root@cnlvs118 ~]# ls -ltr /dev/asm*
brw-rw---- 1 grid asmadmin 8, 49 Dec 23 16:36 /dev/asmdisk1_udev_a1


另外一節點
vi /etc/udev/rules.d/99-oracle-asmdevices.rules

partprobe /dev/sdc
partprobe /dev/sdd
partprobe /dev/sde
partprobe /dev/sdf


[root@cnlvs119 tmp]# ls -ltr /dev/asm*
brw-rw---- 1 grid asmadmin 8, 49 Dec 23 16:49 /dev/asmdisk1_udev_a1
brw-rw---- 1 grid asmadmin 8, 65 Dec 23 16:49 /dev/asmdisk1_udev_a2
brw-rw---- 1 grid asmadmin 8, 81 Dec 23 16:49 /dev/asmdisk1_udev_a3
brw-rw---- 1 grid asmadmin 8, 33 Dec 23 16:49 /dev/asmdisk1_udev_p1

udev方式的共享磁碟完成

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17086096/viewspace-2072924/,如需轉載,請註明出處,否則將追究法律責任。

相關文章