centos7创建asm磁盘_Linux 7下使用udev绑定ASM磁盘

本文介绍了如何在CentOS 7系统中使用udev规则来创建并绑定ASM磁盘。通过运行特定的udev命令获取设备UUID,并创建映射文件99-oracle-asmdevices.rules,为ASM磁盘设置符号链接。最后通过`udevadm`使配置生效,成功绑定设备。
摘要由CSDN通过智能技术生成

for disk in `ls /dev/sd*`

do

echo $disk

/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=$disk

done

--产生设备的UUID

[root@db12c_01 ~]# for disk in `ls /dev/sd*`

>                   do

>                     echo $disk

>                     /usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=$disk

>                   done

/dev/sda

36000c296553b7ac67e22e3e60ac04462

/dev/sda1

36000c296553b7ac67e22e3e60ac04462

/dev/sda2

36000c296553b7ac67e22e3e60ac04462

/dev/sdb

36000c298981418c7e8a25a89d0f836c9

/dev/sdb1

36000c298981418c7e8a25a89d0f836c9

/dev/sdc

36000c29dce09d16de88f435217838c9e

/dev/sdc1

36000c29dce09d16de88f435217838c9e

/dev/sdd

36000c29c3438303241fd1291834b1bd0

/dev/sdd1

36000c29c3438303241fd1291834b1bd0

/dev/sde

36000c291dec502efa9d3ae53c99f0028

/dev/sde1

36000c291dec502efa9d3ae53c99f0028

/dev/sdf

36000c29e29a4bcd75acea14e982ea49d

/dev/sdf1

36000c29e29a4bcd75acea14e982ea49d

/dev/sdg

36000c290ecd14020e2c7f41ee6a2916a

/dev/sdg1

36000c290ecd14020e2c7f41ee6a2916a

映射文件: /etc/udev/rules.d/99-oracle-asmdevices.rules

KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000c298981418c7e8a25a89d0f836c9", SYMLINK+="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"

KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000c29dce09d16de88f435217838c9e", SYMLINK+="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"

KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000c29c3438303241fd1291834b1bd0", SYMLINK+="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"

KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000c291dec502efa9d3ae53c99f0028", SYMLINK+="asm-diske", OWNER="grid", GROUP="asmadmin", MODE="0660"

KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000c29e29a4bcd75acea14e982ea49d", SYMLINK+="asm-diskf", OWNER="grid", GROUP="asmadmin", MODE="0660"

让配置生效:

/sbin/udevadm trigger --type=devices --action=change

udevadm control --reload-rules

查看生效后的设备名:

[root@db12c_01 ~]# ls -l /dev/as*

lrwxrwxrwx 1 root root 4 Nov 21 00:38 /dev/asm-diskb -> sdb1

lrwxrwxrwx 1 root root 4 Nov 21 00:38 /dev/asm-diskc -> sdc1

lrwxrwxrwx 1 root root 4 Nov 21 00:38 /dev/asm-diskd -> sdd1

lrwxrwxrwx 1 root root 4 Nov 21 00:38 /dev/asm-diske -> sde1

lrwxrwxrwx 1 root root 4 Nov 21 00:38 /dev/asm-diskf -> sdf1

在做配置的时候,发现第二个节点配置时需要读取一下磁盘的分区信息才能成功绑定

[root@db12c_02 ~]# fdisk /dev/sdf

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): p

Disk /dev/sdf: 4294 MB, 4294967296 bytes, 8388608 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 label type: dos

Disk identifier: 0xc1b37f09

参考:http://www.xifenfei.com/2016/08/linux-7-udev.html          http://www.jydba.net/how-to-set-device-name-using-udev-on-oracle-linux-7-1/

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8520577/viewspace-2147507/,如需转载,请注明出处,否则将追究法律责任。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值