So we're working in the command line on my CentOS 7 machine and you can see I've got root privileges.
And, of course, we're going to need this to be able to run our file system checks.
If I go through and look at the lsblk command, this will then show me that I have the SDA discs and the SDB.
As we go through, we can have a look at SDA1 is mounted to boot and SDB1 is mounted to data.
SDA2 is broken up into logical volumes. As we progress deeper into this course, we'll be taking a look in
more detail at logical volumes. If I want to look at the type of file system and if I clear out the screen
and then if I do something like DF -h for human-readable and T so we can see the type.
This is going to show me the free space, but also then the file system type.
As I go through and have a look, we can see then that SDA1 is an XFS file system.
SDB1 is in the ext4 file system. We want to be able to run the standard FS Check utility, so that's not
going to work against the SDA1. We'd have to run FS Check then with .xfs.
So if I want to then go through and check my ext4 file system, we're first going to need to unmount or umount
that file system that's currently mounted. So, we can go umount/data so I can unmount either the directory
or the device itself. Now then, I can go through and run FS Check and then /dev/sdb1.
If we clear the screen with Control+L, we can move that to the top of the screen just to make it clearer to
see, hit the Enter key, and we can see that it shows that the file system is clean.
So, it's done a cursory check and sees that it's marked as clean, so there's no need to perform any further check.
But we could go through and force a check to happen, so adding then the option -f.
And then even though the file system is clean, we can still then go through and check the integrity of the
elements that make up the file system. And, again, this is a new file system, so I'm not really expecting
there to be any errors and to be honest, I haven't created any files on that file system either.
But at least it gives you an idea of running through the commands.
When we look at the fstab file, so if I go through and, let's say, grep for boot in etc/fstab, we can see
then the line that is responsible for mounting the SDA1 partition. And it's mounted by its UUID or unique identifier.
We again see that the file system is XFS, but if we look at the last two digits, 1 is saying it is included
for the dump backup, although most people probably don't use the command dump, but then its file system check
order is going to be 2. So it's checked after the root file system.
If I run the same check, but against the data directory where my SDB device was mounted, I've added this in
so I'm not doing the ---enabling the dump back up of this file system.
But if you look at the file system check pass number, I've put it as checking is number 3.
Remember, we can have a value of 0 where we don't perform checks or we can have a value of 1, which is
normally reserved for the root file system, but then we can have 2.
And very often, we do see everything as 2 afterwards, but we don't have to have that value of 2.
A value of 2 just means that the boot and data, if they both had a value of 2, they would be checked together
rather than in series one after each other. If we go through at the root of the file system and create a
file, so if I go touch and then /forcefsck, then the next time the file system boots, it's going to run an
FS Check forcefully on those file systems enabled for that pass. So if I go through now and create that file
on a reboot, then the file system check is going to be implemented.
Otherwise, we're going to do it at the file system check interval, which we'll take a look at in more detail
later on. I'm not going to reboot the system at the moment, but when the system is rebooted, the file will
be deleted so the /forcefsck file will be deleted. So I don't need to be concerned with the fact that I have
to delete it. The system checks that the file is there. If the file is there, the file system check is
enforced, but the file is also deleted automatically. So, let's jump back into our slides now so we can
start looking at some of the other tools that we can use rather than just FS Check.