In this video, we'll talk about options to repair file systems. Actually, you need to
understand what is going on. And that is because many problems are fixed automatically when
you boot because file system journal on XFS or the transaction log on XFS. This journal
and transaction log mean that file systems basically are auto healing. So when you are
booting and an error was encountered, the file system will do a rollback of the previous
situation and you'll be all set. EXT file systems can be checked manually as well using
the FS check utility, which is the utility that you can also use to repair. And on some
more cases, you might need to have to do that. On XFS, it's even more rare with the XFS repair
utility is available. If you are going to use these utilities, you need to make sure
that you are in emergency mode because normally these utilities require the file system not to
be opened at all. So let me show you how you can start these utilities. Starting here.
So to start it, I need to reboot and get access to the group boot prompt. Getting access to the
group boot prompt is always a little bit of a guess. You need to press escape at the right
moment. And as you can see, I just succeeded. So here we see the default kernel that my system
wants to start. I'm pressing E for edit. And then I'm looking up the line that starts with Linux
and ends with R-H-Z-B and quiet, which is default on CentOS. I'm giving it the option init is
slash bin slash bash. Init is bin bash is the most minimal troubleshooting mode. And the nice
thing about this minimal troubleshooting mode is that your file systems are not yet
mounted in a rewritable way. And also, you are not required to enter a root password. You just
get access to a root shell. Now there, I'm going to use LSBLK, where I can see my block devices,
and none of these block devices is mounted. So I need to use the appropriate utility.
And in order to do so, I am going to use slash user slash sbin, where all of my XFS
utilities are. And there we can see there is the XFS repair utility. So let's do that on dev sda1,
which should be by my boot device. And oh boy, there I can see that XFS repair is failing.
Bad primary superblock. And why is it giving me bad primary superblock? Well, that is because I
made a mistake. And we did it on a VFAT file system. In order to use XFS repair and other
repair utilities, they are file system specific. So you need to be on the right file system.