What is the best way to calculate & verify, how much I/O's are received on a disk?

Solution 1:

For live monitoring of read/write throughput to specific disks or partitions, you can use the tool nmon. It displays the absolute data rates per partition/disk as well as estimates how busy each one is in percent, including a nice bar chart.

You can install it using:

sudo apt install nmon

After that invoke it either as nmon and then press D to show the disk monitor, or run it as NMON=d nmon to directly display the disk monitor without further input. The refresh rate is 2 seconds by default, but you can manually change that using the -s parameter, e.g. nmon -s 1 for 1 second. To quit nmon, press Q or Ctrl+C.

Here's an example how it looks:

┌nmon─14g─────────────────────Hostname=type40mark3──Refresh= 6secs ───16:26.08─┐
│ Disk I/O ──/proc/diskstats────mostly in KB/s─────Warning:contains duplicates─│
│DiskName Busy  Read WriteMB|0          |25         |50          |75       100|│
│sda        0%    0.0    0.0|>                                                |│
│sda1       0%    0.0    0.0|>                                                |│
│sda2       0%    0.0    0.0|>                                                |│
│sda3       0%    0.0    0.0|>                                                |│
│sda4       0%    0.0    0.0|>                                                |│
│sda5       0%    0.0    0.0|>                                                |│
│sdb       49%  230.5    0.0|RRRRRRRRRRRRRRRRRRRRRRRRR                        >│
│sdb1      15%   75.0    0.0|RRRRRRRR                                     >   |│
│sdb2       4%   16.7    0.0|RR    >                                          |│
│sdb3       0%    2.7    0.0|R>                                               |│
│sdb4      30%  135.9    0.0|RRRRRRRRRRRRRRR                         >        |│
│sdb5       0%    0.0    0.0|>                                                |│
│sdb6       0%    0.0    0.0|>                                                |│
│dm-0       0%    0.0    0.0|>                                                |│
│Totals Read-MB/s=460.7    Writes-MB/s=0.1      Transfers/sec=469.0            │                                                                     
└──────────────────────────────────────────────────────────────────────────────┘

Alternatively, if you just want to do a "speed test" of any disk, you can use the hdparm tool:

sudo hdparm -t /dev/sda

This will read from the specified device (here /dev/sda) for about 3 seconds and display the data rate afterwards. Note that it performs a "buffered read", but without using the disk cache. Use -T instead of -t to test read speeds from the disk's cache.

You can not test or determine write speeds this way though.