This article is a follow-up to the previous 90 Linux Commands frequently used by Linux Sysadmins post. Every week, as time allows, I will publish articles on the 90 commands geared toward Linux sysadmins and Linux power users. iostat command in Linux and other Unix-like systems. IOstat is a powerful Linux tool that provides detailed… continue reading.
This article is a follow-up to the previous 90 Linux Commands frequently used by Linux Sysadmins post. Every week, as time allows, I will publish articles on the 90 commands geared toward Linux sysadmins and Linux power users. iostat command in Linux and other Unix-like systems. IOstat is a powerful Linux tool that provides detailed… continue reading.
Seems like a very good command to know, but what scenarios would I need to use this in?
Is it just for determining if a drive is performing well or are there other reasons to know this information?
Hi @MadMatt, a good reason to use iostat would be to monitor and troubleshoot disk I/O performance. For example this article: Linux server performance: Is disk I/O slowing your application?
You don’t need to use any flags. In fact you get comprehensive output including kernel and CPU information if you just use iostat
by itself.
Where do the stats come from? What is doing the tracking?
The iostat
stats come from the Linux kernel, specifically the /proc/diskstats
file. The kernel tracks I/O operations, including reads, writes, and time spent on I/O. iostat
reads this data, processes it, and presents the I/O statistics in a user-friendly format.
This is pretty standard and expected though, most system monitoring tools like top
, htop
, and others also pull data from the Linux kernel, primarily through the /proc
* filesystem. They access files like /proc/stat
, /proc/meminfo
, and /proc/loadavg
, which the kernel continuously updates with system performance metrics.
Yes indeed!
That’s interesting. Thanks for that detail. I have those files (on my Pi), but they’re all zero size!
My pleasure, I’m sure threads like this will be useful to many others and as reminders for still others.
In short, there’s nothing wrong with those files showing as 0
bytes in size. It’s just how the /proc
filesystem works.
The /proc/
filesystem, the “size” of the files are shown as 0
in a directory listing is normal because these files are virtual and do not occupy actual disk space. They are dynamically generated on demain by the kernel when accessed, meaning they can still contain information even though their size is listed as zero.
You can still view their contents with commands like cat
, less
, or any other tool that reads file contents.