Using udev on RHEL 6 / OL 6 to change disk permissions for ASM

When you use Oracle ASM (Automatic Storage Management) for your database, the permissions on the block devices on the operating system layer which are used by ASM need to be changed. To be more precise, the owner and group need to be set to ‘oracle’ and ‘dba’ (Oracle documentation) in my case.

I used to do this in a very lazy way, using a simple ‘/bin/chown oracle.dba /dev/sdb’ in /etc/rc.local. This worked for me with RHEL/OL version 5. This has changed with RHEL/OL 6, because the system V startup system has changed to ‘upstart’. Also, the disk devices change ownership back in OL6 if you set it by hand to oracle.dba.

Oracle has its own resolution for generating block device files especially for ASM, called ASMLib. This generally works well, but what is exactly happening to generate the devices, and how to troubleshoot the generation of the devices is (as far as I know) not documented nor generally known. I’ve been bitten a few times on my test systems, which is the reason I don’t like ASMLib, and do not feel comfortable with ASMLib.

The linux system has functionality which equals the block device generation of ASMLib, which is called udev. Udev isn’t exactly over-documented. Also, there seems to be a difference between the tools (scsi_id and rule file syntax) in RHEL/OL 5 and RHEL/OL 6. But there is much written about it. And it’s very simple, once you know what to do.

I have a separate (virtual) disk which I want to use with ASM. After startup, the block device of this disk is called /dev/sdb. In order to let udev identify this disk, the linux utility ‘scsi_id’ can be used to fetch the unique SCSI identifier of the disk. This is of importance, because the correct disk must be specified to be used with ASM. This sounds a bit dumb (of course we need the correct disk), but Linux names the devices in the order at which they are seen by the kernel. This means it’s possible that /dev/sdb is another disk if someone decides to add a disk to the system, and reboots the server. (please mind most servers do not change very much, nor I have seen this happening)

And there’s another complication: VMWare doesn’t provide a unique device number by default. In order to let VMWare provide Linux a unique number, ‘disk.EnableUUID = “TRUE”‘ must be added to the virtual machine configuration file (“vmx file”). After a reboot, ‘scsi_id’ is able to provide a serial!

So at this point, you should have a disk or disks to be used with ASM. First grab the unique serial of the disk (this is the RHEL6/OL6 syntax of the scsi_id command!):

# scsi_id -g -u -d /dev/sdb

Next, we need to make a udev rule file. In this file, we specify this SCSI id (which we fetched with scsi_id), and specify how we want that device created:

# cd /etc/udev/rules.d/
# cat 99-oracle-asmdevices.rules
KERNEL=="sd*", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="36000c29127c3ae0670242b058e863393", NAME+="oracleasm/disk1", OWNER="oracle", GROUP="dba", MODE="0660"

(There is no ’99-oracle-asmdevices.rules’ file by default, you need to create it yourself)

That’s all. When the kernel finds a “sd*” device, subsystem “block”, with the serial “36000c29127c3ae0670242b058e863393”, it creates a device file ‘/dev/oracleasm/disk1’, owner oracle, etc.

This is also convenient because the disk string of ASM is very easy to set now: ‘/dev/oracleasm/*’.

Please mind if the block devices have the correct permissions, it doesn’t matter to ASM if the device file names have swapped. The ASM instance scans the device headers for it’s contents.

  1. naessbj said:

    In OL/RHEL 5 It was quite easy to set the permissions using multipathing. For each Lun you just made a multipath section setting an alias , owner, group and permissions.


    multipath {
    wwid 360050768018285af200000000000002e
    alias ORA-RAC-FRA-A01
    mode 660
    uid 301
    gid 300

    In OL6 that is no longer possible, so we are back to udev rules. You’re post might help a lot of people out 😉 I still prefer asmlib though. It’s recommended by Oracle and it hasn’t let me down ( yet 😉 ).

  2. Thank you for your comment!

    ASMLib was a separate download for OL5 and didn’t got updated automatically when the kernel was updated. So ASM would fail after the new kernel was used. I didn’t test this, but probably it gets updated with a kernel upgrade with OL6 because ASMLib is included with the packages now.

      • Hi Alban, thanks for stopping by. Yes, I am aware of ASMLib in OL6, and mention that in this article. As I say, personally I don’t like it because it’s hard to troubleshoot. Udev is more documented, and has (far) better possibilities for troubleshooting (as a consultant I often visit sites with troubles and need to troubleshoot!)

  3. Harvey said:

    I am getting the following message, is there a fix to this.

    # udevtest /block/sdb/sdb1
    -bash: udevtest: command not found

    uname -a
    Linux node01.localdomain 2.6.39-200.29.2.el6uek.x86_64 #1 SMP Sat Jul 14 10:50:56 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

    # rpm -q udev-147-2.42.el6.x86_64

    # yum update
    Loaded plugins: refresh-packagekit, security
    Setting up Update Process
    No Packages marked for Update

    • Hi Harvey, thank you for visiting my blog!

      You might want to check out ‘udevadm’, specifically the ‘test’ option of that:

      # udevadm test /sys/block/sdb/sdb1

      This prints out all the stuff udev does against the given device.

  4. jcnars said:

    Hi Frits,
    The ASMLib kernel driver installation as detailed in:

    cannot be done in our case, as we are using RHEL compatible kernel…not UEK.
    So, Oracle is NOT providing a ASMLib for our kernel, though we are running OEL6.3

    In this scenario, would you happen to know if I don’t install the ASM kernel driver (oracleasm-kernel-version.arch.rpm), can I still use ASM using udev?

    In other words, what rpms are needed to use ASM without using ASMLib?
    I think no rpms are needed to use ASM functionality (bypassing ASMLib).

    The steps, in that case, would be to use udev to persistently create the /dev/oracleasm/disk and then in the Grid Infrastructure installation screen, give the device discovery string as /dev/oracleasm/disk*… I right so far?

    Appendix: Some more details:

    We have yum configured with our ULN account. But there we can’t find the oracleasm-`uname -r` package. Support confirmed there can’t be one.

    [root@oralina ~]# uname -a
    Linux 2.6.32-279.5.2.el6.x86_64 #1 SMP Thu Aug 23 12:05:59 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

    [root@oralina ~]# modprobe oracleasm
    WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.
    FATAL: Module oracleasm not found.

    [root@oralina ~]# modinfo oracleasm
    ERROR: modinfo: could not find module oracleasm

    [root@oralina ~]# oracleasm update-driver
    Kernel: 2.6.32-279.5.2.el6.x86_64 x86_64
    Driver name: oracleasm-2.6.32-279.5.2.el6.x86_64
    Driver for kernel 2.6.32-279.5.2.el6.x86_64 does not exist

    [root@oralina ~]# yum repolist
    Loaded plugins: rhnplugin, security
    repo id repo name status
    ol6_x86_64_UEK_latest Latest Unbreakable Enterprise Kernel for Oracle Linux 6 (x86_64) 71
    ol6_x86_64_latest Oracle Linux 6 Latest (x86_64) 17,860
    ol6_x86_64_oracle Oracle Software for Oracle Linux 6 (x86_64) 26
    repolist: 17,957

    [root@oralina ~]# yum install oracleasm-`uname -r`
    Loaded plugins: rhnplugin, security
    Setting up Install Process
    No package oracleasm-2.6.32-279.5.2.el6.x86_64 available.
    Error: Nothing to do

    [root@oralina ~]# rpm -qa | grep -i oracle | sort -u

    [root@oralina ~]# yum list \*oracle\*
    Loaded plugins: rhnplugin, security
    Installed Packages
    oracle-logos.noarch 60.0.11-9.el6 @anaconda-OracleLinuxServer-201206261930.x86_64/6.3
    oracle-rdbms-server-11gR2-preinstall.x86_64 1.0-6.el6 @ol6_x86_64_latest
    oracleasm-support.x86_64 2.1.5-1.el6 @ol6_x86_64_latest
    oracleasmlib.x86_64 2.0.4-1.el6 @ol6_x86_64_oracle
    oraclelinux-release.x86_64 6:6Server-3.0.2 @anaconda-OracleLinuxServer-201206261930.x86_64/6.3
    oraclelinux-release-notes.x86_64 6Server-7 @anaconda-OracleLinuxServer-201206261930.x86_64/6.3
    Available Packages
    oracle-instantclient11.2-basic.x86_64 ol6_x86_64_oracle
    oracle-instantclient11.2-basiclite.x86_64 ol6_x86_64_oracle
    oracle-instantclient11.2-devel.x86_64 ol6_x86_64_oracle
    oracle-instantclient11.2-jdbc.x86_64 ol6_x86_64_oracle
    oracle-instantclient11.2-odbc.x86_64 ol6_x86_64_oracle
    oracle-instantclient11.2-precomp.x86_64 ol6_x86_64_oracle
    oracle-instantclient11.2-sqlplus.x86_64 ol6_x86_64_oracle
    oracle-instantclient11.2-tools.x86_64 ol6_x86_64_oracle

    • Hello JCNars,

      Yes, the asmlib kernel driver used to be a separate rpm, but has been included in the oracle linux kernel package since OL6. This effectively removed asmlib (!) support for RHEL6 as far as I know.

      Asmlib is an HELPER package to make the device handling and setup for use with ASM easier. Asmlib is by no means a required package for ASM. ASM lives happily without it.

      Before upstart, the most lazy way to give ASM it’s block devices with the correct settings was just chown-ing them in /etc/rc.local (which I did in my VM’s). This gives a clear message there are no additional packages needed for ASM to use block devices without asmlib. Please mind I use udev for professional setups (!)

      With OL6/RHEL6, the device handling has changed and udev now more-or-less is mandatory if you don’t use asmlib.

      You just can use the setup I’ve described in the article above. No additional packages need to be installed to get your system to a state where udev presents devices with the correct permissions in it’s own directory for usage with ASM.

  5. jcnars said:

    This method doesn’t work if the sda device is partitioned, say sda1.
    scsi_id will return nothing

    • Hi jcnars, thank you for reading and commenting!

      It makes sense to me individual partitions on a device cannot be used with scsi_id, which has the function to provide information about a scsi device, not a partition.

      Because of business on my side I am unable to comment earlier, and I have little time now because of upcoming openworld.

    • As far as I know (need to test that), udev will setup any partition with the udev rule, because the rule says KERNEL==”sd*”, but I am not sure.

  6. jcnars said:

    Hi Frits,
    good luck in OOW12 presentations !

    Thanks for your response, this blog post helped tremendously and I am all set now with respect to creating ASM devices out of partitions created out of multipathed pseudo devices.
    So, to speak:
    LUN -> multipath-ed pseudo-devices -> partitions on these devices -> udev rules on these partitioned devices -> ASM disks -> ASM diskgroups -> test database on top of ASM DGs

    From this blog, I got the solution for the partition mapping to ASM device via udev and posting it here for others who may stumble on your blog…i am sure more & more readers will come hunting & find this useful as udev is the only way forward for RHEL6 or OEL6 with RHCK customers.

    I had wrongly used scsi_id in my udev rules and it had mapped the parent device (/dev/mapper/data) to the ASM disk…not the partition (/dev/mapper/datap1).

    Discovered in the evening that all the partitions I had created on the LUNs had disappeared.
    The udev rule were operating on the parent device rather than the partitioned device as scsi_id draws a blank for partitions.
    Once I created & mounted a diskgroup on that parent device, ASM wipes out the partition (of course!).

    After chancing across Murtaza’s blog and doing some research of the udevadm tool, finalized this for udev rules:
    ENV{DM_UUID}==”part1-mpath-360a98000653354596b4a6d584d4b5055″, NAME+=”oracleasm/disk-indexpart”, OWNER=”oracle”, GROUP=”dba”, MODE=”0660″
    ENV{DM_UUID}==”part1-mpath-360a980006533546156346d584c4a544f”, NAME+=”oracleasm/disk-redobpart”, OWNER=”oracle”, GROUP=”dba”, MODE=”0660″
    ENV{DM_UUID}==”part1-mpath-360a98000653354596b4a6d584d4e6f63″, NAME+=”oracleasm/disk-datapart”, OWNER=”oracle”, GROUP=”dba”, MODE=”0660″
    ENV{DM_UUID}==”part1-mpath-360a980006533546156346d584c462d37″, NAME+=”oracleasm/disk-redoapart”, OWNER=”oracle”, GROUP=”dba”, MODE=”0660″

    (While evaluating device rules (i.e while scanning devices), if it comes across a device by the attribute DM_UUID==part1-mpath-360a98000653354596b4a6d584d4b5055, it will create the /dev/oracleasm/disk-indexpart device with the ownerships oracle:dba)

    To see more about the attributes of each device, udevadm info -p /devices/virtual/block/dm-8 -q all , where /devices/virtual/block/dm-8 is the multipathed device under /sys/block/.
    [root@oralina ~]# udevadm info -p /devices/virtual/block/dm-8 -q all
    P: /devices/virtual/block/dm-8
    N: oracleasm/disk-indexpart
    L: 10
    S: mapper/indexp1
    S: disk/by-id/dm-name-indexp1
    S: disk/by-id/dm-uuid-part1-mpath-360a98000653354596b4a6d584d4b5055
    S: disk/by-label/\x28
    S: block/253:8
    E: UDEV_LOG=3
    E: DEVPATH=/devices/virtual/block/dm-8
    E: MAJOR=253
    E: MINOR=8
    E: DEVNAME=/dev/oracleasm/disk-indexpart
    E: DEVTYPE=disk
    E: SUBSYSTEM=block
    E: DM_SBIN_PATH=/sbin
    E: DM_NAME=indexp1
    E: DM_UUID=part1-mpath-360a98000653354596b4a6d584d4b5055
    E: ID_FS_LABEL=_
    E: ID_FS_LABEL_ENC=\x28
    E: ID_FS_TYPE=oracleasm
    E: ID_FS_USAGE=filesystem
    E: MPATH_SBIN_PATH=/sbin
    E: LVM_SBIN_PATH=/sbin
    E: DEVLINKS=/dev/mapper/indexp1 /dev/disk/by-id/dm-name-indexp1 /dev/disk/by-id/dm-uuid-part1-mpath-360a98000653354596b4a6d584d4b5055 /dev/disk/by-label/\x28 /dev/block/253:8

    Since, the above DM_UUID is tied to both the WWID and also the partition number, it’s not subject to change & guaranteed to be unique. In other will always give persistent naming for disks, even if the LUN is discovered arbitrarily as sd*.

    Oracle has a heck of a lot of metalink docs on how to configure udev for RHEL5/OEL5, RHEL4/OEL4.
    But not one on OEL6/RHEL6.

  7. Thomas said:

    Thank you for this article. I tried scsi_id but didn’t get anything returned.
    I also tried setting ‘disk.EnableUUID = “TRUE”‘ in the .vmx file.
    I use VMware fusion and this is not supported.
    I then tried the following:
    KERNEL==”sdb”, SUBSYSTEM==”block”, ENV{DEVTYPE}==”disk”, NAME+=”oracleasm/disk1″, OWNER=”oracle”, GROUP=”oinstall”, MODE=”0660″
    KERNEL==”sdc”, SUBSYSTEM==”block”, ENV{DEVTYPE}==”disk”, NAME+=”oracleasm/disk2″, OWNER=”oracle”, GROUP=”oinstall”, MODE=”0660″
    KERNEL==”sdd”, SUBSYSTEM==”block”, ENV{DEVTYPE}==”disk”, NAME+=”oracleasm/disk3″, OWNER=”oracle”, GROUP=”oinstall”, MODE=”0660″
    [oracle@test grid]$ ls -l /dev/oracleasm/
    total 0
    brw-rw—- 1 oracle oinstall 8, 16 Oct 19 18:30 disk1
    brw-rw—- 1 oracle oinstall 8, 16 Oct 19 18:40 disk2
    brw-rw—- 1 oracle oinstall 8, 16 Oct 19 18:45 disk3

    As you can see, it has created the file for oracle.
    with KERNEL==”sd*” i seemed to lose all my disks.


    • I use VMWare fusion too, and disk.EnableUUID = “TRUE” gives an error in the vmware.log file (2012-10-08T17:18:23.417+01:00| vmx| I120: UUID: Unable to open /dev/mem: No such file or directory), but my disk is assigned an UUID (from the vmware.log file too): 2012-10-08T17:18:23.649+01:00| vmx| I120: DISK: Disk ‘/Users/fritshoogland/Documents/Virtual Machines.localized/ol6x64-o12b2.vmwarevm/ol6x64-o12b2.vmdk’ has UUID ’60 00 c2 92 d9 5c c0 24-ac 19 03 eb 95 1d 12 e2′. I am not sure if this means an UUID for vmware, or a UUID for inside the VM. I assume it’s a UUID for the O/S inside VM to identify (the virtual) hardware.

      If this resolution works for you, please use it. It’s very educational to put your resolution here for others. Please mind this is the simple equivalent of putting ‘chown oracle.oinstall /dev/sd[bcd]’ in /etc/rc.local, which worked with EL5. In EL6, this doesn’t work, the block devices are monitored more thoroughly and will be reset back to root.disk in a short while.

      What I mean with this, is that the disk will get assigned as they get visible to linux. This might not be the same order every time. In reality, they will, but it’s a gamble what will happen to the drive assignments if a disk (block device) gets added. With an UUID, linux uses an unique number which comes from the device, so the assignment will always use the same disk.

      To be honest, this is not really important for ASM; the ASM instance scans the devices it can see, and reads the header to learn which ASM Disk this is. So if the device name of two ASM disks get swapped for some reason, ASM will just work and not complain about anything.

    • Vik said:

      I have the same problem.
      How to fix it?


  8. MensaWater said:

    Just to make it clear from the prior post. The link:
    Provides the udev rules for OEL/RHEL/CENTOS 5 & 6 for setting up partitions and worked for me. It is a bit simpler to follow than the other information that talks about iSCSI setup as it assumes you’ve already got your disks and have partitioned them.
    Note that it mentions “udevtest” and “udevcontrol” which are both now replaced with udevadm. (e.g. udevadm test and udevadm control) . There is a man page for udevadm that is quite easy to understand for the purposes mentioned in above link.

    • The RHEL/OEL 6 version of the command is:

      udevadm control –reload-rules

  9. jlong said:

    KERNEL==”sd*”, SUBSYSTEM==”block”, ENV{DEVTYPE}==”disk”, ENV{ID_SERIAL}==”36000c29127c3ae0670242b058e863393″, NAME+=”oracleasm/disk1″, OWNER=”oracle”, GROUP=”dba”, MODE=”0660″

    Hi Sir,

    I would like to ask you to be more specifically.

    Should you use KERNEL==”sd*”, or should you use KERNEL==”sd*1″???

    Thanks in advance.

    • jlong said:

      Hi Sir,

      Sorry is me again!

      an extra question,

      2. After I modified this accordingly, do I care about the /dev/oracleasm directory ownership and permission?

      Thanks in advance.

    • Sorry for not commenting earlier. Probably you’ve resolved this by now but:
      The number you’ve put after the star is probably a partition number, which is not a block device (SUBSYSTEM==”block”), so the rule quite probably won’t work.

  10. seshi said:

    Hi ,
    Thanks for this.

    I have shared the LUN from openfiler ISCSI target to a OEL 6 node. Do I have to create any UDEV rules to persist this LUN to the node. I have read on internet that they are creating a couple of files

    Please look up in the below URL

    So far, the below LUN is attached to the node as requested.

    lrwxrwxrwx. 1 root root 9 Dec 12 00:07 -> ../../sdc

    node1#fdisk -l

    Disk /dev/sdc: 3456 MB, 3456106496 bytes
    107 heads, 62 sectors/track, 1017 cylinders
    Units = cylinders of 6634 * 512 = 3396608 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    I am preparing this to Oracle 11G R2 RAC. I think we can use asmlib for this. Do we still require this.

    Here is my problem : I have created a rule as below

    # cd /etc/udev/rules.d/

    Create a file called “55-openiscsi.rules” with the following content:
    # /etc/udev/rules.d/55-openiscsi.rules
    KERNEL==”sd*”, BUS==”scsi”, PROGRAM=”/etc/udev/scripts/ %b”,SYMLINK+=”iscsi/%c/part%n”

    Navigate to another directory:

    # cd /etc/udev/scripts

    We create here a new shell script called “” with the following content:

    # FILE: /etc/udev/scripts/


    [ -e /sys/class/iscsi_host ] || exit 1


    target_name=$(cat ${file})

    # This is not an open-scsi drive
    if [ -z “${target_name}” ]; then
    exit 1

    echo “${target_name##*.}”

    Make the new script executable:

    # chmod 755 /etc/udev/scripts/

    restart the iSCSI initiator service:

    I’d expect a /dev/iscsi/ directory to be created which contains the mapping . between iqn and the directory.

    For some reason, It’s not created.

    Could you please let me know how I can proceed this. I am still able to view th e partition after the reboot. I don’t want to get into mess after a few reboots.

  11. Thirumalai T said:

    I have a question here as I will be using the udev functionality for the first time.

    I have 3 block devices namely /dev/sdt1, /dev/sdu1 and /dev/sdv1 with the following LUN mapping :

    [root@rmanqa01 rules.d]# ls -l /dev/disk/by-id | egrep ‘sdt1|sdu1|sdv1’
    lrwxrwxrwx 1 root root 10 Dec 31 15:02 scsi-360060e80102a960005119ce8000001b7-part1 -> ../../sdt1
    lrwxrwxrwx 1 root root 10 Dec 31 15:02 scsi-360060e80102a960005119ce8000001cc-part1 -> ../../sdu1
    lrwxrwxrwx 1 root root 10 Dec 31 15:02 scsi-360060e80102a960005119ce80000024c-part1 -> ../../sdv1

    Now I want to retain this mapping ( LUN to device name ) across reboots.

    How do I specify this in the rules file ?

    Do I need to provide “KERNEL=” key for each of the above mentioned three devices as

    if we have to use KERNEL=”sd*”, then how do we specify the three serial ids for the disks ?

    Also, where do you provide the device names to be mapped against the disk serial# ?


    V V

    • Hi! Thanks for reading!

      A few comments on your reply:
      -Please mind the difference between blockdevice (‘/dev/sdt’) and partition (‘/dev/sdt1’ being the first partition).
      -I am not sure if a partition and a blockdevice share the same UUID. It’s best to check this, or just use the UUID which I’ve shown in the blogpost.

      The KERNEL in the udev rules file provides which device to look for. Because the real identification is done with the UUID, there is no need to specify the blockdevice.
      Also mind that the udev rules in the blogpost creates the blockdevices at a special place, instead of just changing the userid and groupid of the device.
      As I’ve said, the real identification is done based on UUID, and for that specific UUID a device is created in /dev/oracleasm/ in the rules file provided in the blogarticle. The devicename is specified in the rules file (disk1, but can be anything), which makes the naming persistent.

      • Thirumalai T said:

        Thanks Frits….

        My ID_SERIAL for block device and the partition is the same as follows :

        [root@rmanqa01 rules.d]# udevinfo -q all -p /sys/block/sdt/sdt1
        P: /block/sdt/sdt1
        N: sdt1
        S: disk/by-id/scsi-360060e80102a960005119ce8000001b7-part1
        S: disk/by-path/pci-0000:02:00.0-fc-0x50060e80102a9600:0x0008000000000000-part1
        E: ID_MODEL=DF600f
        E: ID_REVISION=0000
        E: ID_SERIAL=360060e80102a960005119ce8000001b7
        E: ID_TYPE=disk
        E: ID_BUS=scsi
        E: ID_PATH=pci-0000:02:00.0-fc-0x50060e80102a9600:0x0008000000000000
        [root@rmanqa01 rules.d]# udevinfo -q all -p /sys/block/sdt
        P: /block/sdt
        N: sdt
        S: disk/by-id/scsi-360060e80102a960005119ce8000001b7
        S: disk/by-path/pci-0000:02:00.0-fc-0x50060e80102a9600:0x0008000000000000
        E: ID_MODEL=DF600f
        E: ID_REVISION=0000
        E: ID_SERIAL=360060e80102a960005119ce8000001b7
        E: ID_TYPE=disk
        E: ID_BUS=scsi
        E: ID_PATH=pci-0000:02:00.0-fc-0x50060e80102a9600:0x0008000000000000
        [root@rmanqa01 rules.d]#


        What does the first column stands for ? I guess ‘E:’ is for Environment. What does others indicate like, ‘P:’,’N:’,’S:’……

        The disk/by-id is different for the blockdev and the partition. How do I specify this distinction in the rule ? and then I can create an appropriate link.

        Is there any macros like “%b” or “%c” etc that can be used in the rules ? What is it to get the device name, scsi-id etc ?


        V V

      • Please follow the steps taken in the blog article. The result of the scsi_id utility is the UUID to use, and the rule for udev below that in the blog article tie the (unique) UUID and the blockdevice created by your specifications together.

  12. Thirumalai T said:

    As mentioned earlier in this blog, I too get nothing on running the /sbin/scsi_id command and it exits with a return value of 1.
    I believe that you had mentioned that /sbin/scsi_id may not work on the partitions.
    My need is to have a persistent link for a partition device.


    V V

    • Hi. You can’t get a scsi_id from a partition, scsi_id only works on SCSI devices. That’s the reason I tried to describe the difference between a device and a partition, and the reason scsi_id does not deliver any output.

      I am not sure if a partition is visible if the device is created by the udev rules, because the rule describes the setup of the device, not partitions.

      However, as JCNars already described in the comments earlier, you can let the device mapper map the device, and use a udev rule for the partition. See the last part of this blog:

      • jcnars said:

        This is for Thirumalai T ( VV):
        ENV{DEVLINKS}==”*scsi-3690b11c010c7a100185c7bbc1b124a22-part5*”, NAME+=”oracleasm/disk-indexpart”, OWNER=”oracle”, GROUP=”dba”, MODE=”0660″

        Will work each time for your scsi partition.

    • However, if you want it to make the setup simple (which is highly recommended), and eliminate steps that are not necessary, go for the setup as described above. This means delete the partitions, and work with the whole disk.

  13. Alexander said:

    UDEV rules on scsi partitions for persistent device names no longer work in RHEL 5 and RHEL 6

    Cause: For CVE-2011-4127, the ability to send SCSI commands and most SCSI ioctls directly to partition devices has been removed. This was a security risk, as giving someone permission to open a partition allowed them to also send SCSI commands which could read or write outside of the partition, or negatively affect the functioning of the whole SCSI disk. Using scsi_id or the sg3_utils tools will no longer work on partitions.

    RHEL 5

    KERNEL==”sd*[!0-9]”, ENV{ID_SERIAL}==””, IMPORT{program}=”/lib/udev/scsi_id -g -x -s %p -d %d”
    KERNEL==”sd*[0-9]”, ENV{ID_SERIAL}==””, IMPORT{parent}==”ID_*”
    KERNEL==”sd*”, BUS==”scsi”, ENV{ID_SERIAL}==”36000d0774b5239414944495457363357″, SYMLINK+=”mydisk%n”

    RHEL 6

    KERNEL==”sd*[!0-9]”, ENV{ID_SERIAL}==””, IMPORT{program}=”/lib/udev/scsi_id –whitelisted –device=/dev/%k”
    KERNEL==”sd*[0-9]”, ENV{ID_SERIAL}==””, IMPORT{parent}==”ID_*”
    ENV{ID_SERIAL}==”36000d0774b5239414944495457363357″, SYMLINK+=”mydisk%n”

  14. Devin said:

    I really really want to bookmark this blog, “Using udev on RHEL 6 / OL 6 to
    change disk permissions for ASM | Frits Hoogland Weblog” Just Blinds on my site.

    Will you mind in the event I reallydo it? Thanks ,Tania

  15. Joey said:

    Because the admin of this website is working, no doubt very rapidly it will be renowned, due to its feature contents.

  16. Bob Peatman said:

    Thanks so much for this blog post! I have been using udev for ASM luns for the consistent naming and to chown oracle:dba but always on new LUNs built out of VMware datastores. I have been following:
    But yesterday I was working with an EMC VNX snap from a bare metal oracle server. When I set that up on my VM with RDM and had my new luns (/dev/sdb – /dev/sde) then did not have the disk label with one big partition. When I added it I stomped on some ASM metadata and the DBA’s tell me they showed up as ASM “candidate disks” but not members of the disk group. I started looking for a better udev rule because I saw I could see the disk WWN with /sbin/scsi_id so I figured
    I just needed the correct rule. This is when I found your blog post and now it is working fine. Thanks!

  17. phani said:

    Hi All, I am using RHEL 6.3. Oracle 11g R2. Taking an ZDB(Zero Down Time Backup). How to use udev in this case as the disk name will be generated dynamically. How to use udev in this case.

    I have set like belo as it is a test system

    ENV{DM_UUID}==”part[1]-mpath-?*”, OWNER:=”grid”, GROUP:=”asmadmin”, MODE:=”770″

    I can see the permission is getting changed during backup.
    Asm instance started. But it could not able to discover the disk groups.
    I run the command “show parameter asm” during backup after asm instance started.


    ———————————— ———– ——————————
    asm_diskgroups string
    asm_diskstring string /dev/*
    asm_power_limit integer 1
    asm_preferred_read_failure_groups string

    Can anyone help me why i am not able see the disk group ?

  18. Jordy Jones said:

    UDEV and UUIDs works great for setting disk consistency for Oracle ASM – for local storage. If you throw SRDF into the mix for recovery replication (disaster recovery) that gives you different UUIDs for the replicated disks.

    We just have to remap them in UDEV based on the original server, but it would be nice to have some sort of label that gets replicated with the disk. We use powerpath for our SAN disk multipathing.

  19. Cindy Yoho said:

    Thanks a bunch for this. Just moved to OEL 6 and of course I was using rc.local in OEL 5. Been trying forever it seems to get udev to do this. All the other suggestions just weren’t working for me, seems like they were making things a lot harder than they had to be. So glad I ran into your blog! Worked right off!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: