Change owner of LVM LV's device node in RHEL5

Solution 1:

The following should work (adapt as necessary):

# cat /etc/udev/rules.d/99-custom.rules
ENV{DM_NAME}=="system-test", ACTION=="add|change", MODE="0664", OWNER="michael", GROUP="disk", PROGRAM="/bin/logger /dev/$env{DM_NAME} owner changed to michael", SYMLINK+="oracle-$env{DM_NAME}"

Then you should get the result:

# lvcreate -L 1G /dev/system -n test
# ls -al /dev/dm-9 /dev/oracle-system-test /dev/system/test /dev/mapper/system-test
brw-rw-r-- 1 michael disk 253, 9 2009-08-08 01:20 /dev/dm-9
brw-r----- 1 root    disk 253, 9 2009-08-08 01:20 /dev/mapper/system-test
lrwxrwxrwx 1 root    root      4 2009-08-08 01:20 /dev/oracle-system-test -> dm-9
lrwxrwxrwx 1 root    root     23 2009-08-08 01:20 /dev/system/test -> /dev/mapper/system-test

I wasn't able to figure out how to modify the actual device node created by LVM, but I was able to modify the device-mapper node. I then added a symlink for oracle to access it with which is a bit of a hack, but works.

(my earlier answer was a little rushed and untested. But I got really curious how to do it right :)