6

What types of devices fall under the major device number category and what types of devices fall under the minor device number category. What is the real difference between the two categories?

5

All devices have a major, minor number pair. The major number is a larger, more generic category (e.g. hard disks, input/output devices etc...) while the minor number is more specific (i.e. tells what bus the device is connected to).

Check the kernel documentation for more examples.

  • 1
    The list of device numbers is no longer at that location in the Linux kernel source tree. Do you know where it moved to? – Nate Eldredge Aug 4 '17 at 17:32
1

The major device number identifies the driver (e.g. IDE disk drive, floppy disk, parallel port, serial port, ...) and the minor number identifies the specific device (i.e., the first floppy would have minor 0, the second would be 1, ...).

  • If we had a hard disk, floppy disk, and a parallel port, would the hard disk be minor 0, floppy disk minor 1, and parallel port minor 2? – Referential Apr 28 '13 at 21:12
  • No. Major numbers are fixed. E.g. SCSI drives at major 8. The first SCSI drive is (8,0), the second drive (8,1), the third (8,2) etc etc. Even if you have no other major devices that will still stay fixed at 8. Same with every other device. The M coded into the drivers and will always be the same. – Hennes Apr 28 '13 at 21:21
  • @Referential, no. The first IDE controller has major number 3, on it the master is block minor 0 and the slave 1; floppy major is block 2, parallel port is char 6, minor identifies the port. The number belongs to the driver, independent of a device being present (or even if the driver is compiled into the kernel at all). LANANA (Linux Assigned Names And Numbers Authority) is in charge of allocating them. – vonbrand Apr 28 '13 at 21:23
  • Which types of devices would specifically fall under the minor device number category? I thought that the minor device number category mirrors the major device number (eg: hard disk 1 has a major device number and the minor number identifies it as a hard drive). If someone can please give me a few more examples. Thanks – Referential Apr 29 '13 at 0:07
  • @Referential There are a few devices that can only exist in one copy, they don't have minor device numbers. Each time a device can be present seveal times, they are numbered by a minor number. Major is device type (driver), minor is device number (instance). – vonbrand Apr 29 '13 at 0:47
0

Maybe you are interested on the LANANA device list: http://www.lanana.org/docs/device-list/ that descrives the major codes.

As @Renan says, minor depends on the device.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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