码迷,mamicode.com
首页 > 系统相关 > 详细

SUSE Linux 使用UDEV配置ASMdisk

时间:2015-05-22 19:31:45      阅读:327      评论:0      收藏:0      [点我收藏+]

标签:suse linux udev asmdisk

node1:~ # cat /etc/issue

Welcome to SUSE Linux Enterprise Server 11 SP2  (x86_64) - Kernel \r (\l).
node1:~ #

node1:/etc/udev/rules.d # fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders, total 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b4c72

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      401407      199680   83  Linux
/dev/sda2          401408     8787967     4193280   82  Linux swap / Solaris
/dev/sda3         8787968    83859455    37535744   83  Linux

Disk /dev/sdb: 2097 MB, 2097152000 bytes
65 heads, 62 sectors/track, 1016 cylinders, total 4096000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn‘t contain a valid partition table

Disk /dev/sdc: 10.5 GB, 10485760000 bytes
64 heads, 32 sectors/track, 10000 cylinders, total 20480000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdc doesn‘t contain a valid partition table

Disk /dev/sdd: 21.0 GB, 20971520000 bytes
64 heads, 32 sectors/track, 20000 cylinders, total 40960000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdd doesn‘t contain a valid partition table
node1:/etc/udev/rules.d #


添加编辑/etc/scsi_id.config 文件
options=--whitelisted --replace-whitespace 

添加编辑/etc/udev/rules.d/99-oracle-asmdevices.rules
node1:~ # for i in b c d
> do 
> echo "KERNEL==\"sd*\", SUBSYSTEM==\"block\", PROGRAM==\"/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/\

$name\", RESULT==\"`/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid

\", GROUP=\"asmadmin\", MODE=\"0660\"" 
> done 
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",

RESULT=="2e8ced45878991f7f", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",

RESULT=="2ff5dd7058b0ffb40", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",

RESULT=="26c6d14a2e3aa5dd4", NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"

修改设备别名为所需设备名。
node1:~ # cd /etc/udev/rules.d/
node1:/etc/udev/rules.d # vi 99-oracle-asmdevices.rules
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",

RESULT=="2e8ced45878991f7f", NAME="asmocr", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",

RESULT=="2ff5dd7058b0ffb40", NAME="asmfra", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",

RESULT=="26c6d14a2e3aa5dd4", NAME="asmdata", OWNER="grid", GROUP="asmadmin", MODE="0660"
~
"99-oracle-asmdevices.rules" 3L, 625C written                   
node1:/etc/udev/rules.d #

SUSE和RedHat系列不同,需要使用udevadm test测试才可以看到新产生的设备名称。

node1:/etc/udev/rules.d # udevadm test /sys/block/sdb
node1:/etc/udev/rules.d # udevadm test /sys/block/sdc
node1:/etc/udev/rules.d # udevadm test /sys/block/sdd

重新启动udev(确保udev为运行状态)
node1:/etc/udev/rules.d # /etc/init.d/boot.udev restart
Restarting udevd:                                                       done
node1:/etc/udev/rules.d #
查看生成的设备名称
node1:/dev # ll asm*
brw-rw---- 1 grid asmadmin 8, 48 May 22 23:11 asmdata
brw-rw---- 1 grid asmadmin 8, 32 May 22 23:11 asmfra
brw-rw---- 1 grid asmadmin 8, 16 May 22 23:11 asmocr
node1:/dev #


备注:网上查看到资料使用udevadm test测试后fdisk -l将看不到磁盘,但是本人测试后,若udevadm test命令测试后执行fdisk -l,除了系统盘自身之外其他的都看不见,如下:

node1:~ # fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders, total 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b4c72

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      401407      199680   83  Linux
/dev/sda2          401408     8787967     4193280   82  Linux swap / Solaris
/dev/sda3         8787968    83859455    37535744   83  Linux
node1:~ #

但是重启之后,发现还可以看到一些盘存在,但是不影响使用。这一点还需了解的朋友指点。


本文出自 “技术成就梦想!” 博客,请务必保留此出处http://dreamsanqin.blog.51cto.com/845412/1653889

SUSE Linux 使用UDEV配置ASMdisk

标签:suse linux udev asmdisk

原文地址:http://dreamsanqin.blog.51cto.com/845412/1653889

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!