In this video, we'll talk about a couple of commands that can help in troubleshooting
storage problems. So what can you do? Well, first there is fscheck. Fsck or fscheck is
what you use to monitor file system integrity. You can use it manually on any device to figure
out if there is any trouble. Fartprobe is an interesting command. It can be used to
update the kernel partition table with real storage information. If ever you feel that
your storage information is not visible by the kernel, fartprobe might be your fix. du
is for disk usage. It's the utility that you use to get an overview of available disk space
for each directory, and df will show available disk space per device. Iostat can generate
a wide range of storage-related statistics, and you can see a device activity overview.
Ioping is an optional utility which is used to test IOPerformance, but in many cases it's
not installed by default. And to optimize IOPerformance, the IOScheduler can be tuned
through the slash sys file system. Let me show you. So to start with the last one, in
the sys directory you have interfaces to all your different devices. And if we go to block,
in block you can find the subdirectory for your block devices. And in there I can find
my NVMe 0 and 1. Apparently on this system we have five different NVMe disks, and for
each of them you can optimize the IOScheduler. And you do that through the queue directory
in this directory. And in this queue directory there is different files, including the filescheduler.
And there we can see four different schedulers, non-MDdeadline, kyber, and bfq. Now if ever
you think that your disk is poorly behaving, you might change these schedulers. To do so
you echo the desired value, so like bfq, into the scheduler file. Once again, like slash
proc slash sys is one of these directories where you cannot directly edit files, so use
this approach to change the contents of the file. And there we can see that now it is
set to bfq. And you can test if this is leading to a better behavior. If it is, you can make
it persistent using one of the systemd startup units. If it's not, better get back by echoing
the original value, or just reboot, which will always get you back to the original value.
Talking about which, if you are on NVMe, NVMe is SSD on steroids. It's a really fast SSD.
You don't need to optimize anything on your IO scheduler to have it work the right way.
IOstat is also an interesting utility. Let me use IOstat 2.5, where two means I want
a two-second interval, and five means I want to see it five times. And oh, I need to install
the sysstat package. Sysstat is a very convenient package that I think you should have at all
time. And what do we see here in IOstat? Well, we see an overview of device activity.
The nice thing about it is that it is giving a list of all the devices, so you can easily
identify the busiest device, which in this case apparently is devnvme0 and 3. Ignore
about the dm0, because dm0 is a device mapper, and that is what is used by LVM. So dm0 is
hosted by NVMe0 and 3, as we see more or less the same values here. And there you can
see the stats, transaction per second, kilobyte read per second, kilobyte written per second,
kilobyte discarded, the total kilobyte read and written, and the total kilobyte discarded.
That's a nice overview of IO performance. Talking about performance, let me also use
dnfinstall-y io-top. That's one of my personal favorites. So when you use io-top, then what
do you see? Well, you see current IO activity. And what I like about io-top is that like
within the top utility, you can see the busiest utility on the top, which apparently in this
case is the ptyxis. ptyxis is what is behind your GNOME terminals on modern systems. Use
Q to get out of here. Then how about io-ping? Well, io-ping is a nice utility, but as I
was mentioning, it's a utility that is not often available in the default distribution
repositories. But do remember that io-ping can be used to ping IO devices and get more
information about their performance. You might see questions about it in the exam because
it's in the Linux Plus objectives.