【转】CentOS/RHEL/OracleLinux使用UDEV配置ASMDISK

转自:http://blog.csdn.net/staricqxyz/article/details/8332566

 

RHEL 5 / CentOS 5 / Oracle Linux 5

[root@vmt ~]# cat /etc/issue  
 Oracle Linux Server release 5.7  
 Kernel \r on an \m  
    
[root@vmt ~]# uname -p  
 x86_64  
[root@vmt ~]# scsi_id -g -u -s /block/sdb  
SATA_VBOX_HARDDISK_VBf5fa9817-60df9544_  
[root@vmt ~]# scsi_id -g -u -s /block/sdc  
SATA_VBOX_HARDDISK_VB3a608c6d-857258c2_  
[root@vmt ~]# scsi_id -g -u -s /block/sdd  
SATA_VBOX_HARDDISK_VB3e117166-7159170a_  
[root@vmt ~]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules  
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VBf5fa9817-60df9544_", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"  
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB3a608c6d-857258c2_", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"  
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB3e117166-7159170a_", NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"  
[root@vmt ~]# start_udev   
Starting udev:                                             [  OK  ]  
[root@vmt ~]# ls -l /dev/asm-disk*  
brw-rw---- 1 grid asmadmin 8, 16 Dec 19 08:49 /dev/asm-diskb  
brw-rw---- 1 grid asmadmin 8, 32 Dec 19 08:49 /dev/asm-diskc  
brw-rw---- 1 grid asmadmin 8, 48 Dec 19 08:49 /dev/asm-diskd 
[root@vmt ~]# fdisk /dev/sdb   
  
Command (m for help): n  
Command action  
   e   extended  
   p   primary partition (1-4)  
p  
Partition number (1-4): 1  
First cylinder (1-130, default 1):   
Using default value 1  
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130): +512M  
  
Command (m for help): p  
  
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          63      506016   83  Linux  
  
Command (m for help): n  
Command action  
   e   extended  
   p   primary partition (1-4)  
p  
Partition number (1-4): 2  
First cylinder (64-130, default 64):   
Using default value 64  
Last cylinder or +size or +sizeM or +sizeK (64-130, default 130):   
Using default value 130  
  
Command (m for help): p  
  
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          63      506016   83  Linux  
/dev/sdb2              64         130      538177+  83  Linux  
  
Command (m for help): w  
The partition table has been altered!  
  
Calling ioctl() to re-read partition table.  
Syncing disks.  
[root@vmt ~]# ls -l /dev/sdb*  
brw-r----- 1 root disk 8, 16 Dec 19 09:12 /dev/sdb  
brw-r----- 1 root disk 8, 17 Dec 19 09:12 /dev/sdb1  
brw-r----- 1 root disk 8, 18 Dec 19 09:12 /dev/sdb2  
[root@vmt ~]# cat /etc/udev/rules.d/60-raw.rules  
# Enter raw device bindings here.  
#  
# An example would be:  
#   ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"  
# to bind /dev/raw/raw1 to /dev/sda, or  
#   ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"  
# to bind /dev/raw/raw2 to the device with major 8, minor 1.  
ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"  
ACTION=="add", KERNEL=="sdb2", RUN+="/bin/raw /dev/raw/raw2 %N"  
ACTION=="add", KERNEL=="raw*", OWNER=="oracle", GROUP=="oinstall", MODE=="0660"  
[root@vmt ~]# start_udev  
Starting udev:                                             [  OK  ]  
[root@vmt ~]# ls -l /dev/raw/raw*  
crw-rw---- 1 oracle oinstall 162, 1 Dec 19 09:31 /dev/raw/raw1  
crw-rw---- 1 oracle oinstall 162, 2 Dec 19 09:31 /dev/raw/raw2  
[root@vmt ~]# ls -l /dev/asm-disk*  
brw-rw---- 1 grid asmadmin 8, 32 Dec 19 09:11 /dev/asm-diskc  
brw-rw---- 1 grid asmadmin 8, 48 Dec 19 09:11 /dev/asm-diskd  

RHEL 6 / CentOS 6 / Oracle Linux 6

[root@vmol6 ~]# cat /etc/issue  
Oracle Linux Server release 6.3  
Kernel \r on an \m  
  
[root@vmol6 ~]# uname -p  
x86_64  
[root@vmol6 ~]# scsi_id -g -u -d /dev/sdb  
1ATA_VBOX_HARDDISK_VB3a217fd5-b0e5b939  
[root@vmol6 ~]# scsi_id -g -u -d /dev/sdc  
1ATA_VBOX_HARDDISK_VBebf4c4a8-ce363f12  
[root@vmol6 ~]# scsi_id -g -u -d /dev/sdd  
1ATA_VBOX_HARDDISK_VB70f61801-584899be  
[root@vmol6 ~]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules   
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB3a217fd5-b0e5b939", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"  
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VBebf4c4a8-ce363f12", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"  
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB70f61801-584899be", NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"  
[root@vmol6 ~]# start_udev   
Starting udev:                                             [  OK  ]  
[root@vmol6 ~]# ls -l /dev/asm-disk*  
brw-rw----. 1 grid asmadmin 8, 16 Dec 19 04:02 /dev/asm-diskb  
brw-rw----. 1 grid asmadmin 8, 32 Dec 19 04:02 /dev/asm-diskc  
brw-rw----. 1 grid asmadmin 8, 48 Dec 19 04:02 /dev/asm-diskd  

 

posted @ 2015-07-10 15:47  艾阳君  阅读(302)  评论(0编辑  收藏  举报