- [Narrator] Welcome to the next video
of section 8, Monitoring Disk Activity.
In the previous video, we've learned how
to measure and optimize power usage.
In this video, we'll learn how to monitor disk activity.
Going by the popular naming convention
of monitoring tools ending in the word top,
the command used to monitor processes,
the tool to monitor disk I/O is called iotop.
Iotop doesn't come pre-installed
with most Linux distributions.
You'll have to install it using your package manager.
There are multiple ways of using iotop
to perform I/O monitoring,
some of which we'll see in this section.
For interactive monitoring, use ...
The minus-O option to iotop tells it to show only those
processes which are doing active I/O while it's running.
It's a useful option to reduce the noise in the output.
For non-interactive use from shell scripts, use ...
This will tell iotop to print the statistics two times
and then exit, which is useful if you want this output
in a shell script and do some manipulation on it.
Monitor using a specific process using the following.
Put PID of the process that you wish to monitor,
and iotop will restrict the output
to it and show statistics.
In most modern distros, instead of finding
the PID and supplying it to iotop,
you can use the pidof command,
and writing the preceding command as ...
Awesome, we've successfully learned
how to monitor disk activity.
In the next video, we'll learn
about checking disks and filesystems for errors.