Using udev to simplify HP Serviceguard for Linux configuration, March 2014

Technical white paper | Using udev to simplify HP Serviceguard for Linux configuration
5
If you are using multipath devices (DM devices), append the following rule to the
/etc/udev/rules.d/10-HP-Local.rules file:
SUBSYSTEM==”block”, KERNEL==”dm*”, PROGRAM=”/lib/udev/scsi_id
--page=0x83 --whitelisted --replace-whitespace
--device=/dev/%k”,
RESULT==”360060e80042747000000274700000315”,
SYMLINK=”hpdev/mylink-dm”
Where 360060e80042747000000274700000315 is the output of
“/lib/udev/scsi_id --page=0x83 --whitelisted
--replace-whitespace /dev/dm-1” command
Suppose there exists a softlink from /dev/mapper/mpath1 to /dev/dm-1 and /dev/mapper/mpath1 has
a partition /dev/mapper/mpath1p1. If there exists a softlink from /dev/mapper/mpath1p1 to
/dev/dm-2, append the following rule in /etc/udev/rules.d/10-HP-Local.rules file:
SUBSYSTEM==”block”, KERNEL==”dm*”, PROGRAM=”/bin/sh /root/myscript.sh /dev/%k”,
RESULT==”360060e80042747000000274700000315”,
SYMLINK=”hpdev/mylink-dmp1”
Where 360060e80042747000000274700000315 is the output of
“/lib/udev/scsi_id --page=0x83 --whitelisted
--replace-whitespace /dev/dm-1” command
and the following is the output of cat /root/myscript.shcommand:
#!/bin/sh
device=$1
devname=”/dev/mapper/”`/sbin/dmsetup info ${device} | /bin/grep “Name” |
/bin/awk ‘{print $NF}’`
pat=”p[0-9]+$”
if [[ $devname =~ $pat ]]; then
dev=`/bin/echo ${devname} | /bin/sed -r -e ‘s/_part[0-9]+$//’ -e
‘s/p[0-9]+$//’`
/lib/udev/scsi_id --page=0x83 --whitelisted --replace-whitespace ${dev}
fi
Note:
You have to add the extra rule only for Red Hat 6 and Red Hat 5 if the disk has partitions. For Novell SLES 11 SP1 and Novell
SLES 11 SP2, the rules mentioned in the respective sections suffice for the disks having partitions also.
Note:
On Red Hat 5, udev rules cannot be written for multipath devices (DM device).
Note:
Delete the blank lines from the /etc/udev/rules.d/10-HP-Local.rules file. The blank lines have non-printing
characters that cannot be interpreted by udev. Blank lines and comment lines beginning with “#” can then be added. Write
rule for one disk in one line. Do not use newline character within a rule.
Creating links for persistence
You can create a single link or multiple links for persistence.
To create a single persistence link, enter the following command:
For Red Hat 5:
# udevtrigger