Creating RAW devices on RHEL5.

The rawdevices service and /etc/sysconfig/rawdevices file no longer exist in RHEL5 and raw devices are now configured via udev rules.

Creating the raw devices:


Nevertheless, to create raw devices, add entries to /etc/udev/rules.d/60-raw.rules in the following formats:
Quote:
ACTION=="add", KERNEL=="", RUN+="raw /dev/raw/rawX %N"


If using unpartitioned LUNs:
Quote:
ACTION=="add", KERNEL=="sd*[!0-9]", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="3600601601bd2180072193a9242c3dc11", RUN+="/bin/raw /dev/raw/raw1 %N"


If using partitioned LUNs:
Quote:
ACTION=="add", KERNEL=="sd*[0-9]", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="3600601601bd2180072193a9242c3dc11", RUN+="/bin/raw /dev/raw/raw%n %N"


Setting ownership and permissions on the raw devices:


Quote:
ACTION=="add", KERNEL=="raw*", OWNER=="root", GROUP=="disk", MODE=="0660"



Testing and implementing the udev rules:


udevtest /class/raw/raw1 | grep mode

Finally, to actually create the raw device(s), use the start_udev command:

Quote:
[root@rhel5 rules.d]# start_udev
Starting udev: [ OK ]


Check that the raw device(s) have been created:


Quote:
[root@rhel5 rules.d]# raw -qa
/dev/raw/raw1: bound to major 8, minor 17
[root@rhel5 rules.d]# ls -l /dev/raw
total 0
crw-rw---- 1 root disk 162, 1 Jan 29 02:47 raw1



Verify that a raw device is configured properly to use Direct Access Storage Device:


Warning: This test will erase the data on your device. Be sure not to use it on devices which contain important data.
Quote:
# dd if=/dev/zero of=/dev/raw/raw1 bs=512 count=100
# dd if=/dev/raw/raw1 bs=512 count=100 | od -atx1
0000000 nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
100 0 records in
100 0 records out
0144000

Comments

Popular posts from this blog

configure Netbackup email notification on Unix