Skip to main content
Engineering LibreTexts

04-F.13.3: Storage Issues - iostat, ioping

  • Page ID
    26856
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Tools for Storage Issues

    The iostat Command

    The iostat command is used for monitoring system input/output device loading by observing the time the devices are active in relation to their average transfer rates. The iostat command generates reports that can be used to change system configuration to better balance the input/output load between physical disks. This tool is not installed on most Linux distros, so you will need to determine how to install this package for your particular distribution.

    Syntax:

    iostate [ OPTION ] [ device ]
    

    Command Options:

    Options Option Meaning
    -c Show only the cpu statistic.
    -d Display only the device report.
    -j ID mmcbkl0 sda6 -x -m 2 2 Display persistent device name statistics.
    -k Capture the statistics in kilobytes or megabytes.
    -k 2 3 Display cpu and device statistics with delay.
    -N Display lvm2 statistic information.
    -p Display statistics for block devices.
    -x Show more detailed statistics information.
    -xd Show extended I/O statistic for device only.
    pbmac@pbmac-server $ iostat
    Linux 4.15.0-91-generic (pbmac-server)     06/20/2020     _x86_64_    (2 CPU)
    
    avg-cpu:  %user   %nice %system %iowait  %steal   %idle
               9.47    0.02    1.66    1.89    0.00   86.95
    
    Device             tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
    sda              10.46       182.70       120.75  275705960  182212856
    

    The first section contains CPU report:

    • %user : Shows the percentage of CPU utilization that occurred while executing at the user level.
    • %nice : Shows the percentage of CPU utilization that occurred while executing at the user level with a nice priority.
    • %system : Shows the percentage of CPU utilization that occurred while executing at the system (kernel) level.
    • %iowait : Shows the percentage of the time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.
    • %steal : Shows the percentage of time being spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing by another virtual processor.
    • %idle : Shows the percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.

    The second section of the output contains device utilization report:

    • Device : The device/partition name is listed in /dev directory.
    • tps : The number of transfers per second that were issued to the device. Higher tps means the processor is busier.
    • kB_read/s : Shows the amount of data read from the device expressed in a number of blocks (kilobytes, megabytes) per second.
    • kB_wrtn/s : The amount of data written to the device expressed in a number of blocks (kilobytes, megabytes) per second.
    • kB_read : Shows the total number of blocks read.
    • kB_wrtn : Shows the total number of blocks written.

    The ioping Command

    The ioping command is a tool to report disk latency — how long it takes a disk to respond to requests. It is of great use in diagnosing disk problems.

    pbmac@pbmac-server $ sudo ioping -c 5 /dev/sda5
    4 KiB <<< /dev/sda5 (block device 78.1 GiB): request=1 time=16.4 ms (warmup)
    4 KiB <<< /dev/sda5 (block device 78.1 GiB): request=2 time=11.3 ms
    4 KiB <<< /dev/sda5 (block device 78.1 GiB): request=3 time=17.9 ms
    4 KiB <<< /dev/sda5 (block device 78.1 GiB): request=4 time=10.9 ms
    4 KiB <<< /dev/sda5 (block device 78.1 GiB): request=5 time=11.6 ms
    
    --- /dev/sda5 (block device 78.1 GiB) ioping statistics ---
    4 requests completed in 51.7 ms, 16 KiB read, 77 iops, 309.4 KiB/s
    generated 5 requests in 4.01 s, 20 KiB, 1 iops, 4.99 KiB/s
    min/avg/max/mdev = 10.9 ms / 12.9 ms / 17.9 ms / 2.87 ms
    

    Check out the man page for other options for this command. This tool is not installed on most Linux distros, so you will need to determine how to install this package for your particular distribution.

    Adapted from:
    "iostat command in Linux with examples" by rahulkumarmandal, Geeks for Geeks is licensed under CC BY-SA 4.0


    04-F.13.3: Storage Issues - iostat, ioping is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?