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:~ #

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


你可能感兴趣的:(linux,SuSE,udev,ASMdisk)