Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Spun off from a small exchange in chat.

One of the primary advantages of udev is that you don't have to worry about major and minor device number exhaustion anymore. But the devices created by udev still have these numbers associated with them. How does udev cooperate with the kernel to create device files with the proper major and minor device numbers?

share|improve this question
up vote 3 down vote accepted

The kernel allocates a major:minor number, either statically (in drivers that do have a static allocation and haven't run out) or dynamically (in drivers that support dynamic allocation and have used up their static allotment). This number is listed in the message that the kernel sends to udev.

You can see the variables that udev sees about a device in /sys/devices/…/uevent. For example:

$ cat /sys/devices/virtual/mem/null/uevent 
$ cat /sys/block/sda/sda1/uevent 

The udev rules determine the name(s) and permissions of the device files. The device number comes from the kernel (it has to, since the kernel has already taken a decision and udev's job is to ensure that applications accessing the device by name will reach the number chosen by the kernel).

share|improve this answer

The device numbers aren't chosen at random, no matter what subsystem creates the devices. There is a device number standard, called the LANANA Linux Device List. If you install the kernel-documentation, check out Documentation/devices.txt.

share|improve this answer
While the choice isn't random, it is sometimes dynamic, in the blocks marked “local/experimental use” in the device list. – Gilles Dec 13 '13 at 0:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.