Hey guys and welcome back.
So now what I want to do is just have a few more words on file system recovery.
Now like I say, when you're dealing with file system recovery, you can be dealing with things
such as corrupt file systems and a common cause of a corrupted file system is when a
system is inappropriately shut down.
So what do I mean?
That would be like someone pulling the power out of the system or a power outage.
This type of thing could lead to such corruption of the file system.
So when such a thing happens, we want to be aware of some of the tools that we have available
to us to help us out and resolve these issues.
The command I want to highlight here is the FSCK command.
This is the file system check command.
And it really is quite easy to use this command.
All you would ultimately do is say FSCK and then specify the partition you want to check.
So I would say dev sda1 for example.
And this will actually give us detailed information about what exactly is wrong with the partition
in this case.
And once it identifies a particular problem, it will then ask you, do you want to fix this
problem?
To which you want to reply yes.
Now you can continually just keep entering yes to all the problems.
Do you want to fix this?
So on and so forth.
But you can imagine this is quite tiresome.
Instead a good way to run the FSCK utility is with the dash y flag.
What this is going to do is going to preempt any such prompts and just answer yes to every
time we get a prompt.
If you have a lot of issues, FSCK can just run through those problems and attempt to
fix each one as they go through.
Now one point of note here, and this is very important.
We do not want to run the FSCK utility on a live system.
That means if you happen to have a partition working and mounted, do not run this utility
in fact, let me just quickly show you.
So if I say the command LSBLK, we can actually see the root file system is mounted on SDA5.
So this is mounted.
If I did FSCK DEV SDA5 and hit enter, notice it gives me the warning.
The file system is mounted.
If you continue, you will cause severe damage.
So we want to say N for no to make sure we do not run this command on a mounted file
system.
That would mean you may have to use commands such as the U mount command to unmount a particular
file system.
If you do suspect that it does have issues and needs to be fixed with FSCK, this command,
which we actually went over in the LPIC1 examination can help you unmount a partition safely.
And then you can run the FSCK check to fix any particular problems.
Okay, those are some of the main commands that we can use to fix these types of problems.
I hope this has been informative for you and I'd like to thank you for viewing.