Tuesday, 2 April 2013

Difference between major and minor number

Major number:

A major number refers to a type of device, and a minor number specifies a particular device of that type or sometimes the operation mode of that device type.

    # lsdev -Cc tape
    rmt0 Available 3F-08-02 IBM 3580 Ultrium Tape Drive (FCP)
    rmt1 Available 3F-08-02 IBM 3592 Tape Drive (FCP)
    smc0 Available 3F-08-02 IBM 3576 Library Medium Changer (FCP)

In the list above:

rmt1 is a standalone IBM 3592 tape drive;

rmt0 is an LTO4 drive of a library;

smc0 is the medium changer (or robotic part) of above tape library.

Now look at their major and minor numbers:
    # ls -l /dev/rmt* /dev/smc*
    crw-rw-rwT 1 root system 38, 0 Nov 13 17:40 /dev/rmt0
    crw-rw-rwT 1 root system 38,128 Nov 13 17:40 /dev/rmt1
    crw-rw-rwT 1 root system 38, 1 Nov 13 17:40 /dev/rmt0.1
    crw-rw-rwT 1 root system 38, 66 Nov 13 17:40 /dev/smc0

All use IBM tape device driver (and so have the same major number of 38), but actually they are different entities (with minor number of 0, 128 and 66 respectively). Also, compare rmt0 and rmt0.1. It's the same device, but with different mode of operation.

0 blogger-disqus:

Post a Comment