List block device information

[root@ansible1 ~]# sar -d
Linux 3.10.0-514.6.1.el7.x86_64 (ansible1) Monday 13 February 2017 _x86_64_ (1 CPU)

09:10:02 UTC DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util
09:20:01 UTC dev8-0 0.30 0.33 3.66 13.36 0.00 14.01 2.31 0.07
Average: dev8-0 0.30 0.33 3.66 13.36 0.00 14.01 2.31 0.07

List block device information

[root@ansible1 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 10G 0 disk
└─sda1 8:1 0 10G 0 part /
NAME : This is the device name.

MAJ:MIN : This column shows the major and minor device number.

RM : This column shows whether the device is removable or not. Note in this example the device sdb and sr0 have their RM values equals to 1 indicating they are removable.

SIZE : This is column give information on the size of the device. For example 298.1G indicate the device is 298.1GB and 1K indicate the device size is 1KB.

RO : This indicates whether a device is read-only. In this case all devices have a RO=0, indicating they are not read only.

TYPE :This column shows information whether the block device is a disk or a partition(part) within a disk. In this example sda and sdb are disks while sr0 is a read only memory (rom).

MOUNTPOINT : This column indicates mount point on which the device is mounted.
MAJ:MIN : This column shows the major and minor device number.

All devices have a major, minor number pair. The major number is a larger, more generic category (e.g. hard disks, input/output devices etc…) while the minor number is more specific (i.e. tells what bus the device is connected to).
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
———-
sda – Major number is 8 and Minor number is 1
sandevice – Major number is 110 and Minor number is 1
———-
[root@ansible1 ~]# cat /proc/devices
Character devices:
1 mem
4 /dev/vc/0
4 tty
4 ttyS
5 /dev/tty
5 /dev/console
5 /dev/ptmx
7 vcs
10 misc
13 input
21 sg
29 fb
99 ppdev
128 ptm
136 pts
162 raw
180 usb
188 ttyUSB
189 usb_device
202 cpu/msr
203 cpu/cpuid
249 hidraw
250 usbmon
251 bsg
252 watchdog
253 rtc
254 tpm

Block devices:
259 blkext
8 sd
9 md
65 sd
66 sd
67 sd
68 sd
69 sd
70 sd
71 sd
128 sd
129 sd
130 sd
131 sd
132 sd
133 sd
134 sd
135 sd
254 mdp

[root@ansible1 ~]# ls -l /dev/sd*
brw-rw—- 1 root disk 8, 0 Feb 8 22:51 /dev/sda
brw-rw—- 1 root disk 8, 1 Feb 8 22:51 /dev/sda1

[root@ansible1 ~]# ls -l /dev/ |grep disk
drwxr-xr-x 6 root root 120 Feb 8 22:51 disk
crw-rw—- 1 root disk 10, 237 Feb 8 22:51 loop-control
brw-rw—- 1 root disk 8, 0 Feb 8 22:51 sda
brw-rw—- 1 root disk 8, 1 Feb 8 22:51 sda1
crw-rw—- 1 root disk 21, 0 Feb 8 22:51 sg0

[root@ansible1 ~]# sar -d
Linux 3.10.0-514.6.1.el7.x86_64 (ansible1) Monday 13 February 2017 _x86_64_ (1 CPU)

09:10:02 UTC DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util
09:20:01 UTC dev8-0 0.30 0.33 3.66 13.36 0.00 14.01 2.31 0.07
Average: dev8-0 0.30 0.33 3.66 13.36 0.00 14.01 2.31 0.07

 

Advertisements

One thought on “List block device information

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