Beruflich Dokumente
Kultur Dokumente
partner-pub-99011
FORID:10
UTF-8
Background
Background
Essentially, what udev does is apply rules defined in files in the "/etc/udev/rules.d"
directory to the device nodes listed in the "/dev" directory. The rules can be defined in a
variety of ways, but what we need to do is identify the device and say what we want
udev to do with it.
In this case I know all my disk devices are named "/dev/sd?1", where the "?" represents
a letter from a-d, so I can identify the devices of interest using the following rule
parameters.
KERNEL=="sd?1", BUS=="scsi"
I want to tie each specific device to an alias, so it is always identified the same way,
regardless of the device name Linux assigns it. So I need to be able to test each device
that matches the previous pattern to see if it is the disk I am interested in. Each disk has
a unique SCSI ID, so I can place a test into the rule, telling it how to perform the test,
and the result it should return for a positive match. The following rule parameters explain
how to test the device and what result constitutes a match in Oracle Linux 5.
PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent",
RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_"
The scsi_id command works a little differently in Oracle Linux 6, so for that the following
test works better.
PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent",
RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_"
The scsi_id command is located in a different place in Oracle Linux 7, so for that the
following test is correct.
PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent",
RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_"
Once we have identified the specific device of interest, we need to indicate what actions
should be performed on it. The following parameters specify an alias, the ownership and
the permissions for the device.
NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
So the whole rule for each disk will look something like this in Oracle Linux 5.
This means that the device pointing to the partition "sd*1" on the disk with the SCSI ID
of "SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_" will always be called "/dev/asmdisk1", regardless of the letter "?" Linux assigns when the device is discovered. In
addition, the device will have the correct ownership and permissions for ASM.
There are a number of wildcards and matching patterns that can be used if you don't
want to write device-specific rules.
Now we know roughly what we are trying to achieve, we will look at each step
necessary for setting up the disks for ASM to use.
SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_
# /sbin/scsi_id -g -u -s /block/sdd
SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172_
# /sbin/scsi_id -g -u -s /block/sde
SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_
#
The "-s" is not available in Oracle Linux 6, so you must use the following syntax.
# /sbin/scsi_id -g -u -d /dev/sdb
SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_
# /sbin/scsi_id -g -u -d /dev/sdc
SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_
# /sbin/scsi_id -g -u -d /dev/sdd
SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172_
# /sbin/scsi_id -g -u -d /dev/sde
SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_
#
The location of the scsi_id command has changed in Oracle Linux 7, so you must use
the following syntax.
# /usr/lib/udev/scsi_id -g -u -d /dev/sdb
SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_
# /usr/lib/udev/scsi_id -g -u -d /dev/sdc
SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_
# /usr/lib/udev/scsi_id -g -u -d /dev/sdd
SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172_
# /usr/lib/udev/scsi_id -g -u -d /dev/sde
SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_
#
The file should contain the following lines for Oracle Linux 5. The PROGRAM parameter
must match the command you used to retrieve the SCSI ID, and the RESULT parameter
must match the value returned from your disks.
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/
$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_",
NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/
$parent", RESULT=="SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_",
NAME="asm-disk2", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/
$parent", RESULT=="SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172_",
NAME="asm-disk3", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/
$parent", RESULT=="SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_",
NAME="asm-disk4", OWNER="oracle", GROUP="dba", MODE="0660"
# #OL5
# udevtest /block/sdb/sdb1
# udevtest /block/sdc/sdc1
# udevtest /block/sdd/sdd1
# udevtest /block/sde/sde1
The output from the first disk should look something like this.
# udevtest /block/sdb/sdb1
main: looking at device '/block/sdb/sdb1' from subsystem 'block'
udev_rules_get_name: add symlink 'disk/by-id/scsiSATA_VBOX_HARDDISK_VBd306dbe0-df3367e3-part1'
udev_rules_get_name: add symlink 'disk/by-path/pci-0000:00:0d.0-scsi-1:0:0:0part1'
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 -g -u -s /block/sdb/sdb1'
run_program: '/sbin/scsi_id' (stdout) 'SATA_VBOX_HARDDISK_VBd306dbe0df3367e3_'
run_program: '/sbin/scsi_id' returned with status 0
udev_rules_get_name: rule applied, 'sdb1' becomes 'asm-disk1'
udev_device_event: device '/block/sdb/sdb1' already in database, validate
currently present symlinks
udev_node_add: creating device node '/dev/asm-disk1', major = '8', minor =
'17', mode = '0660', uid = '1100', gid = '1200'
udev
Home
ABOUT
CommentsPosts
Weicheng Zhong
U
si
n
g
R
M
A
N
3
2
bi
t
to
6
4
bi
t
m
ig
ra
ti
o
n
Tr
a
n
s
p
or
ta
bl
e
D
at
a
b
a
s
e
O
ra
cl
e
In
Oracle ASM on
RHEL 6 with udev
and multipath
NoSQL
(15)
o
As the root user, install the devicemapper-multipath package using the yum
package manager
M
o
n
g
o
D
B
(1
4)
R
e
di
s
(1
)
SCRIPTS
st
al
l
In
st
a
nt
Ci
le
nt
R
M
A
N
Di
sk
b
a
ck
u
p
s
R
e
st
or
e
of
R
A
C
D
at
a
b
a
s
e
to
Si
n
gl
e
In
st
a
n
c
e
C
e
nt
O
1ATA_VBOX_HARDDISK_VB7282bfc8-69601726
1ATA_VBOX_HARDDISK_VBa0072176-9e9ab0a0
1ATA_VBOX_HARDDISK_VB2a7b18e2-04053806
1ATA_VBOX_HARDDISK_VB40939671-89967d5e
1ATA_VBOX_HARDDISK_VB664cb850-2065525c
1ATA_VBOX_HARDDISK_VBa498ea69-53cdb110
[root@vzwc2 ~]#
(7)
(41)
o
AI
X
(3
)
H
PU
X
(2
)
Li
n
u
x
(3
3)
S
ol
ar
is
(6
)
W
in
d
o
w
s
(2
)
S
6
in
st
al
la
ti
o
n
P
er
c
o
n
a
To
k
u
d
b
O
ra
cl
e
R
e
d
o
L
o
g
M
y
S
Q
L
E
nt
er
pr
is
e
M
o
ni
to
r
S
h
ocrvotedisk3
path_grouping_policy
multibus
path_selector
"roundrobin 0"
failback
immediate
rr_weight
priorities
no_path_retry
5
}
multipath {
wwid
1ATA_VBOX_HARDDISK_VB7282bfc8-69601726
alias
ocrvotedisk4
path_grouping_policy
multibus
path_selector
"roundrobin 0"
failback
immediate
rr_weight
priorities
no_path_retry
5
}
multipath {
wwid
1ATA_VBOX_HARDDISK_VBa0072176-9e9ab0a0
alias
ocrvotedisk5
path_grouping_policy
multibus
path_selector
"roundrobin 0"
failback
immediate
rr_weight
priorities
no_path_retry
5
}
multipath {
wwid
1ATA_VBOX_HARDDISK_VB2a7b18e2-04053806
alias
data1
path_grouping_policy
multibus
path_selector
"roundrobin 0"
failback
immediate
rr_weight
priorities
no_path_retry
5
}
multipath {
wwid
1ATA_VBOX_HARDDISK_VB40939671-89967d5e
alias
data2
path_grouping_policy
multibus
path_selector
"roundrobin 0"
failback
immediate
rr_weight
priorities
no_path_retry
5
}
multipath {
wwid
1ATA_VBOX_HARDDISK_VB664cb850-2065525c
alias
fra1
(202)
o
D
B
2
(5
)
G
re
e
n
Pl
u
m
D
at
a
b
as
e
(1
0)
M
y
S
Q
L
(4
o
w
Vi
e
w
W
hi
c
h
V
er
si
o
n
s
of
M
y
S
Q
L
S
er
v
er
ar
e
C
o
m
p
at
ib
le
wi
th
M
y
S
Q
L
E
nt
er
pr
is
e
B
a
ck
u
p
M
path_grouping_policy
multibus
path_selector
"roundrobin 0"
failback
immediate
rr_weight
priorities
no_path_retry
5
}
multipath {
wwid
1ATA_VBOX_HARDDISK_VBa498ea69-53cdb110
alias
fra2
path_grouping_policy
multibus
path_selector
"roundrobin 0"
failback
immediate
rr_weight
priorities
no_path_retry
5
}
}
7)
O
ra
cl
e
(1
4
0)
o
n
g
o
D
B
G
ri
d
F
S
m
o
n
g
o
d
b
b
a
ck
u
p
s
h
el
l
sc
ri
pt
s
m
o
n
g
o
d
b
My
CSDN
P
os
tg
re
blog
SYKSKY
Luocs
Technolo
gy Blog
hedengc
heng
ryviuske
y
AnySQL
mysqlop
s
osdba's
blog
ryviuske
y
linuxeye
NoSQL
huoding
ha97
leshami
wmxz
TianYi
debugo
S
Q
L
(4
)
S
Q
L
S
er
v
er
(1
)
2016
2016
2016
2015
2015
2015
2015
2015
2015
gavinsoo
rma
askdba.o
rg
Oracle
MAA us
Oracle
MAA zh
Oracle
OTN
SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="ocrvotedisk4", OWNER:="grid",
GROUP:="asmadmin", MODE:="660",
SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="ocrvotedisk5", OWNER:="grid",
GROUP:="asmadmin", MODE:="660",
SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="data1", OWNER:="grid",
GROUP:="asmadmin", MODE:="660",
SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="data2", OWNER:="grid",
GROUP:="asmadmin", MODE:="660",
SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="fra1", OWNER:="grid",
GROUP:="asmadmin", MODE:="660",
SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="fra2", OWNER:="grid",
GROUP:="asmadmin", MODE:="660",
SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
Oracle
Tech
Index
Oracle
12c
notes
OraDBA
dioncho
ixora
oraclebase
oracledevelope
r
database
journal
djuliandy
ke blog
jonathan
16:35
16:35
2015
2015
2015
2015
2015
2015
2014
2014
2014
2014
2014
2014
2014
2014
2014
16:35
16:35
16:35
16:35
16:35
16:35
16:35
lewis
Tanelpod
er
idevelop
ment
Oracle
Technolo
gy
Network
oracledb
a.org
mysqlinn
odb blog
Chirs
MySQL
Oracle's
MySQL
Blog
Archivelog ASM
CentOS6 cvu
database
DataGuard
DataPump DB2
DB2 installation
db2move
dbms_backup_restor
e dbms_metadata
drop database emcli
Flashback Galera
GreenPlum
Database
HP-UX InnoDB java
Linux
logminer memcache
MiddleWare
MongoDB
MOS MySQ
MySQL
MySQL5.6
MySQL5.7
MySQL
backup
recovery
MySQL
Cluster MySQL
GreenPlu
mDBA
Enterprise Monitor
MySQL MMM
scripting
mysql
RONALD
BRADFO
RD
Martins
Blog
oraclescripts
Kamran
MySQL MHA
MySQL
Replication
MySQL scripts
Oracle
oracle client
Oracle
GoldenGa
te Oracle
internal
Oracle
scripts OS
Agayev's
Percona Server
PostgreSQL
PSU pymongo
MariaDB
Spider
Storage
RAC Redis
RHEL7
secaserv
er blog
silent Solaris
sqlplus SQL Server
squid SuSE swap
TAF tokudb
pythian
blog
Troubleshoo
ting UNIX
sql
Coskan's
blog
postgres
qltutorial
datachar
mer
mysql
NoSQL
ARCHIVE
Jilevski's
Oracle
BLOG
Linux
pkgs
severalni
nes
Spider
for
MySQL
mysql
step-bystep
MySQL
RMAN
samba SCRIPTS
##
1. ONLINE
1374f266ca874f15bfde7ca23d073e5f
(/dev/mapper/ocrvotedisk1) [CRSDG]
2. ONLINE
4145a926ff0d4f6dbf63e2c3695c580e
(/dev/mapper/ocrvotedisk2) [CRSDG]
3. ONLINE
6f3ab4bbe0c14f97bfb20c91820d898b
(/dev/mapper/ocrvotedisk3) [CRSDG]
4. ONLINE
8c973dd3f1da4f0dbf2080e04fcf9bd7
(/dev/mapper/ocrvotedisk4) [CRSDG]
5. ONLINE
1bed4a3c6f624fabbfbe2564e81df250
High
Availabili
ty
(/dev/mapper/ocrvotedisk5) [CRSDG]
Located 5 voting disk(s).
[grid@vzwc2 ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Wed Sep
24 17:17:22 2014
Copyright (c) 1982, 2013, Oracle.
reserved.
All rights
Connected to:
Oracle Database 11g Enterprise Edition Release
11.2.0.4.0 64bit Production
With the Real Application Clusters and Automatic
Storage Management options
SQL> select * from v$active_instances;
INST_NUMBER INST_NAME
1 vzwc1:+ASM1
2 vzwc2:+ASM2
SQL> select path from v$asm_disk;
PATH
/dev/mapper/data2
/dev/mapper/fra2
/dev/mapper/fra1
/dev/mapper/data1
/dev/mapper/ocrvotedisk2
/dev/mapper/ocrvotedisk3
/dev/mapper/ocrvotedisk1
/dev/mapper/ocrvotedisk4
/dev/mapper/ocrvotedisk5
9 rows selected.