Now that you unmounted the disk, you can run fsck. To check the second disk, enter:. The above example shows the output for a clean disk. If there are multiple issues on your disk, a prompt appears for each one where you have to confirm the action. Before you perform a live check, you can do a test run with fsck. Pass the -N option to the fsck command to perform a test:.
To try to fix potential problems without getting any prompts, pass the -y option to fsck. If no errors are found, the output looks the same as without the -y option. Use the -n option if you want to check potential error on a file system without repairing them. We have a second drive sdb with some journaling errors. The -n flag prints the error without fixing it:. When you perform a fsck on a clean device, the tool skips the filesystem check.
If you want to force the filesystem check, use the -f option. The scan will perform all five checks to search for corruptions even when it thinks there are no issues. If you want to perform a check on all filesystems with fsck in one go, pass the -A flag. To make sure you do not try to run fsck on a mounted filesystem, add the -M option. This flag tells the fsck tool to skip any mounted filesystems.
To show you the difference, we will run fsck on sdb while it is mounted, and then when we unmount it. While sdb is mounted, the tool exits without running a check.
Then, we unmount sdb and run the same command again. This time, fsck checks the disk and reports it as clean, or with errors.
As we already mentioned, fsck cannot check root partitions on a running machine since they are mounted and in use. We are thankful for your never ending support. The df and mount methods above will mirror back ext Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.
Save my name, email, and website in this browser for the next time I comment. Notify me of followup comments via e-mail.
You can also subscribe without commenting. This site uses Akismet to reduce spam. Learn how to use it. Table of Contents. Sometimes bad things happen to good systems. Introduction to the fsck command The fsck command follows a pattern similar to most Linux commands. You will need to run the command either as root user or use it with sudo. Understanding exit codes for the fsck command This is a list of the codes that may be returned from fsck after inspecting a disk. Practical usage of the fsck command Now that you are a tad bit familiar with the fsck command, let's see practical use cases of this command.
Repair the root file system You cannot unmount the root partition while the system is active. Most modern Linux versions feature a tool called tune2fs. Send login link. Check your inbox and click the link. Sorry, something went wrong. Please try again. Learn the super powerful and super useful find command with these practical examples. If you like what you are reading, please consider buying us a coffee or 2 as a token of appreciation.
We are thankful for your never ending support. Thank you for the article and your time spent on this website your time spent doing this is very much appreciated by me. I am using a laptop and ran a disk check using the smart control application which stated errors were found.
Although I deleted the partition and reformatted the drive the errors remained which made me curious about error checking and cyclic redundancy checks which lead me to do a little research on physical drive checks and more detailed analysis. Doing searching online drove me here and to the FSCK command which even though I had wiped the drive still showed a wealth of errors As I ran it without the -y flag initially , your article provided some clarity I was missing and made me wonder if some of these errors are reached because there is still junk data left on the drive because I have not low-level formatted it.
Now it will search for errors, fix them as found, and display ongoing progress… Which begs the question… If I low-level formatted this drive by overwriting it with zero, would these errors then be wiped free? In any case, I am going to let this command run in its entirety and see what the outcome is.
Thank you for your time. Thank you for the article. Does Linux ubuntu install run fsck before installing? I try to install Ubuntu and always ran into disc problems How to force a correction before the install? Not at all. Text articles work well for this kind of explanation.
Have a question or suggestion? Please leave a comment to start the discussion.
0コメント