UDEV setup for 10g RAW devices

Test Enviromment

  • OEL 5.10  with 10.2.0.1  RAC/CRS

Disk Layout

Used Virtualbox devices in SATA controller :
Raw-Devices for OCR:
/dev/sdb1 -> /dev/raw/raw1:  bound to major 8, minor 17  - Size:  1 GByte
/dev/sdc1 -> /dev/raw/raw2:  bound to major 8, minor 33  - Size:  1 GByte

Raw-Devices Voting disks:
/dev/sdd1 -> /dev/raw/raw3:  bound to major 8, minor 49  - Size:  1 GByte
/dev/sde1 -> /dev/raw/raw4:  bound to major 8, minor 65  - Size:  1 GByte
/dev/sdf1 -> /dev/raw/raw5:  bound to major 8, minor 81  - Size:  1 GByte

ASM Devices:
/dev/sdg1  - Size:  2 GByte
/dev/sdh1  - Size:  2 GByte
/dev/sdi1  - Size:  2 GByte
/dev/sdj1  - Size:  2 GByte 

Verify disk size with dd
# dd if=/dev/sdb1 of=/dev/null bs=1M
1019+1 records in
1019+1 records out

Note be careful not to mix ASM disks with Raw devices. If your create an ASM on top of a RAW disk
already used  OCR or voting disk will corrupt your RAW devices !

 

UDev File /etc/udev/rules.d/63-oracle-raw.rules

# cat  /etc/udev/rules.d/63-oracle-raw.rules
ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdc1", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdd1", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sde1", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="sd*", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VBc477f753-2ce5f51a_", RUN+="/bin/raw /dev/raw/raw5 %N"
KERNEL=="raw[1-2]*", OWNER="root", GROUP="oinstall", MODE="640"
KERNEL=="raw[3-5]*", OWNER="oracle", GROUP="oinstall", MODE="6
--> Always try to map your disk with /sbin/scsi_id ( like line 5 ) and not by using sdX devices ( line 1-4 )

Reboot or reload udev by running
# /sbin/udevcontrol reload_rules
# /sbin/start_udev

Check RAW devices 
# ls -l  /dev/raw/ra*
crw-r----- 1 root   oinstall 162, 1 Apr  5 12:21 /dev/raw/raw1
crw-r----- 1 root   oinstall 162, 2 Apr  5 12:21 /dev/raw/raw2
crw-r--r-- 1 oracle oinstall 162, 3 Apr  5 12:21 /dev/raw/raw3
crw-r--r-- 1 oracle oinstall 162, 4 Apr  5 12:21 /dev/raw/raw4
crw-r--r-- 1 oracle oinstall 162, 5 Apr  5 12:21 /dev/raw/raw5

# raw -qa
/dev/raw/raw1:  bound to major 8, minor 17
/dev/raw/raw2:  bound to major 8, minor 33
/dev/raw/raw3:  bound to major 8, minor 49
/dev/raw/raw4:  bound to major 8, minor 65
/dev/raw/raw5:  bound to major 8, minor 81
[root@ract2 ~]# ls /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1

# ls -ls /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1
0 brw-r----- 1 root disk 8, 17 Apr  5 12:21 /dev/sdb1
0 brw-r----- 1 root disk 8, 33 Apr  5 12:21 /dev/sdc1
0 brw-r----- 1 root disk 8, 49 Apr  5 12:21 /dev/sdd1
0 brw-r----- 1 root disk 8, 65 Apr  5 12:21 /dev/sde1
0 brw-r----- 1 root disk 8, 81 Apr  5 12:21 /dev/sdf1

 

Test Udev Rules

ACTION=="add", KERNEL=="sde1", RUN+="/bin/raw /dev/raw/raw4 %N"

# udevtest /block/sde/sde1
main: looking at device '/block/sde/sde1' from subsystem 'block'
udev_rules_get_name: add symlink 'disk/by-id/scsi-SATA_VBOX_HARDDISK_VBe8afac48-7e15465f-part1'
udev_rules_get_name: add symlink 'disk/by-path/pci-0000:00:0d.0-scsi-4:0:0:0-part1'
run_program: '/lib/udev/vol_id --export /dev/.tmp-8-65'
run_program: '/lib/udev/vol_id' returned with status 4
run_program: '/sbin/scsi_id -g -u -s /block/sde'
run_program: '/sbin/scsi_id' (stdout) 'SATA_VBOX_HARDDISK_VBe8afac48-7e15465f_'
run_program: '/sbin/scsi_id' returned with status 0
udev_rules_get_name: no node name set, will use kernel name 'sde1'
udev_device_event: device '/block/sde/sde1' already in database, validate currently present symlinks
udev_node_add: creating device node '/dev/sde1', major = '8', minor = '65', mode = '0640', uid = '0', gid = '6'
udev_node_add: creating symlink '/dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VBe8afac48-7e15465f-part1' to '../../sde1'
udev_node_add: creating symlink '/dev/disk/by-path/pci-0000:00:0d.0-scsi-4:0:0:0-part1' to '../../sde1'
main: run: 'socket:/org/kernel/dm/multipath_event'
main: run: 'socket:/org/kernel/udev/monitor'
main: run: '/lib/udev/udev_run_devd'
main: run: '/bin/raw /dev/raw/raw4 /dev/.tmp-8-65'
main: run: 'socket:/org/freedesktop/hal/udev_event'
main: run: '/sbin/pam_console_apply /dev/sde1 /dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VBe8afac48-7e15465f-part1 /dev/disk/by-path/pci-0000:00:0d.0-scsi-4:0:0:0-part1'

ACTION=="add", KERNEL=="sd*", PROGRAM=="/sbin/scsi_id -g -u -s /block/$parent", RESULT=="SATA_VBOX_HARDDISK_VBc477f753-2ce5f51a_", RUN+="/bin/raw /dev/raw/raw5 %N"

#  udevtest /block/sdf/sdf1
main: looking at device '/block/sdf/sdf1' from subsystem 'block'
udev_rules_get_name: add symlink 'disk/by-id/scsi-SATA_VBOX_HARDDISK_VBc477f753-2ce5f51a-part1'
udev_rules_get_name: add symlink 'disk/by-path/pci-0000:00:0d.0-scsi-5:0:0:0-part1'
run_program: '/lib/udev/vol_id --export /dev/.tmp-8-81'
run_program: '/lib/udev/vol_id' returned with status 4
run_program: '/sbin/scsi_id -g -u -s /block/sdf'
run_program: '/sbin/scsi_id' (stdout) 'SATA_VBOX_HARDDISK_VBc477f753-2ce5f51a_'
run_program: '/sbin/scsi_id' returned with status 0
udev_rules_get_name: no node name set, will use kernel name 'sdf1'
udev_device_event: device '/block/sdf/sdf1' already in database, validate currently present symlinks
udev_node_add: creating device node '/dev/sdf1', major = '8', minor = '81', mode = '0640', uid = '0', gid = '6'
udev_node_add: creating symlink '/dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VBc477f753-2ce5f51a-part1' to '../../sdf1'
udev_node_add: creating symlink '/dev/disk/by-path/pci-0000:00:0d.0-scsi-5:0:0:0-part1' to '../../sdf1'
main: run: 'socket:/org/kernel/dm/multipath_event'
main: run: 'socket:/org/kernel/udev/monitor'
main: run: '/lib/udev/udev_run_devd'
main: run: '/bin/raw /dev/raw/raw5 /dev/.tmp-8-81'
main: run: 'socket:/org/freedesktop/hal/udev_event'
main: run: '/sbin/pam_console_apply /dev/sdf1 /dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VBc477f753-2ce5f51a-part1 /dev/disk/by-path/pci-0000:00:0d.0-scsi-5:0:0:0-part1'

Of course your can re-execute statments generated from  udevtest command
[root@ract2 etc]# /bin/raw /dev/raw/raw5 /dev/.tmp-8-81
/dev/raw/raw5:  bound to major 8, minor 81

Reference

Leave a Reply

Your email address will not be published. Required fields are marked *