Check major/ minor device number in Linux


In Linux world, everything is presented as a file in /dev to users no matter it is disk, network adapter or any other devices. In the background, kernel manages all the devices. To be specific, through the device drivers in the kernel.

The devices controlled by the same device driver have a common device number which is referred as major number. The number is used to distinguish between differentdevice are called minor number.

Examples:

– Check the disk, memory and mouse major/ minor device number

[jchen@fedora ~]$ ll /dev/sda1
brw-rw—-. 1 root disk 8, 1 Sep 1 09:01 /dev/sda1
[jchen@fedora ~]$ ll /dev/mem
crw-r—–. 1 root kmem 1, 1 Sep 1 09:01 /dev/mem
[jchen@fedora ~]$ ll /dev/input/mice
crw——-. 1 root root 13, 63 Sep 1 09:01 /dev/input/mice

– Check the mounted file system either mount folder (mountpoint -d <folder>) or device (mountpoint -x <device>)

[jchen@fedora ~]$ mountpoint -d /home
253:2
[jchen@fedora ~]$ mountpoint -x /dev/mapper/fedora_1004521-home
253:2
[jchen@fedora ~]$ mountpoint -x /dev/sda1
8:1

Reference:
http://www.linux-tutorial.info/modules.php?name=MContent&pageid=94
http://man7.org/linux/man-pages/man1/mountpoint.1.html
http://www.linux.org/threads/what-are-those-dev-files.4713/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s