Ask Your Question
3

What do major and minor refer in the command 'mknod' ?

asked 2013-08-29 09:54:29 -0600

baptistemm gravatar image

Hello,

reading the man page of mknod there is 2 optional parameters which are 'MAJOR' and 'MINOR'. What doe these numbers refer to and what are their use ?

thanks

Regards

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
3

answered 2013-08-29 11:04:52 -0600

rheldaemon gravatar image

Hi

Interesting question and it is already answered at stackoverflow here is the link: http://stackoverflow.com/questions/1823743/knowing-a-device-special-file-major-and-minor-numbers-in-linux and study the first answer which contains all information. IMHO one of the best answers about mknod, IBM's documentation is also great: http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/mknod.htm

-HTH

edit flag offensive delete link more

Comments

Your link answers my other related question (are the ids at each boot or well-defined?) I found what I was looking for on http://www.lanana.org/docs/device-list/devices-2.6+.txt.

baptistemm gravatar imagebaptistemm ( 2013-08-29 12:33:57 -0600 )edit
3

answered 2013-08-29 11:47:03 -0600

Gareth Jones gravatar image

updated 2013-08-29 11:48:55 -0600

There’s plenty on the web, as rheldaemon points out, but as a (simplified) quick summary:

When a device driver is loaded in Linux, it requests a unique ID (number) from the kernel. This is the major number. For each device that the driver provides support for, it allocates a unique (to the driver) ID, the minor number.

The kernel puts that information in virtual files in /sys. The kernel and UDev daemon between them maintain the files in /dev, which are essentially just aliases allowing software to identify and access devices. They’re basically just files containing the major and minor numbers (just like symbolic links contain file-names), and when a device node is opened, the numbers are used by the kernel to identify the driver and device that will handle the I/O.

edit flag offensive delete link more

Comments

thanks for the answer

baptistemm gravatar imagebaptistemm ( 2013-08-29 12:32:21 -0600 )edit

Question Tools

Stats

Asked: 2013-08-29 09:54:29 -0600

Seen: 2,889 times

Last updated: Aug 29 '13