Originally Posted by sundialsvcs
Every such device is identified by a pair of numbers, referred to as the "major" and "minor" device-numbers, respectively.
Well... mostly. The major/minor numbers ORIGINALLY represented two index values into a table.
The major number is the index/subscript into a device driver table. The minor number is the index/subscript into a unit table with the the device driver table.
In the current Linux system, these numbers are actually not used much. The /dev directory is a memory resident filesystem that has entries created when controllers/devices are identified. This allows a faster access to the device by allowing the memory resident structure (not reflected in the major/minor numbers) to have direct links to the referenced data structure that used to be done using the major/minor numbers. Using the major/minor indexing requires two operations - first verify that the major index is valid (identifying the driver), use that to identify the minor list(the unit within that driver), then verify the minor index is valid, then use the result to perform the I/O operation. The direct link is either null (no such device) or valid - reducing the overhead significantly.
The other reason for not using the major/minor numbers is storage. The inode used to hold these values is a 32 bit value (originally 16 bits), so spliting that 32 bits up is a bit tricky - some controllers may use 12 bits to identify the major (driver), leaving 20 bits for the minor (unit)... This is the current default. Problems will occur when more than 4096 drivers exist at a time. One reason it is tricky is disks - the minor number is split up into two parts: one to identify the disk drive (the actual unit), and the other to identify the partition. The problem is how to identify the bits needed for each part...
Current kernels use devtmpfs (a derivitive of devfs, but is managed entirely within the kernel).
A little follow up - you can identify what drivers the major number is associated with, they are listed in the file /proc/devices. There are two sets - one for character devices, one for block devices (so the major number could be for either one, and seeing a given number in a /dev entry, you also have to look to see if it is a block or character device reference...)
You can see the block device table (with minor references) in the file /proc/partitions. This lists the major/minor number along with the size and current device name.
I say "current" here, because the name can change on each boot (as can the major/minor number for that matter). This is because the kernel assigns these values during device initialization. Devices that get added later get the next available number, but if you have 3 disks (sda/sdb/sdc), and the physical device sdb is not plugged in at boot, then the devices get named sda/sdb - and the physical disk FORMERLY identified as sdc becomes sdb...
This is why using device names in the /etc/fstab file is depreciated - use the UUID or volume name. These values are assigned when the partition is initialized, and are static as the system will read these values during initialization, which makes them available during the rest of the system initialization (specifically, when the system uses the /etc/fstab file to mount the partitions).