How To Identify Major and Minor Number For Block Devices in Unix

by Ramesh Natarajan on June 26, 2009

Question: How do I find out the major and minor number of my block device / partition / mount points / SAN disk / filesystem?

Why do you need to know major and minor device number?

Sometimes you may need to know the major and minor number of devices for various reasons. For example, sar utility reports the i/o data of filesystems in the format of devm-n as shown below. (m is major number and n is minor number)

From sar man page following is the meaning for the DEV column shown below:

-d     Report activity for each block device (kernels  2.4  and  newer
       only).  When data is displayed, the device specification dev m-
       n is generally used ( DEV column).  m is the  major  number  of
       the  device.   With  recent  kernels (post 2.5), n is the minor
       number of the device, but is only a sequence  number  with  pre
       2.5 kernels.


By looking at the sar output below, we cannot tell what mount point (filesystem) dev110-1 indicates. In this case, you know that this device represents a block device that has a major number 110 and minor number 1.

$ sar -d
Linux 2.6.9-67.0.0.0.1.ELsmp (webserver)        06/21/2009

12:00:00 AM    DEV              tps    rd_sec/s  wr_sec/s
12:02:00 AM    dev110-1        6.00      0.00      6.00
12:02:00 AM    dev8-1           1.00      1.00      0.00
12:02:00 AM    dev1-1           2.00      1.00      1.00
12:02:00 AM    dev1-2           1.00      0.00      1.00
12:02:00 AM    dev1-3           4.00      2.00      2.00
12:02:00 AM    dev1-4           5.00      3.00      2.00

df -k will not display major and minor number

In the following example, when you perform a df -k, it shows that you have a local SCSI hard drive partition (/dev/sda1) mounted as / (root) and a SAN device partition (/dev/san-device1) mounted as /home/mysql. Please note that the SAN device can be a EMC, NetApps or any kind of SAN storage.

$ df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1             10317828   2353828   7439884  25% /
/dev/sandevice1   50537528  22350656  25619688  47% /home/mysql

How to identify major and minor device number?

Now, if you want to know the major and minor number of these devices, cd to /dev directory and do ls -l as shown below, which will show both major and minor number

$ cd /dev

$ ls -l sd*
brw-rw----  1 root disk 8,  0 Feb  8  2008 sda
brw-rw----  1 root disk 8,  1 Feb  8  2008 sda1

[Note: Major for /dev/sda1 is 8 and minor is 1]

$ ls -l san*
brw-------  1 root root 110,  0 Feb 8 sandevice
brw-------  1 root root 110,  1 Feb 8 sandevice1

[Note: Major for /dev/sandevice1 is 110 and minor is 1]

  • sda1 – Major number is 8 and Minor number is 1
  • sandevice1 – Major number is 110 and Minor number is 1


With this information now you can identify the corresponding device that is reported in the sar -d output.

$ sar -d
Linux 2.6.9-67.0.0.0.1.ELsmp (webserver)        06/21/2009

12:00:00 AM    DEV              tps    rd_sec/s  wr_sec/s
12:02:00 AM    dev110-1        6.00      0.00      6.00
12:02:00 AM    dev8-1           1.00      1.00      0.00

[Note: Now, we know dev110-1 is /dev/sandevice1 and
                    dev8-1 is /dev/sda1 ]

Major number for SCSI and IDE drives

The major numbers for SCSI and IDE doesn’t change and has the following hard-coded value.

  • SCSI (/dev/sd?) Major Number is 8
  • IDE (/dev/hd?) Major Number is 3

Linux Sysadmin Course Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them, you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools, which will help you to become an effective Linux system administrator.
Get the Linux Sysadmin Course Now!

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

{ 1 comment… read it below or add one }

1 RAMAKRISHNAREDDY KALLI October 9, 2009 at 7:05 am

Really very usefull information you people are providing thanks again and again.

Leave a Comment

Previous post:

Next post: