SCSI LUN Disk permission operation using udev rules on RedHat 5

If you are working with RedHat 5.x and SCSI LUNs before adding your disks into your ASM diskgroups , creating RAWs can be an easy way to manage permissions. Let’s do an example :

For example your storage admin gave you 2 LUNs. One is /dev/sdb1 and the other one is /dev/sdc1.

1- ) Assigning these LUNs to RAWs

[root@ora1 ~]# raw /dev/raw/raw1 /dev/sdb1

[root@ora1 ~]# raw /dev/raw/raw2 /dev/sdc1

[root@ora2 ~]# raw /dev/raw/raw1 /dev/sdb1

[root@ora2 ~]# raw /dev/raw/raw2 /dev/sdc1

2- ) Please add these two rows in /etc/sysconfig/rawdevices
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdc1

3- ) Now we are creating a new file like 88-raw.rules under /etc/udev/rules.d/ and writing down this entry:

KERNEL==”raw[1-2]*”, OWNER=”oracle”,GROUP=”dba”, MODE=”640″

If you have 3 RAWs , it will be KERNEL==”raw[1-3]*”, … as well.

That’s all. Now you can discover your disks to add them into your ASM.

Good Luck 🙂

Disk permission operation using udev rules on RedHat 6

Changing disk permission can be perform using udev. Let’s see an example :

1- ) Fetch the unique disk id with scsi_id.

[root@ora1 ~]# scsi_id -g -u -d /dev/sdb

This command returns a unique id like “20a0c2b147c3ae84b74a42b058e8a7c3ae84b74a42b0a393"

2- ) A new udev file will be used for giving permission (But really new)

[root@ora1 ~]# cd /etc/udev/rules.d/

[root@ora1 ~]# more 88-oracle-disks.rules

KERNEL=="sd*", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="20a0c2b147c3ae84b74a42b058e8a7c3ae84b74a42b0a393", NAME+="raw/raw1", OWNER="oracle", GROUP="dba", MODE="0660"

[root@ora1 ~]#

Disk will be created under /dev, i.e., raw/raw1 means disk’s location is /dev/raw/raw1.

As you see this rule has serial id of the disk (20a0c…393) ,disk name (raw/raw1), mode (0660) and group-owner  information.

After creating this rule , please reboot host(s) and kindly check if you can discover your disk under “/dev/raw/*”

You can find a very good article about this topic in Frits Hoogland’s blog. Here is the link.

Good Luck 🙂