Using udev to create a character device based on a driver being loaded

Posted by SteveCB on Server Fault See other posts from Server Fault or by SteveCB
Published on 2010-11-26T05:50:55Z Indexed on 2011/01/05 11:55 UTC
Read the original article Hit count: 247

Filed under:
|
|
|

I'm in the process of setting up RAID monitoring for a number of Dell servers that use the PERC 6i integrated card. We're using Nagios at present and the check_megasasctl plugin seems to fit the bill. However, the plugin relies upon the existence of:

/dev/megaraid_sas_ioctl_node

This device node doesn't exist by default, you have to create it by hand using something like:

mknod /dev/megaraid_sas_ioctl_node c 253 0

Now, to make the existence of this device node persistent across reboots, I thought I could write a udev rule, but as usual, I'm missing something. I thought I could create a file such as /etc/udev/rules.d/10-local/rules that contained:

DRIVER=="megasas" NAME="megaraid_sas_ioctl_node" MODE="0600"

But this doesn't work - no device node after a reboot. Dmesg output indicates the megasas driver is loaded and functional:

megasas: 00.00.04.01-RH1 Thu July 10 09:41:51 PST 2008
megasas: 0x1000:0x0060:0x1028:0x1f0c: bus 1:slot 0:func 0
megasas: FW now in Ready state

Further, I don't see any means to instruct udev on which type of device node to create: character or block. I suspect I'm failing to understand exactly how udev is meant to work.

I realise I could just cheat and run MegaCLI in /etc/rc.local, redirecting output to /dev/null; it creates the megaraid_sas_ioctl_node device node as part of its execution. I just thought using udev rules would be a) cleaner and b) a useful learning exercise. Perhaps I should just dump the above mknod command in /etc/rc.local...

So how do I get udev to create the /dev/megaraid_sas_ioctl_node device node based on the presence of the megasas driver?

Cheers

Steve

© Server Fault or respective owner

Related posts about linux

Related posts about raid