Proc filesystem - diskstats
The /proc/diskstats file displays the I/O statistics of block devices.
Here we have a system which has one disk sda used by Linux operating system and two disks sdb sdc for other purpose.
$ cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)
$ uname -r
3.10.0-1160.11.1.el7.x86_64
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 128G 0 disk
├─sda1 8:1 0 3.7G 0 part /boot
└─sda2 8:2 0 124.3G 0 part /
sdb 8:16 0 60G 0 disk
sdc 8:32 0 60G 0 disk
The following is the content of /proc/diskstats file.
$ cat /proc/diskstats
8 0 sda 20076 3 798556 75864 23573766 4732398 253002144 24887356 0 9814563 24947775
8 1 sda1 143 0 22434 681 44 21 21664 588 0 397 1269
8 2 sda2 19905 3 774042 75034 23573722 4732377 252980480 24886768 0 9814404 24946360
8 32 sdc 88 0 4160 4 0 0 0 0 0 4 4
8 16 sdb 88 0 4160 2 0 0 0 0 0 2 2
Taking the sda line for example, the following explains the meaning of each column.
- 8 - major number
- 0 - minor number
- sda - device name
- 20076 - reads completed successfully
- 3 - reads merged
- 798556 - sectors read
- 75864 - time spent reading (ms)
- 23573766 - writes completed
- 4732398 - writes merged
- 253002144 - sectors written
- 24887356 - time spent writing (ms)
- 0 - I/Os currently in progress
- 9814563 - time spent doing I/Os (ms)
- 24947775 - weighted time spent doing I/Os (ms)
You may see more columns from the /proc/diskstats file if the kernel version is 4.18+ or 5.5+. For the detailed explanation, please refer to the documentation.