Device names, device nodes, and major/minor numbers

Red Hat Enterprise Linux 8.6 LPAR mode z/VM guest KVM guest

The Linux® kernel represents character and block devices as pairs of numbers <major>:<minor>.

Some major numbers are reserved for particular device drivers. Other major numbers are dynamically assigned to a device driver when Linux boots. For example, major number 94 is always the major number for DASD devices while the device driver for channel-attached tape devices has no fixed major number. A major number can also be shared by multiple device drivers. See /proc/devices to find out how major numbers are assigned on a running Linux instance.

The device driver uses the minor number <minor> to distinguish individual physical or logical devices. For example, the DASD device driver assigns four minor numbers to each DASD: one to the DASD as a whole and the other three for up to three partitions.

Device drivers assign device names to their devices, according to a device driver-specific naming scheme. Each device name is associated with a minor number.

Figure 1. Minor numbers and device names
This graphic shows a minor number with a pointer to a device and its name as known by a device driver

User space programs access character and block devices through device nodes also referred to as device special files. When a device node is created, it is associated with a major and minor number.

Figure 2. Device nodes
This graphic shows a device node of the form /dev/<device_name> pointing to a major:minor number in the kernel

Red Hat® Enterprise Linux 8.6 uses udev to create device nodes for you. There is always a device node that matches the device name that is used by the kernel, and additional nodes might be created by special udev rules. See the udev man page for more details.