LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Major and Minor numbers with partitions (https://www.linuxquestions.org/questions/linux-newbie-8/major-and-minor-numbers-with-partitions-677811/)

raj_hcl1986@rediffma 10-20-2008 09:15 AM

Major and Minor numbers with partitions
 
HI

Pls tell me what are major and minor nos given with different partitions in /proc/partitions.

i92guboj 10-20-2008 09:56 AM

The info you seek is on the Documentation/devices.txt file on your kernel source tree.

A little fragment as an example:

Code:

  8 block SCSI disk devices (0-15)
      0 = /dev/sda    First SCSI disk whole disk
    16 = /dev/sdb    Second SCSI disk whole disk
    32 = /dev/sdc    Third SCSI disk whole disk
        ...
    240 = /dev/sdp    Sixteenth SCSI disk whole disk

    Partitions are handled in the same way as for IDE
    disks (see major number 3) except that the limit on
    partitions is 15.

Mine are:

Code:

brw-rw---- 1 root disk 8,  0 oct 18 17:11 /dev/sda
brw-rw---- 1 root disk 8,  1 oct 18 15:11 /dev/sda1
brw-rw---- 1 root disk 8,  2 oct 18 17:11 /dev/sda2
brw-rw---- 1 root disk 8, 16 oct 18 17:11 /dev/sdb
brw-rw---- 1 root disk 8, 17 oct 18 15:11 /dev/sdb1
brw-rw---- 1 root disk 8, 18 oct 18 17:11 /dev/sdb2
brw-rw---- 1 root disk 8, 32 oct 18 17:11 /dev/sdc
brw-rw---- 1 root disk 8, 33 oct 18 17:11 /dev/sdc1
brw-rw---- 1 root disk 8, 42 oct 18 15:11 /dev/sdc10
brw-rw---- 1 root disk 8, 43 oct 18 17:11 /dev/sdc11
brw-rw---- 1 root disk 8, 34 oct 18 15:11 /dev/sdc2
brw-rw---- 1 root disk 8, 35 oct 18 17:11 /dev/sdc3
brw-rw---- 1 root disk 8, 37 oct 18 17:11 /dev/sdc5
brw-rw---- 1 root disk 8, 38 oct 18 15:11 /dev/sdc6
brw-rw---- 1 root disk 8, 39 oct 18 17:11 /dev/sdc7
brw-rw---- 1 root disk 8, 40 oct 18 17:11 /dev/sdc8
brw-rw---- 1 root disk 8, 41 oct 18 17:11 /dev/sdc9

You can see that the disks are numbered with major 8, which is the number for scsi drives (SATA disks are seen as SCSI drives) as said on the header of that section (8 block SCSI disk devices). There are several numbers for IDE drives, grep that file to see them.

Minor numbers are as specified. The whole device is numbered as 0, 16, 32.. (n-1)*16. The partitions are numbered with the minor number for the drive + the number of partition. Thus, if sdb is 16, sdb1 is 17. Note that it's the partition number which counts, and not the order. For example, if sdc is 32, sdc3 is 35, and sdc5 is 37 even if sdc4 doesn't exist.

For more complete info look at that file and/or the kernel source code.

raj_hcl1986@rediffma 10-20-2008 10:15 AM

Gr8. It was useful. Thanks

fmillion 05-12-2013 06:07 PM

incorrect post replied to, please ignore


All times are GMT -5. The time now is 05:23 PM.