The fsck command is used to check the integrity of a file system. File system integrity refers to the correctness and validity of a file system. Most systems automatically run the fsck command at boot time so that errors, if any, are detected and corrected before the system is used. File system errors are usually caused by power failures, hardware failures, or improper shutdown of the system.

You should unmount the file system before scanning it with fsck to prevent damage to the file system.


The syntax of the fsck command is:

# fsck [options] {device/file system name}

Repair file systems

You can use the fsck -r {device/file system name} command to repair a file system. The command will prompt you to confirm your actions. If you are simultaneously checking multiple file systems, you should not use this option because it allows you to repair only a single file system at a time.

Checking the integrity of a file system.

fsck command examples in Linux

fsck Command Examples

1. To check a file system:

# fsck /dev/sde
# fsck /mike 

2. To run the fsck in serialization mode:

3. To run the fsck with specifying the type of file system:

4. To run fsck for all the mentioned file systems in fstab:

5. To have the progress bar while fsck iin run:

6. To skip running fsck on mounted file systems:

7. To dry run the fsck, just show what it would do:

8. To skip the root file system if it mounted in read-write mode:

9. To skip showing title:

10. To run the fsck in verbose mode:

11. To automatically repair the file system, without ant skipping any questions:

12. Only print the problems and not to repair them:

13. To interactively repair the file systems:

14. To set the answer to “yes”: