UDEV rules for device persistency-ownerships in REDHAT 6.1 for ASM
In linux ASMLib is used to make sure device persistency and ownership after a reboot.UDEV is another alternative to ASMlib to achieve device persistency and ownership on devices. This article outlines the steps that are required to establish device persistency and setup new device names with desired permissions and ownership in REDHAT6.1 using udev.
Universally Unique Identifiers (UUIDs) are a standardized method for identifying computers and devices in distributed computing environments. This section uses UUIDs to identify iSCSI, SRP, or Fibre Channel LUNs. UUIDs persist after restarts, disconnection and device swaps. The UUID is similar to a label on the device.
[root@dbsl2001 etc]# cat redhat-release
Red Hat Enterprise Linux Server release 6.1 (Santiago)
Single path configuration
[root@dbsl2001 etc]# scsi_id –whitelisted –replace-whitespace –device=/dev/sdd
Verify the UUID output from the scsi_id –whitelisted –replace-whitespace –device=/dev/sd* command is correct and as expected.
Create a rule to name the device. Create a file named 20-names.rules in the /etc/udev/rules.d directory. Add new rules to this file. All rules are added to the same file using the same format. Rules follow this format:
KERNEL==”sd*”, SUBSYSTEM==”block”, PROGRAM=”/sbin/scsi_id –whitelisted –replace-whitespace /dev/$name”, RESULT==”UUID”, NAME=”devicename”,OWNER=”<OS user>”, GROUP=”,OS group>”, MODE=”0660?
Replace UUID and devicename with the UUID retrieved above, and a name for the device. This is an example for the rule above for three example iSCSI luns:
KERNEL==”sd*”, SUBSYSTEM==”block”, PROGRAM=”/sbin/scsi_id –whitelisted –replace-whitespace /dev/$name”, RESULT==”14f504e46494c45525971777468462d5a3277382d42727976″, NAME=”asm1″,OWNER=”grid”,GROUP=”dba”,MODE=”0660″
[root@dbsl2001 rules.d]# udevadm test /block/sdd
[root@dbsl2001 rules.d]# start_udev
Starting udev: [ OK ]
Check the names, ownerships and permissions of the devices.
[root@dbsl2001 rules.d]# ls -la /dev/asm*
brw-rw—-. 1 grid disk 8, 49 Sep 5 00:20 /dev/asm1