Linux udev 動態管理Oracle ASM磁碟-實驗
在Red Hat Enterprise Linux (RHEL) 6以前,Oracle都是採用ASMLib包來管理ASM磁碟。但是2011年5月甲骨文發表了一份宣告,宣告中稱Oracle將不再提供Red Hat Enterprise Linux (RHEL) 6的ASMLib包和相關更新。
甲骨文在這份宣告中表示,ASMLib更新將透過Unbreakable Linux Network(ULN)來發布,並僅對Oracle Linux客戶開放。ULN雖然為甲骨文和紅帽的客戶服務,但如果客戶想要使用ASMLib,就必須使用Oracle的kernel來替換掉紅帽的kernel。
本實驗部署Oracle+ASM,不再採用ASMLib,而是採用udev動態管理ASM磁碟。
注意:Linux 核心 2.6以上才支援udev。
虛擬機器:VMware Workstation 9
作業系統:Red Hat Enterprise Linux Server release 5.6
系統核心:2.6.18-238.el5
資料庫:Oracle Database 11.2.0.1
之前已經基於udev的方式建立過ASM磁碟,而且已經安裝好Oracle Grid 、Oracle Database,並建立好了資料庫,接下來將新增4塊1G磁碟,分別擴充套件現有ASM磁碟組DG_DATA,新建ASM磁碟組DG_NEW_DATA。
檢視新新增的磁碟,分別為/dev/sdb、/dev/sdg、/dev/sdh、/dev/sdi。
[root@ora32 dev]# fdisk -l
Disk /dev/sda: 23.6 GB, 23622320128 bytes
255 heads, 63 sectors/track, 2871 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 65 522081 83 Linux
/dev/sda2 66 457 3148740 82 Linux swap / Solaris
/dev/sda3 458 2871 19390455 8e Linux LVM
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 261 2096451 83 Linux
Disk /dev/sdd: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 261 2096451 83 Linux
Disk /dev/sde: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sde1 1 261 2096451 83 Linux
Disk /dev/sdf: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdf1 1 261 2096451 83 Linux
Disk /dev/sdg: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdg doesn't contain a valid partition table
Disk /dev/sdh: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdh doesn't contain a valid partition table
Disk /dev/sdi: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdi doesn't contain a valid partition table
分別對4塊磁碟進行分割槽,每塊磁碟分1個區即可。
[root@ora32 dev]# fdisk -l
Disk /dev/sda: 23.6 GB, 23622320128 bytes
255 heads, 63 sectors/track, 2871 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 65 522081 83 Linux
/dev/sda2 66 457 3148740 82 Linux swap / Solaris
/dev/sda3 458 2871 19390455 8e Linux LVM
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 130 1044193+ 83 Linux
Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 261 2096451 83 Linux
Disk /dev/sdd: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 261 2096451 83 Linux
Disk /dev/sde: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sde1 1 261 2096451 83 Linux
Disk /dev/sdf: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdf1 1 261 2096451 83 Linux
Disk /dev/sdg: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdg1 1 130 1044193+ 83 Linux
Disk /dev/sdh: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdh1 1 130 1044193+ 83 Linux
Disk /dev/sdi: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdi1 1 130 1044193+ 83 Linux
現在需要透過udev來管理這幾個磁碟裝置檔案,透過規則檔案將磁碟對映為固定名稱,並賦予所屬使用者,使用者組,操作許可權等。
檢視udev規則檔案
[root@ora32 dev]# cd /etc/udev/rules.d
[root@ora32 rules.d]# ll
total 248
-rw-r--r-- 1 root root 515 Nov 25 2010 05-udev-early.rules
-rw-r--r-- 1 root root 948 Dec 8 2010 40-multipath.rules
-rw-r--r-- 1 root root 16153 Nov 25 2010 50-udev.rules
-rw-r--r-- 1 root root 163 Dec 11 2010 51-dlm.rules
-rw-r--r-- 1 root root 471 Nov 25 2010 51-hotplug.rules
-rw-r--r-- 1 root root 138 May 10 17:28 55-usm.rules
-rw-r--r-- 1 root root 58016 Oct 13 2006 60-libsane.rules
-rw-r--r-- 1 root root 143 Oct 13 2010 60-net.rules
-rw-r--r-- 1 root root 1088 Jul 18 2006 60-pcmcia.rules
-rw-r--r-- 1 root root 316 Sep 22 2010 60-raw.rules
-rw-r--r-- 1 root root 9175 Nov 13 2010 60-wacom.rules
-rw-r--r-- 1 root root 129 Nov 30 2010 61-uinput-stddev.rules
-rw-r--r-- 1 root root 214 Nov 30 2010 61-uinput-wacom.rules
-rw-r--r-- 1 root root 1823 Sep 19 2008 85-pcscd_ccid.rules
-rw-r--r-- 1 root root 114 Aug 29 2008 90-alsa.rules
-rw-r--r-- 1 root root 61 Nov 25 2010 90-dm.rules
-rw-r--r-- 1 root root 82 Nov 4 2010 90-hal.rules
-rw-r--r-- 1 root root 107 Nov 25 2010 95-pam-console.rules
-rw-r--r-- 1 root root 292 Nov 30 2010 98-kexec.rules
-rw-r--r-- 1 root root 669 May 13 13:51 99-oracle-asmdevices.rules
-rw-r--r-- 1 root root 60 Sep 16 2012 99-oracle.rules
-rw-r--r-- 1 root root 334 Sep 15 2012 99-vmware-scsi-udev.rules
-rw-r--r-- 1 root root 2319 Jul 9 2008 bluetooth.rules
udev規則檔案“99-oracle-asmdevices.rules”之前已經建立好,看一下當前的對映規則和ASM磁碟情況。
[root@ora32 rules.d]# cat 99-oracle-asmdevices.rules
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c29c9a269653c7cd04ea2edb0c71", NAME="ASM_DISK_2G_1", WNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c29861258ebc95eded634a1f36fd", NAME="ASM_DISK_2G_2", WNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c296fd09d9ed213df1999820ca89", NAME="ASM_DISK_2G_3", WNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c2934ae12fd4af0dd366d85b42f5", NAME="ASM_DISK_2G_4", WNER="grid", GROUP="asmadmin", MODE="0660"
規則解釋,以第一條為例。
系統啟動時,udev根據系統匯流排scsi(BUS=="scsi")和核心裝置檔名sd?1(KERNEL=="sd?1"),過濾出需要動態對映的裝置,然後再利用/sbin/scsi_id(PROGRAM=="/sbin/scsi_id")命令輸出的SCSI磁碟id,輸出結果中匹配上"36000c29c9a269653c7cd04ea2edb0c71"的SCSI磁碟,則會應用後續的命名、授權等操作(NAME="ASM_DISK_2G_1", WNER="grid", GROUP="asmadmin", MODE="0660"),SCSI磁碟ID可以透過/sbin/scsi_id命令獲取。
[root@ora32 rules.d]# /sbin/scsi_id -g -s /block/sdc/sdc1
36000c29c9a269653c7cd04ea2edb0c71
[root@ora32 rules.d]# /sbin/scsi_id -g -s /block/sdd/sdd1
36000c29861258ebc95eded634a1f36fd
[root@ora32 rules.d]# /sbin/scsi_id -g -s /block/sde/sde1
36000c296fd09d9ed213df1999820ca89
[root@ora32 rules.d]# /sbin/scsi_id -g -s /block/sdf/sdf1
36000c2934ae12fd4af0dd366d85b42f5
從上述結果可以看出,udev已經做了如下對映關係。
/block/sdc/sdc1 => ASM_DISK_2G_1
/block/sdd/sdd1 => ASM_DISK_2G_2
/block/sde/sde1 => ASM_DISK_2G_3
/block/sdf/sdf1 => ASM_DISK_2G_4
[grid@ora32 dev]$ ll ASM*
brw-rw---- 1 grid asmadmin 8, 33 May 13 14:57 ASM_DISK_2G_1
brw-rw---- 1 grid asmadmin 8, 49 May 13 14:57 ASM_DISK_2G_2
brw-rw---- 1 grid asmadmin 8, 65 May 13 14:54 ASM_DISK_2G_3
brw-rw---- 1 grid asmadmin 8, 81 May 13 14:57 ASM_DISK_2G_4
透過Oracle檢視看一下當前磁碟組、磁碟的使用情況。
[grid@ora32 ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.1.0 Production on Mon May 13 14:54:01 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Automatic Storage Management option
SQL>
SQL>
SQL> col name for a10
SQL> SELECT group_number,name,type,state,total_mb,free_mb,offline_disks FROM V$ASM_diskgroup;
GROUP_NUMBER NAME TYPE STATE TOTAL_MB FREE_MB OFFLINE_DISKS
------------ ---------- ------ ----------- ---------- ---------- -------------
1 DG_DATA EXTERN MOUNTED 8188 6448 0
SQL> col group# for 99
SQL> col disk# for 99
SQL> col name for a5
SQL> col path for a11
SQL> col LABEL for a7
SQL> col FAILGROUP for a10
SQL> select GROUP_NUMBER group#,DISK_NUMBER disk#,LABEL,STATE,FAILGROUP,name,path,TOTAL_MB,FREE_MB from v$asm_disk;
GROUP# DISK# LABEL STATE FAILGROUP NAME PATH TOTAL_MB FREE_MB
------ ----- ------- -------- ---------- ----- ----------- ---------- ----------
1 2 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047 1612
02 TA_00 SK_2G_3
02
1 3 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047 1611
03 TA_00 SK_2G_4
03
1 1 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047 1613
01 TA_00 SK_2G_2
01
GROUP# DISK# LABEL STATE FAILGROUP NAME PATH TOTAL_MB FREE_MB
------ ----- ------- -------- ---------- ----- ----------- ---------- ----------
1 0 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047 1612
00 TA_00 SK_2G_1
00
現將新增的4塊硬碟透過udev對映為需要的裝置檔案,然後將其中2塊增加到ASM磁碟組DG_DATA中,另外2塊則新建一個ASM磁碟組DG_NEW_DATA。
[root@ora32 rules.d]# /sbin/scsi_id -g -s /block/sdb/sdb1
36000c2968513d97eb7cdd25bdbd10600
[root@ora32 rules.d]# /sbin/scsi_id -g -s /block/sdg/sdg1
36000c29682ba5ec7a4c8a189499a89bb
[root@ora32 rules.d]# /sbin/scsi_id -g -s /block/sdh/sdh1
36000c292aa4a4ebbb25d15d2084c01ca
[root@ora32 rules.d]# /sbin/scsi_id -g -s /blokc/sdi/sdi1
新增裝置對映規則
[root@ora32 rules.d]# vi 99-oracle-asmdevices.rules
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c29c9a269653c7cd04ea2edb0c71", NAME="ASM_DISK_2G_1", WNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c29861258ebc95eded634a1f36fd", NAME="ASM_DISK_2G_2", WNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c296fd09d9ed213df1999820ca89", NAME="ASM_DISK_2G_3", WNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c2934ae12fd4af0dd366d85b42f5", NAME="ASM_DISK_2G_4", WNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c2968513d97eb7cdd25bdbd10600", NAME="ASM_DISK_1G_1", WNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c29682ba5ec7a4c8a189499a89bb", NAME="ASM_DISK_1G_2", WNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c292aa4a4ebbb25d15d2084c01ca", NAME="ASM_DISK_1G_3", WNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c29a98ca1bd8a0012e99f992a19d", NAME="ASM_DISK_1G_4", WNER="grid", GROUP="asmadmin", MODE="0660"
如果是第一次配置udev對映關係,需要如下操作。
1、 在目錄/etc/udev/rules.d/中新建99-oracle-asmdevices.rules檔案。
2、配置SCSI 裝置為可信任裝置,配置/etc/scsi_id.config檔案,新增options=-g配置項。
[root@ora32 rules.d]# cat /etc/scsi_id.config
#
# scsi_id configuration
#
# lower or upper case has no affect on the left side. Quotes (") are
# required for spaces in values. Model is the same as the SCSI
# INQUIRY product identification field. Per the SCSI INQUIRY, the vendor
# is limited to 8 bytes, model to 16 bytes.
#
# The first matching line found is used. Short matches match longer ones,
# if you do not want such a match space fill the extra bytes. If no model
# is specified, only the vendor string need match.
#
# ptions=
# vendor=string[,model=string],options=
# some libata drives require vpd page 0x80
vendor="ATA",options=-p 0x80
options=-g
測試udev能否正確對映
[root@ora32 ~]# testudev /block/sdg/sdg1
-bash: testudev: command not found
[root@ora32 ~]# udevtest /block/sdb/sdb1
main: looking at device '/block/sdb/sdb1' from subsystem 'block'
udev_rules_get_name: add symlink 'disk/by-id/scsi-36000c2968513d97eb7cdd25bdbd10600-part1'
udev_rules_get_name: add symlink 'disk/by-path/pci-0000:00:10.0-scsi-0:0:1:0-part1'
run_program: '/lib/udev/vol_id --export /dev/.tmp-8-17'
run_program: '/lib/udev/vol_id' returned with status 4
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c2968513d97eb7cdd25bdbd10600'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c2968513d97eb7cdd25bdbd10600'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c2968513d97eb7cdd25bdbd10600'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c2968513d97eb7cdd25bdbd10600'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c2968513d97eb7cdd25bdbd10600'
run_program: '/sbin/scsi_id' returned with status 0
udev_rules_get_name: rule applied, 'sdb1' becomes 'ASM_DISK_1G_1'
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c2968513d97eb7cdd25bdbd10600'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c2968513d97eb7cdd25bdbd10600'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c2968513d97eb7cdd25bdbd10600'
run_program: '/sbin/scsi_id' returned with status 0
udev_device_event: device '/block/sdb/sdb1' already in database, validate currently present symlinks
udev_node_add: creating device node '/dev/ASM_DISK_1G_1', major = '8', minor = '17', mode = '0660', uid = '503', gid = '504'
udev_node_add: creating symlink '/dev/disk/by-id/scsi-36000c2968513d97eb7cdd25bdbd10600-part1' to '../../ASM_DISK_1G_1'
udev_node_add: creating symlink '/dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:1:0-part1' to '../../ASM_DISK_1G_1'
main: run: 'socket:/org/kernel/udev/monitor'
main: run: '/lib/udev/udev_run_devd'
main: run: 'socket:/org/freedesktop/hal/udev_event'
main: run: '/sbin/pam_console_apply /dev/ASM_DISK_1G_1 /dev/disk/by-id/scsi-36000c2968513d97eb7cdd25bdbd10600-part1 /dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:1:0-part1'
main: run: '/bin/sh -c 'echo 180 >/sys/block/sdb/sdb1/timeout''
[root@ora32 ~]# udevtest /block/sdg/sdg1
main: looking at device '/block/sdg/sdg1' from subsystem 'block'
udev_rules_get_name: add symlink 'disk/by-id/scsi-36000c29682ba5ec7a4c8a189499a89bb-part1'
udev_rules_get_name: add symlink 'disk/by-path/pci-0000:00:10.0-scsi-0:0:6:0-part1'
run_program: '/lib/udev/vol_id --export /dev/.tmp-8-97'
run_program: '/lib/udev/vol_id' returned with status 4
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29682ba5ec7a4c8a189499a89bb'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29682ba5ec7a4c8a189499a89bb'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29682ba5ec7a4c8a189499a89bb'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29682ba5ec7a4c8a189499a89bb'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29682ba5ec7a4c8a189499a89bb'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29682ba5ec7a4c8a189499a89bb'
run_program: '/sbin/scsi_id' returned with status 0
udev_rules_get_name: rule applied, 'sdg1' becomes 'ASM_DISK_1G_2'
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29682ba5ec7a4c8a189499a89bb'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29682ba5ec7a4c8a189499a89bb'
run_program: '/sbin/scsi_id' returned with status 0
udev_device_event: device '/block/sdg/sdg1' already in database, validate currently present symlinks
udev_node_add: creating device node '/dev/ASM_DISK_1G_2', major = '8', minor = '97', mode = '0660', uid = '503', gid = '504'
udev_node_add: creating symlink '/dev/disk/by-id/scsi-36000c29682ba5ec7a4c8a189499a89bb-part1' to '../../ASM_DISK_1G_2'
udev_node_add: creating symlink '/dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:6:0-part1' to '../../ASM_DISK_1G_2'
main: run: 'socket:/org/kernel/udev/monitor'
main: run: '/lib/udev/udev_run_devd'
main: run: 'socket:/org/freedesktop/hal/udev_event'
main: run: '/sbin/pam_console_apply /dev/ASM_DISK_1G_2 /dev/disk/by-id/scsi-36000c29682ba5ec7a4c8a189499a89bb-part1 /dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:6:0-part1'
main: run: '/bin/sh -c 'echo 180 >/sys/block/sdg/sdg1/timeout''
[root@ora32 ~]# udevtest /block/sdh/sdh1
main: looking at device '/block/sdh/sdh1' from subsystem 'block'
udev_rules_get_name: add symlink 'disk/by-id/scsi-36000c292aa4a4ebbb25d15d2084c01ca-part1'
udev_rules_get_name: add symlink 'disk/by-path/pci-0000:00:10.0-scsi-0:0:8:0-part1'
run_program: '/lib/udev/vol_id --export /dev/.tmp-8-113'
run_program: '/lib/udev/vol_id' returned with status 4
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c292aa4a4ebbb25d15d2084c01ca'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c292aa4a4ebbb25d15d2084c01ca'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c292aa4a4ebbb25d15d2084c01ca'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c292aa4a4ebbb25d15d2084c01ca'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c292aa4a4ebbb25d15d2084c01ca'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c292aa4a4ebbb25d15d2084c01ca'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c292aa4a4ebbb25d15d2084c01ca'
run_program: '/sbin/scsi_id' returned with status 0
udev_rules_get_name: rule applied, 'sdh1' becomes 'ASM_DISK_1G_3'
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c292aa4a4ebbb25d15d2084c01ca'
run_program: '/sbin/scsi_id' returned with status 0
udev_device_event: device '/block/sdh/sdh1' already in database, validate currently present symlinks
udev_node_add: creating device node '/dev/ASM_DISK_1G_3', major = '8', minor = '113', mode = '0660', uid = '503', gid = '504'
udev_node_add: creating symlink '/dev/disk/by-id/scsi-36000c292aa4a4ebbb25d15d2084c01ca-part1' to '../../ASM_DISK_1G_3'
udev_node_add: creating symlink '/dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:8:0-part1' to '../../ASM_DISK_1G_3'
main: run: 'socket:/org/kernel/udev/monitor'
main: run: '/lib/udev/udev_run_devd'
main: run: 'socket:/org/freedesktop/hal/udev_event'
main: run: '/sbin/pam_console_apply /dev/ASM_DISK_1G_3 /dev/disk/by-id/scsi-36000c292aa4a4ebbb25d15d2084c01ca-part1 /dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:8:0-part1'
main: run: '/bin/sh -c 'echo 180 >/sys/block/sdh/sdh1/timeout''
[root@ora32 ~]# udevtest /block/sdi/sdi1
main: looking at device '/block/sdi/sdi1' from subsystem 'block'
udev_rules_get_name: add symlink 'disk/by-id/scsi-36000c29a98ca1bd8a0012e99f992a19d-part1'
udev_rules_get_name: add symlink 'disk/by-path/pci-0000:00:10.0-scsi-0:0:9:0-part1'
run_program: '/lib/udev/vol_id --export /dev/.tmp-8-129'
run_program: '/lib/udev/vol_id' returned with status 4
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29a98ca1bd8a0012e99f992a19d'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29a98ca1bd8a0012e99f992a19d'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29a98ca1bd8a0012e99f992a19d'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29a98ca1bd8a0012e99f992a19d'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29a98ca1bd8a0012e99f992a19d'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29a98ca1bd8a0012e99f992a19d'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29a98ca1bd8a0012e99f992a19d'
run_program: '/sbin/scsi_id' returned with status 0
run_program: '/sbin/scsi_id'
run_program: '/sbin/scsi_id' (stdout) '36000c29a98ca1bd8a0012e99f992a19d'
run_program: '/sbin/scsi_id' returned with status 0
udev_rules_get_name: rule applied, 'sdi1' becomes 'ASM_DISK_1G_4'
udev_device_event: device '/block/sdi/sdi1' already in database, validate currently present symlinks
udev_node_add: creating device node '/dev/ASM_DISK_1G_4', major = '8', minor = '129', mode = '0660', uid = '503', gid = '504'
udev_node_add: creating symlink '/dev/disk/by-id/scsi-36000c29a98ca1bd8a0012e99f992a19d-part1' to '../../ASM_DISK_1G_4'
udev_node_add: creating symlink '/dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:9:0-part1' to '../../ASM_DISK_1G_4'
main: run: 'socket:/org/kernel/udev/monitor'
main: run: '/lib/udev/udev_run_devd'
main: run: 'socket:/org/freedesktop/hal/udev_event'
main: run: '/sbin/pam_console_apply /dev/ASM_DISK_1G_4 /dev/disk/by-id/scsi-36000c29a98ca1bd8a0012e99f992a19d-part1 /dev/disk/by-path/pci-0000:00:10.0-scsi-0:0:9:0-part1'
main: run: '/bin/sh -c 'echo 180 >/sys/block/sdi/sdi1/timeout''
重新啟動udev服務
[root@ora32 ~]# /sbin/udevcontrol reload_rules
[root@ora32 ~]# /sbin/start_udev
Starting udev: [ OK ]
檢視一下新對映的磁碟
[root@ora32 ~]# ll /dev/ASM*
brw-rw---- 1 grid asmadmin 8, 17 May 13 15:40 /dev/ASM_DISK_1G_1
brw-rw---- 1 grid asmadmin 8, 97 May 13 15:40 /dev/ASM_DISK_1G_2
brw-rw---- 1 grid asmadmin 8, 113 May 13 15:40 /dev/ASM_DISK_1G_3
brw-rw---- 1 grid asmadmin 8, 129 May 13 15:40 /dev/ASM_DISK_1G_4
brw-rw---- 1 grid asmadmin 8, 33 May 13 15:43 /dev/ASM_DISK_2G_1
brw-rw---- 1 grid asmadmin 8, 49 May 13 15:43 /dev/ASM_DISK_2G_2
brw-rw---- 1 grid asmadmin 8, 65 May 13 15:42 /dev/ASM_DISK_2G_3
brw-rw---- 1 grid asmadmin 8, 81 May 13 15:43 /dev/ASM_DISK_2G_4
透過Oracle檢視檢視一下ASM磁碟情況
[grid@ora32 ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.1.0 Production on Mon May 13 15:42:05 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Automatic Storage Management option
SQL>
SQL> col group# for 99
SQL> col disk# for 99
SQL> col name for a5
SQL> col path for a11
SQL> col LABEL for a7
SQL> col FAILGROUP for a10
SQL> select GROUP_NUMBER group#,DISK_NUMBER disk#,LABEL,STATE,FAILGROUP,name,path,TOTAL_MB,FREE_MB from v$asm_disk;
GROUP# DISK# LABEL STATE FAILGROUP NAME PATH TOTAL_MB FREE_MB
------ ----- ------- -------- ---------- ----- ----------- ---------- ----------
0 0 NORMAL /dev/ASM_DI 0 0
SK_1G_3
0 1 NORMAL /dev/ASM_DI 0 0
SK_1G_2
0 2 NORMAL /dev/ASM_DI 0 0
SK_1G_1
0 3 NORMAL /dev/ASM_DI 0 0
SK_1G_4
GROUP# DISK# LABEL STATE FAILGROUP NAME PATH TOTAL_MB FREE_MB
------ ----- ------- -------- ---------- ----- ----------- ---------- ----------
1 2 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047 1612
02 TA_00 SK_2G_3
02
1 3 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047 1611
03 TA_00 SK_2G_4
03
1 1 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047 1613
01 TA_00 SK_2G_2
GROUP# DISK# LABEL STATE FAILGROUP NAME PATH TOTAL_MB FREE_MB
------ ----- ------- -------- ---------- ----- ----------- ---------- ----------
01
1 0 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047 1612
00 TA_00 SK_2G_1
00
8 rows selected.
此時發現新新增的4塊硬碟,已經可以透過檢視進行查詢,但是FAILGROUP、NAME等屬性為空,因為磁碟還沒有加到ASM磁碟組。ASM是怎麼認到新增加的磁碟?其實它是根據引數檔案中的屬性asm_diskstring自動掃描到的,這個引數是在安裝GRID同時配置ASM時設定的。
SQL> show parameter ASM
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups string
asm_diskstring string /dev/ASM*
asm_power_limit integer 1
asm_preferred_read_failure_groups string
將磁碟ASM_DISK_1G_1、ASM_DISK_1G_2新增到磁碟組DG_DATA中。
SQL> ALTER DISKGROUP DG_DATA ADD disk '/dev/ASM_DISK_1G_1';
Diskgroup altered.
SQL> ALTER DISKGROUP DG_DATA ADD disk '/dev/ASM_DISK_1G_2';
Diskgroup altered.
新建磁碟組DG_NEW_DATA,將ASM_DISK_1G_3、ASM_DISK_1G_4新增到磁碟組中。
SQL> CREATE DISKGROUP DG_NEW_DATA external REDUNDANCY DISK '/dev/ASM_DISK_1G_3','/dev/ASM_DISK_1G_4';
Diskgroup created.
透過Oracle 檢視檢視一下新增ASM磁碟組、ASM磁碟的情況
SQL> col name for a10
SQL> SELECT group_number,name,type,state,total_mb,free_mb,offline_disks FROM V$ASM_diskgroup;
GROUP_NUMBER NAME TYPE STATE TOTAL_MB FREE_MB OFFLINE_DISKS
------------ ---------- ------ ----------- ---------- ---------- -------------
1 DG_DATA EXTERN MOUNTED 10226 8482 0
2 DG_NEW_DAT EXTERN MOUNTED 2038 1986 0
A
SQL> select GROUP_NUMBER group#,DISK_NUMBER disk#,LABEL,STATE,FAILGROUP,name,path,TOTAL_MB,FREE_MB from v$asm_disk;
GROUP# DISK# LABEL STATE FAILGROUP NAME PATH TOTAL_MB
---------- ----- ------- -------- ---------- ----- ----------- ----------
FREE_MB
----------
1 2 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047
02 TA_00 SK_2G_3
02
1697
1 3 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047
03 TA_00 SK_2G_4
03
1697
GROUP# DISK# LABEL STATE FAILGROUP NAME PATH TOTAL_MB
---------- ----- ------- -------- ---------- ----- ----------- ----------
FREE_MB
----------
1 1 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047
01 TA_00 SK_2G_2
01
1699
1 0 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047
00 TA_00 SK_2G_1
00
GROUP# DISK# LABEL STATE FAILGROUP NAME PATH TOTAL_MB
---------- ----- ------- -------- ---------- ----- ----------- ----------
FREE_MB
----------
1697
2 0 NORMAL DG_NEW_DAT DG_NE /dev/ASM_DI 1019
A_0000 W_DAT SK_1G_3
A_000
0
994
1 5 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 1019
GROUP# DISK# LABEL STATE FAILGROUP NAME PATH TOTAL_MB
---------- ----- ------- -------- ---------- ----- ----------- ----------
FREE_MB
----------
05 TA_00 SK_1G_2
05
846
1 4 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 1019
04 TA_00 SK_1G_1
04
846
GROUP# DISK# LABEL STATE FAILGROUP NAME PATH TOTAL_MB
---------- ----- ------- -------- ---------- ----- ----------- ----------
FREE_MB
----------
2 1 NORMAL DG_NEW_DAT DG_NE /dev/ASM_DI 1019
A_0001 W_DAT SK_1G_4
A_000
1
992
8 rows selected.
根據實驗要求4塊硬碟新增完畢,接下來將硬碟ASM_DISK_1G_1、ASM_DISK_1G_2從ASM磁碟組DG_DATA中刪除,然後將udev對映規則刪除。
SQL> ALTER DISKGROUP DG_DATA DROP DISK DG_DATA_0004;
Diskgroup altered.
SQL> ALTER DISKGROUP DG_DATA DROP DISK DG_DATA_0005;
Diskgroup altered.
SQL> col group# for 99
SQL> col disk# for 99
SQL> col name for a5
SQL> col path for a11
SQL> col LABEL for a7
SQL> col FAILGROUP for a10
SQL> select GROUP_NUMBER group#,DISK_NUMBER disk#,LABEL,STATE,FAILGROUP,name,path,TOTAL_MB,FREE_MB from v$asm_disk;
GROUP# DISK# LABEL STATE FAILGROUP NAME PATH TOTAL_MB FREE_MB
------ ----- ------- -------- ---------- ----- ----------- ---------- ----------
0 0 NORMAL /dev/ASM_DI 0 0
SK_1G_2
0 1 NORMAL /dev/ASM_DI 0 0
SK_1G_1
1 2 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047 1612
02 TA_00 SK_2G_3
02
1 3 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047 1611
GROUP# DISK# LABEL STATE FAILGROUP NAME PATH TOTAL_MB FREE_MB
------ ----- ------- -------- ---------- ----- ----------- ---------- ----------
03 TA_00 SK_2G_4
03
1 1 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047 1614
01 TA_00 SK_2G_2
01
1 0 NORMAL DG_DATA_00 DG_DA /dev/ASM_DI 2047 1611
00 TA_00 SK_2G_1
00
GROUP# DISK# LABEL STATE FAILGROUP NAME PATH TOTAL_MB FREE_MB
------ ----- ------- -------- ---------- ----- ----------- ---------- ----------
2 0 NORMAL DG_NEW_DAT DG_NE /dev/ASM_DI 1019 994
A_0000 W_DAT SK_1G_3
A_000
0
2 1 NORMAL DG_NEW_DAT DG_NE /dev/ASM_DI 1019 992
A_0001 W_DAT SK_1G_4
A_000
1
8 rows selected.
[root@ora32 ~]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c29c9a269653c7cd04ea2edb0c71", NAME="ASM_DISK_2G_1", WNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c29861258ebc95eded634a1f36fd", NAME="ASM_DISK_2G_2", WNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c296fd09d9ed213df1999820ca89", NAME="ASM_DISK_2G_3", WNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c2934ae12fd4af0dd366d85b42f5", NAME="ASM_DISK_2G_4", WNER="grid", GROUP="asmadmin", MODE="0660"
#KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
#RESULT=="36000c2968513d97eb7cdd25bdbd10600", NAME="ASM_DISK_1G_1", WNER="grid", GROUP="asmadmin", MODE="0660"
#KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
#RESULT=="36000c29682ba5ec7a4c8a189499a89bb", NAME="ASM_DISK_1G_2", WNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c292aa4a4ebbb25d15d2084c01ca", NAME="ASM_DISK_1G_3", WNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id",
RESULT=="36000c29a98ca1bd8a0012e99f992a19d", NAME="ASM_DISK_1G_4", WNER="grid", GROUP="asmadmin", MODE="0660"
重新啟動udev
[root@ora32 dev]# /sbin/udevcontrol reload_rules
[root@ora32 dev]# /sbin/start_udev
Starting udev: [ OK ]
檢視一下dev下的裝置,發現仍然存在/dev/ASM_DISK_1G_1,/dev/ASM_DISK_1G_2
[root@ora32 dev]# ll /dev/ASM*
brw-rw---- 1 grid asmadmin 8, 17 May 13 16:15 /dev/ASM_DISK_1G_1
brw-rw---- 1 grid asmadmin 8, 97 May 13 16:15 /dev/ASM_DISK_1G_2
brw-rw---- 1 grid asmadmin 8, 113 May 13 16:38 /dev/ASM_DISK_1G_3
brw-rw---- 1 grid asmadmin 8, 129 May 13 16:37 /dev/ASM_DISK_1G_4
brw-rw---- 1 grid asmadmin 8, 33 May 13 16:38 /dev/ASM_DISK_2G_1
brw-rw---- 1 grid asmadmin 8, 49 May 13 16:38 /dev/ASM_DISK_2G_2
brw-rw---- 1 grid asmadmin 8, 65 May 13 16:38 /dev/ASM_DISK_2G_3
brw-rw---- 1 grid asmadmin 8, 81 May 13 16:37 /dev/ASM_DISK_2G_4
不知道是何原因。將資料庫例項和ASM例項都停掉後,重新啟動udev服務後發現dev下仍然存在/dev/ASM_DISK_1G_1,/dev/ASM_DISK_1G_2,透過udevinfo查詢發現已經在udev不存在記錄。
[root@ora32 dev]# udevinfo -q path -n /dev/ASM_DISK_1G_1
no record for 'ASM_DISK_1G_1' in database
[root@ora32 dev]# udevinfo -q path -n /dev/ASM_DISK_1G_2
no record for 'ASM_DISK_1G_2' in database
[root@ora32 dev]#
[root@ora32 dev]# udevinfo -q path -n /dev/ASM_DISK_1G_3
/block/sdh/sdh1
在網上查閱了資料,並未找到解決/dev/ASM_DISK_1G_1,/dev/ASM_DISK_1G_2為什麼仍然存在的原因,繼續跟蹤這個問題。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25462274/viewspace-1472948/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- linux vdo驗證 oracle asm diskgroup sector_size 4096 udev asmlibLinuxOracleASMdev
- 使用udev擴充套件ASM磁碟組dev套件ASM
- 如何檢視Oracle RAC的asm磁碟的udev對應關係OracleASMdev
- Oracle Linux 7.8 多路徑(Multipath)+Udev繫結磁碟OracleLinuxdev
- 使用 udev 高效、動態地管理 Linux 裝置檔案devLinux
- 使用udev高效、動態的管理Linux裝置檔案devLinux
- 12C__單機安裝Grid+Oracle的方法,ASM使用UDEV進行磁碟繫結OracleASMdev
- 【ASM】Oracle asm刪除磁碟組注意事項ASMOracle
- 【ASM】Oracle asm磁碟被格式化,如何掛載該磁碟組ASMOracle
- ORACLE ASM磁碟組空間溢位OracleASM
- Oracle RAC日常運維-ASM磁碟擴容Oracle運維ASM
- Oracle ASM磁碟組擴容(AIX7.1)OracleASMAI
- ORACLE ASM的SSD磁碟空間回收分析OracleASM
- Oracle asm磁碟損壞異常恢復OracleASM
- 【BUILD_ORACLE】使用ASMLib包搭建ASM磁碟UIOracleASM
- Oracle Linux 7使用syslog來管理Oracle ASM的審計檔案OracleLinuxASM
- Oracle RAC環境下ASM磁碟組擴容OracleASM
- Oracle資料庫 ASM磁碟線上擴容Oracle資料庫ASM
- Linux磁碟管理Linux
- Linux 磁碟管理Linux
- 關於Oracle 10g ASM磁碟大小的限制Oracle 10gASM
- Oracle Linux 7使用cron來管理Oracle ASM審計檔案目錄的增長OracleLinuxASM
- ASM磁碟組限制ASM
- Oracle RAC ASM磁碟組擴容時遇到的VIP漂移OracleASM
- linux之磁碟管理Linux
- Linux 磁碟操作管理Linux
- Linux上建立udevLinuxdev
- 遷移ASM磁碟組ASM
- Linux系統磁碟管理Linux
- 【ASM】ASM磁碟頭被重寫,如何修復ASM
- 從定位資料塊所在ASM磁碟到ASM strippingASM
- Linux指令入門-磁碟管理Linux
- ASM磁碟組更換磁碟的操作方法ASM
- 【ARCH】Oracle 判斷asm磁碟組大小,超過閾值清理指令碼OracleASM指令碼
- 【實操案例】Linux磁碟管理常用的三個命令!Linux
- Linux 筆記分享六:磁碟管理Linux筆記
- 配置rip動態路由實驗路由
- oracle RAC+DG 擴容ASM和表空間(Linux)OracleASMLinux
- Oracle 11gR2 ASM例項記憶體管理OracleASM記憶體