3 Best Tools to Monitor Disk I/O Performance in Linux

Brief: In this guide, we will discuss the best tools for monitoring and debugging disk I/O activity (performance) on Linux servers.

A key performance metric to monitor on a Linux server is disk I/O (input/output) activity, which can significantly impact several aspects of a Linux server, particularly the speed of saving to or retrieval from disk, of files or data (especially on database servers). This has a ripple effect on the performance of applications and services.

1. iostat – Shows Device Input and Output Statistics

iosat is one of the many terminal-based system monitoring utilities in the sysstat package, which is a widely used utility designed for reporting CPU statistics and I/O statistics for block devices and partitions.

To use iostat on your Linux server, you need to install the sysstat package on your Linux system by running the applicable command for your Linux distribution.

sudo apt install sysstat          [On Debian, Ubuntu and Mint]
sudo yum install sysstat          [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
sudo emerge -a app-admin/sysstat  [On Gentoo Linux]
sudo apk add sysstat              [On Alpine Linux]
sudo pacman -S sysstat            [On Arch Linux]
sudo zypper install sysstat       [On OpenSUSE]

To show a simple device utilization report, run iostat with the -d command line option. Usually, the first report provides statistics about the time since the system startup (boot time), and each subsequent report is concerned with the time since the previous report.

Use the -x for an extended statistics report and the -t flag to enable time for each report. Besides, If you wish to eliminate devices without any activity in the report output, add the -z flag:

iostat -d -t
OR
iostat -d -x -t
iostat - Monitor Device Statistics in Linux
iostat – Monitor Device Statistics in Linux

To display statistics in kilobytes per second as opposed to blocks per second add the -k flag, or use the -m flag to display stats in megabytes per second.

iostat -d -k
OR
iostat -d -m

iostat can also display continuous device reports at x second intervals. For example, the following command displays reports at two-second intervals:

iostat -d 2

Related to the previous command, you can display n number of reports at x second intervals. The following command will display 10 reports at two-second intervals.

iostat -d 2 10

Alternatively, you can save the report to a file for later analysis.

iostat -d 2 10 > disk_io_report.txt &

For more information about the report columns, read the iostat man page:

man iostat

2. sar – Show Linux System Activity

sar is another useful utility that ships with the sysstat package, intended to collect, report, or save system activity information. Before you can start using it, you need to set it up as follows.

First, enable it to collect data in the /etc/default/sysstat file.

vi /etc/default/sysstat

Look for the following line and change the value to “true” as shown.

ENABLED="true"
Enable Sar in Linux
Enable Sar in Linux

Next, you need to reduce the data collection interval defined in the sysstat cron jobs. By default, it is set to every 10 minutes, you can lower it to every 2 minutes.

You can do this in the /etc/cron.d/sysstat file:

# vi /etc/cron.d/sysstat
Configure Sar Cron in Linux
Configure Sar Cron in Linux

Save the file and close it.

Finally, enable and start the sysstat service using the following systemctl command:

iostat -d -t
OR
iostat -d -x -t

0

Next, wait for 2 minutes to start viewing sar reports. Use the sar command and the -b command line option to report I/O and transfer rate statistics and -d to report activity for each block device as shown.

iostat -d -t
OR
iostat -d -x -t

1

Sar - Monitor Linux System Activity
Sar – Monitor Linux System Activity

3. iotop – Monitor Linux Disk I/O Usage

Similar to top monitoring tool in terms of design, iotop is a simple utility that enables you to monitor disk I/O activity and usage on a per-process basis.

You can get it installed on your Linux server as follows (remember to run the appropriate command for your Linux distribution):

iostat -d -t
OR
iostat -d -x -t

2

To monitor per-process I/O activity, you can run iotop without any arguments as follows. By default, the delay between iterations is 1 second. You can change this using the -d flag.

iostat -d -t
OR
iostat -d -x -t

3

iotop - Monitor Linux Disk Usage
iotop – Monitor Linux Disk Usage

iotop will by default display all threads of a process. To change this behavior so that it only shows processes, use the -P command line option.

iostat -d -t
OR
iostat -d -x -t

4

Also, using the -a option, you can instruct it to display accumulated I/O as opposed to showing bandwidth. In this mode, iotop shows the amount of I/O processes performed since iotop was invoked.

iostat -d -t
OR
iostat -d -x -t

5

That’s all we had for you! We would like to know your thoughts about this guide or the above tools. Leave a comment via the feedback form below.

You can also inform us about tools that you think are missing in this list, but deserve to appear here.


Discover more from WIREDGORILLA

Subscribe to get the latest posts sent to your email.

Similar Posts

  • Mind-Blowing New AI Video Generator: Text to Video AND Image to Video with Pika Labs

    The best AI video generator just came out, and it’s free. Generate ai videos using ai text to video and image to video with Pika Labs. Prompt with text or image. It’s amazing to animate Midjourney art! Pika Labs is my favorite ai video generator over Gen 2 by Runway ML and Zeroscope (by far).

    The beta is now fully open to the public: https://discord.gg/pika
    Website – pika.art
    Pika Lab’s Twitter – https://twitter.com/pika_labs

    ——————————————————————————————–

    ? AI video effects with Kaiber: https://kaiber.ai/?via=obscurious
    ? Use AI to build your website with 10web: https://10web.io/?_from=obscurious
    ? Level up on YouTube with VidIQ: https://vidiq.com/obscurious

    ? Twitter: https://twitter.com/ObscuriousMind

    ——————————————————————————————–

    Twitter Examples:
    Pika
    The Dor Brothers: https://twitter.com/thedorbrothers
    ScottieWick: https://twitter.com/scottiewick
    WinterGardenAI: https://twitter.com/WinterGardenAI
    Imposter Chick: https://twitter.com/ImposterChick
    Daveranan: https://twitter.com/daveranan
    Mr_AllenT: https://twitter.com/Mr_AllenT
    Abel Art: https://twitter.com/A_B_E_L_A_R_T
    TrillionIam: https://twitter.com/TrillionIam
    DaveJWVillalva: https://twitter.com/DaveJWVillalva
    fofrAI: https://twitter.com/fofrAI
    botzero_net: https://twitter.com/botzero_net
    FatalDotAI: https://twitter.com/FatalDotAI
    JH4TC: https://twitter.com/JH4TC
    mrjonfinger: https://twitter.com/mrjonfinger
    ChristianF369: https://twitter.com/ChristianF369

    Runway
    Nick St. Pierre: https://twitter.com/nickfloats

    Zeroscope
    adamcole_studio: https://twitter.com/adamcole_studio
    pharmapsychotic: https://twitter.com/pharmapsychotic

    Neural Frames
    mapchannels: https://twitter.com/mapchannels

    WarpFusion
    Mrboofyy: https://twitter.com/Mrboofyy

    #aivideo #aitools #aiart

    Chapters
    0:00 Intro
    0:40 RunwayML vs. Pika
    1:44 Zeroscope vs. Pika
    2:17 Other Tools vs. Pika
    2:33 Showcase
    7:28 Getting Started
    7:59 Prompting
    8:38 Robot Dance Party
    8:53 More Text to Video Prompting
    9:47 Nature Documentary
    10:31 Image Prompting
    10:42 Outro