UDEV SCSI Rules Configuration for ASM in Oracle Linux 5 and 6
UDEV SCSI Rules Configuration for ASM in Oracle Linux 5 and 6
For Oracle Automatic Storage Manager (ASM) to use disks, it needs to be able to identify the devices consistently and for them to have the correct ownership and permissions. In Linux you can use ASMLib to manage these tasks, but it is seen as an additional
layer of complexity and has never really gained any popularity. Instead, many people use the Linux device manager "udev" to perform these tasks. This article presents a brief overview of setting up udev rules with respect to disks for use with ASM in Oracle
11g. The examples are all done using Oracle Linux 5 and 6, so they will be consistent with RHEL and CentOS 5 and 6.
- Background
- Identify the Disks (/sbin/scsi_id)
- Make SCSI Devices Trusted
- Create UDEV Rules File
- Load Updated Block Device Partitions (/sbin/partprobe)
- Test Rules (udevtest)
- Restart UDEV Service
- Check Ownership and Permissions
Background
Essentially, what udev does is apply rules defined in files in the "/etc/udev/rules.d" directory to the device nodes listed in the "/dev" directory. The rules can be defined in a variety of ways, but what we need to do is identify the device and say what
we want udev to do with it.
In this case I know all my disk devices are named "/dev/sd?1", where the "?
" represents a letter from a-d, so I can identify the devices of interest using the following rule parameters.
KERNEL=="sd?1", BUS=="scsi"
I want to tie each specific device to an alias, so it is always identified the same way, regardless of the device name Linux assigns it. So I need to be able to test each device that matches the previous pattern to see if it is the disk I am interested in.
Each disk has a unique SCSI ID, so I can place a test into the rule, telling it how to perform the test, and the result it should return for a positive match. The following rule parameters explain how to test the device and what result constitutes a match
in Oracle Linux 5.
PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_"
The scsi_id
command works a little differently in Oracle Linux 6, so for that the following test works better.
PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_"
Once we have identified the specific device of interest, we need to indicate what actions should be performed on it. The following parameters specify an alias, the ownership and the permissions for the device.
NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
So the whole rule for each disk will look something like this in Oracle Linux 5.
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_", NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
Or this in Oracle Linux 6.
KERNEL=="sd? 1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_", NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
This means that the device pointing to the partition "sd*1" on the disk with the SCSI ID of "SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_" will always be called "/dev/asm-disk1", regardless of the letter "?" Linux assigns when the device is discovered. In addition,
the device will have the correct ownership and permissions for ASM.
There are a number of wildcards and matching patterns that can be used if you don't want to write device-specific rules.
Now we know roughly what we are trying to achieve, we will look at each step necessary for setting up the disks for ASM to use.
Identify the Disks (/sbin/scsi_id)
We are going to write device-specific rules, so we need to be able to identify each device consistently, irrespective of the order in which Linux discovers it. To do this we are going to use the SCSI ID for each disk (not the partition), which we get using
the scsi_id
command. The "-s" option makes the paths relative to the "/sys" directory. For Oracle Linux 5, use the following command.
# /sbin/scsi_id -g -u -s /block/sdb
SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_
# /sbin/scsi_id -g -u -s /block/sdc
SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_
# /sbin/scsi_id -g -u -s /block/sdd
SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172_
# /sbin/scsi_id -g -u -s /block/sde
SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_
#
The "-s" is not available in Oracle Linux 6, so you must use the following syntax.
# /sbin/scsi_id -g -u -d /dev/sdb
SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_
# /sbin/scsi_id -g -u -d /dev/sdc
SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_
# /sbin/scsi_id -g -u -d /dev/sdd
SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172_
# /sbin/scsi_id -g -u -d /dev/sde
SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_
#
Make SCSI Devices Trusted
Add the following to the "/etc/scsi_id.config" file to configure SCSI devices as trusted. Create the file if it doesn't already exist.
options=-g
Create UDEV Rules File
Create the "/etc/udev/rules.d/99-oracle-asmdevices.rules" file.
# vi /etc/udev/rules.d/99-oracle-asmdevices.rules
The file should contain the following lines for Oracle Linux 5. The PROGRAM
parameter must match the command you used to retrieve the SCSI ID, and the
RESULT
parameter must match the value returned from your disks.
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_", NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd? 1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_", NAME="asm-disk2", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172_", NAME="asm-disk3", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_", NAME="asm-disk4", OWNER="oracle", GROUP="dba", MODE="0660"
The equivalent for Oracle Linux 6 is shown below.
KERNEL=="sd? 1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_", NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd? 1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VB46dec7e0-192e8000_", NAME="asm-disk2", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VBce8c63bb-ac67a172_", NAME="asm-disk3", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="SATA_VBOX_HARDDISK_VB7437a3b7-95b199cd_", NAME="asm-disk4", OWNER="oracle", GROUP="dba", MODE="0660"
Load Updated Block Device Partitions (/sbin/partprobe)
Load updated block device partition tables.
# /sbin/partprobe /dev/sdb1
# /sbin/partprobe /dev/sdc1
# /sbin/partprobe /dev/sdd1
# /sbin/partprobe /dev/sde1
Test Rules (udevtest)
Test the rules are working as expected.
# #OL5
# udevtest /block/sdb/sdb1
# udevtest /block/sdc/sdc1
# udevtest /block/sdd/sdd1
# udevtest /block/sde/sde1 # #OL6
# udevadm test /block/sdb/sdb1
# udevadm test /block/sdc/sdc1
# udevadm test /block/sdd/sdd1
# udevadm test /block/sde/sde1
The output from the first disk should look something like this.
# udevtest /block/sdb/sdb1
main: looking at device '/block/sdb/sdb1' from subsystem 'block'
udev_rules_get_name: add symlink 'disk/by-id/scsi-SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3-part1'
udev_rules_get_name: add symlink 'disk/by-path/pci-0000:00:0d.0-scsi-1:0:0:0-part1'
run_program: '/lib/udev/vol_id --export /dev/.tmp-8-17'
run_program: '/lib/udev/vol_id' returned with status 4
run_program: '/sbin/scsi_id -g -u -s /block/sdb/sdb1'
run_program: '/sbin/scsi_id' (stdout) 'SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3_'
run_program: '/sbin/scsi_id' returned with status 0
udev_rules_get_name: rule applied, 'sdb1' becomes 'asm-disk1'
udev_device_event: device '/block/sdb/sdb1' already in database, validate currently present symlinks
udev_node_add: creating device node '/dev/asm-disk1', major = '8', minor = '17', mode = '0660', uid = '1100', gid = '1200'
udev_node_add: creating symlink '/dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3-part1' to '../../asm-disk1'
udev_node_add: creating symlink '/dev/disk/by-path/pci-0000:00:0d.0-scsi-1:0:0:0-part1' to '../../asm-disk1'
main: run: 'socket:/org/kernel/dm/multipath_event'
main: run: 'socket:/org/kernel/udev/monitor'
main: run: '/lib/udev/udev_run_devd'
main: run: 'socket:/org/freedesktop/hal/udev_event'
main: run: '/sbin/pam_console_apply /dev/asm-disk1 /dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VBd306dbe0-df3367e3-part1 /dev/disk/by-path/pci-0000:00:0d.0-scsi-1:0:0:0-part1'
#
Restart UDEV Service
Restart the UDEV service.
# #OL5
# /sbin/udevcontrol reload_rules # #OL6
# udevadm control --reload-rules # #OL5 and OL6
# /sbin/start_udev
Check Ownership and Permissions
Check the disks are now available with the "asm-disk*" alias and the correct ownership and permissions.
# cd /dev
# ls -al asm-disk*
brw-rw---- 1 oracle dba 8, 17 Apr 8 22:47 asm-disk1
brw-rw---- 1 oracle dba 8, 33 Apr 8 22:47 asm-disk2
brw-rw---- 1 oracle dba 8, 49 Apr 8 22:47 asm-disk3
brw-rw---- 1 oracle dba 8, 65 Apr 8 22:47 asm-disk4
#
So the ASM_DISKSTRING
initialization parameter in the ASM instance can be set to '/dev/asm-disk*' to identify the ASM disks.
UDEV SCSI Rules Configuration for ASM in Oracle Linux 5 and 6的更多相关文章
- 如何用udev for asm in oracle linux 6
大部分在网上可以找到的文档都是在RHEL5或者OEL5中设置udev,udev对于Linux而言最大的作用是防止操作系统重新启动以后,作为ASM磁盘使用的盘符发生变化.比如说Tim Hall的文章:U ...
- 在Linux 5/6上使用UDEV SCSI规则配置ASM DISK
格式化磁盘(略) 识别磁盘(/sbin/scsi_id) Oracle Linux 5用如下脚本: #!/bin/sh for i in b c d e f g do echo "KERN ...
- oracle linux 7使用udev绑盘操作
参考:Oracle Linux 7: Udev rule for ASM Cannot Place the ASM Disk in a Directory under /dev (Doc ID 221 ...
- [置顶] Oracle 11g R2 ASM:了解 Oracle ASM 基本概念
About Oracle ASM Instances About Oracle ASM Disk Groups About Mirroring and Failure Groups About Ora ...
- udev和rules使用规则
本文以通俗的方法阐述 udev 及相关术语的概念.udev 的配置文件和规则文件,然后以 Red Hat Enterprise Server 为平台演示一些管理设备文件和查询设备信息的实例.本文会使那 ...
- ORACLE LINUX 6.3 + ORACLE 11.2.0.3 RAC + VBOX安装文档
ORACLE LINUX 6.3 + ORACLE 11.2.0.3 RAC + VBOX安装文档 2015-10-21 12:51 525人阅读 评论(0) 收藏 举报 分类: Oracle RA ...
- 12c R2 RAC Oracle Linux 7.3 ESXI6.5
环境:ESXI6.5虚拟化 主机配置:操作系统 Oracle Linux 7.3 CPU:8个VCPU 内存:16G 本地磁盘:50G 全程默认最小化安装Oracle Linux 7.3操作系统 每个 ...
- 在 Oracle Linux 6.5 上安装 Oracle 11g 单实例数据库
Checking the Hardware Requirements 系统必须满足下面最小的硬件要求 Memory Requirements Minimum: 1 GB of RAMRecommend ...
- Oracle linux 6.3 安装11g R2 RAC on vbox
1 安装系统 Virtual box 4.3 Oracle linux 6.3 Oracle 11g r2 Make sure "Adapter 1" is enabled, se ...
随机推荐
- Disruptor源码解读
上一篇已经介绍了Disruptor是什么?简单总结了为什么这么快?下面我们直接源码搞起来,简单粗暴.高性能队列disruptor为什么这么快? 一.核心类接口 Disruptor 提供了对RingBu ...
- pom.xml详情
这里借鉴一下csdn中的一个系列的博客: 第一篇:POM文件详解 第二篇:maven中的依赖作用范围 第三篇:maven中的可选依赖和依赖排除 第四篇:maven中的dependencies和depe ...
- Django基础之数据库增删改查
Django中生成多个APP,每个APP下都有自己models模块,避免了多个APP之间数据的相互影响. 1.首先在APP的models下创建一个类 class UserInfo(models.Mod ...
- android开发小内容
EditText弹出输入数字:android:inputType="phone"
- text-shadow的用法详解
1.兼容性:text-shadow 和 box-shadow 这两个属性在主流现代浏览器上得到了很好的支持( > Chrome 4.0, > Firefox 3.5, > Safar ...
- Java 基础入门随笔(10) JavaSE版——单例设计模式
设计模式:对问题行之有效的解决方式.其实它是一种思想. 1.单例设计模式. 解决的问题:就是可以保证一个类在内存中的对象唯一性.(单个实例) 使用单例设计模式需求:必须对于多个程序使用同一个配置信息对 ...
- vue项目中添加百度地图功能及解决遇到的问题详解
第一步,在百度地图开放平台 申请密钥 (如果有密钥可以省略此步骤,朋友有也可以借) 地址:http://lbsyun.baidu.com/ 第二步,创建应用并填写表单(下面链接可参考) http:// ...
- 巧用TWaver 3D 矢量图形功能
的确,提起TWaver,大家想到的首先是“电信拓扑图组件”.其实,由于其灵活的MVC架构.矢量化设计.方便定制等特点,TWaver可以做的还有很多.例如房地产行业常见到的“户型图”. 户型推荐是销售接 ...
- SIMD学习 -- 用SSE2指令作点乘和累加计算
这几天在做学校的一个学习小项目,需要用到SIMD指令计算提速.也是第一次碰这个,看了一些资料和代码,模仿着写了两个函数. void sse_mul_float(float *A, float *B, ...
- 安装ubuntu系统空间分配问题
以下是我安装linux系统(ubuntu)时的系统空间配置,以50G为例: 挂载点 大小 格式 分区类型 / 15G Ext4 主分区 /home 30G Ext4 逻辑分区 /boot 1G Ext ...