1) Here I use the RHEL6 iscsi-target server to share a logical volume to host rac1.example.com, then this host find this device as /dev/sdb.
[root@rac1 ~]# service iscsi status
iSCSI Transport Class version 2.0-870
version 2.0-872.41.el6
Target: iqn.2013-03-26.com.example.racsd:rac-sharedisk
Current Portal: 172.16.51.233:3260,1
Persistent Portal: 172.16.51.233:3260,1
**********
Interface:
**********
Iface Name: default
Iface Transport: tcp
Iface Initiatorname: iqn.1994-05.com.redhat:e0dacf9722c9
Iface IPaddress: 172.16.51.213
Iface HWaddress: <empty>
Iface Netdev: <empty>
SID: 1
iSCSI Connection State: LOGGED IN
iSCSI Session State: LOGGED_IN
Internal iscsid Session State: NO CHANGE
*********
Timeouts:
*********
Recovery Timeout: 120
Target Reset Timeout: 30
LUN Reset Timeout: 30
Abort Timeout: 15
*****
CHAP:
*****
username: <empty>
password: ********
username_in: <empty>
password_in: ********
************************
Negotiated iSCSI params:
************************
HeaderDigest: None
DataDigest: None
MaxRecvDataSegmentLength: 262144
MaxXmitDataSegmentLength: 8192
FirstBurstLength: 65536
MaxBurstLength: 262144
ImmediateData: Yes
InitialR2T: Yes
MaxOutstandingR2T: 1
************************
Attached SCSI devices:
************************
Host Number: 3 State: running
scsi3 Channel 00 Id 0 Lun: 0
scsi3 Channel 00 Id 0 Lun: 1
Attached scsi disk sdb State: running
[root@rac1 ~]# fdisk -l /dev/sdb
Disk /dev/sdb: 42.6 GB, 42630905856 bytes
255 heads, 63 sectors/track, 5182 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: 0x8a47beba
Device Boot Start End Blocks Id System
/dev/sdb1 1 5182 41624383+ 5 Extended
/dev/sdb5 1 262 2104452 83 Linux
/dev/sdb6 263 524 2104483+ 83 Linux
/dev/sdb7 525 786 2104483+ 83 Linux
/dev/sdb8 787 3137 18884376 83 Linux
/dev/sdb9 3138 5182 16426431 83 Linux
2)Then use the command below to bound the five partitions of /dev/sdb to local as asm-disk.
@@@method 1
[root@rac1 ~]# cat generate_udev.sh
#!/bin/sh
rm -rf /etc/udev/rules.d/99-oracle-asmdevices.rules
for i in 5 6 7 8 9
do
echo "KERNEL==\"sdb$i\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$parent\", RESULT==\"`scsi_id --whitelisted --replace-whitespace --device=/dev/sdb`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\" " >> /etc/udev/rules.d/99-oracle-asmdevices.rules
done
@@@method 2
[root@rac1 ~]# cat generate_udev.sh
#!/bin/sh
cat > /etc/udev/rules.d/99-oracle-asmdevices.rules <<EUDEV
KERNEL=="sdb5", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$parent", RESULT=="`scsi_id --whitelisted --replace-whitespace --device=/dev/sdb`", NAME="asm-disk5", OWNER="grid", GROUP="asmadmin", MODE="0660""
KERNEL=="sdb6", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$parent", RESULT=="`scsi_id --whitelisted --replace-whitespace --device=/dev/sdb`", NAME="asm-disk6", OWNER="grid", GROUP="asmadmin", MODE="0660""
KERNEL=="sdb7", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$parent", RESULT=="`scsi_id --whitelisted --replace-whitespace --device=/dev/sdb`", NAME="asm-disk7", OWNER="grid", GROUP="asmadmin", MODE="0660""
KERNEL=="sdb8", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$parent", RESULT=="`scsi_id --whitelisted --replace-whitespace --device=/dev/sdb`", NAME="asm-disk8", OWNER="grid", GROUP="asmadmin", MODE="0660""
KERNEL=="sdb9", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$parent", RESULT=="`scsi_id --whitelisted --replace-whitespace --device=/dev/sdb`", NAME="asm-disk9", OWNER="grid", GROUP="asmadmin", MODE="0660""
EUDEV
[root@rac1 ~]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sdb5", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$parent", RESULT=="1IET_00010001", NAME="asm-disk5", OWNER="grid", GROUP="asmadmin", MODE="0660""
KERNEL=="sdb6", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$parent", RESULT=="1IET_00010001", NAME="asm-disk6", OWNER="grid", GROUP="asmadmin", MODE="0660""
KERNEL=="sdb7", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$parent", RESULT=="1IET_00010001", NAME="asm-disk7", OWNER="grid", GROUP="asmadmin", MODE="0660""
KERNEL=="sdb8", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$parent", RESULT=="1IET_00010001", NAME="asm-disk8", OWNER="grid", GROUP="asmadmin", MODE="0660""
KERNEL=="sdb9", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$parent", RESULT=="1IET_00010001", NAME="asm-disk9", OWNER="grid", GROUP="asmadmin", MODE="0660""
3) after edit /etc/udev/rules.d, please reboot operation system. Then check the results. for more information referecing "RHCA 436"
[root@rac1 ~]# ll /dev/asm*
brw-rw---- 1 grid asmadmin 8, 21 Apr 1 14:09 /dev/asm-disk5
brw-rw---- 1 grid asmadmin 8, 22 Apr 1 14:09 /dev/asm-disk6
brw-rw---- 1 grid asmadmin 8, 23 Apr 1 14:09 /dev/asm-disk7
brw-rw---- 1 grid asmadmin 8, 24 Apr 1 14:09 /dev/asm-disk8
brw-rw---- 1 grid asmadmin 8, 25 Apr 1 14:09 /dev/asm-disk9
4)Here is another way to bound multi disk.But I do not recommand use so many disk.
for i in b c d e f g ;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\"" >> /etc/udev/rules.d/99-oracle-asmdevices.rules
done
转载于:https://blog.51cto.com/majesty/1168411