1

My understanding is that device nodes in Linux have major and minor numbers that help the kernel identify the device driver module.

I am trying to understand how is the major/minor number used to locate the kernel module used for device driver.

For instance, following block nodes are setup by udev for my hard-drive

sshekhar1980@:~$ ls -l /dev/sd*
brw-rw---- 1 root disk 8, 0 May 29 07:43 /dev/sda
brw-rw---- 1 root disk 8, 1 May 29 07:43 /dev/sda1
brw-rw---- 1 root disk 8, 2 May 29 07:43 /dev/sda2
brw-rw---- 1 root disk 8, 3 May 29 07:43 /dev/sda3
brw-rw---- 1 root disk 8, 5 May 29 07:43 /dev/sda5
brw-rw---- 1 root disk 8, 6 May 29 07:43 /dev/sda6

Now I would like to use the major device number 8 above to find what kernel module device driver maybe used to talk to this hard-drive? Can I give this number to some program like modinfo or lsmod to find the device driver module being used?

  • Try udevadm info -a -p $(udevadm info -q path -n /dev/sda), look at DRIVERS and SUBSYSTEM. This still doesn't tell you the exact module, but gives you a good idea what you are dealing with. Usually it will be a whole bunch of modules, not a single one. – dirkt May 29 '17 at 15:39