The fsck command is run on the file systems to check them and to prevent data corruption during the checking process. Which scans the file system and validates the integrity of the file system’s metadata structures.
- fsck is a command used to check and repair the Linux file systems.
- It comes from “util-linux-ng-2.17.2” package.
- We have covered almost all the options for it.
- Path: /sbin/fsck
Examples:
1. To check a file system
$ fsck /dev/sdb $ fsck /mike |
2. To run the fsck in serialization mode
$ fsck -s /dev/sde |
3. To run the fsck with specifying the type of file system
$ fsck -t ext3 /mike |
4. To run fsck for all the mentioned file systems in fstab
$ fsck -A |
5. To have the progress bar while fsck iin run
$ fsck -C /dev/sde |
6. To skip running fsck on mounted file systems
$ fsck -M |
7. To dry run the fsck, just show what it would do
$ fsck -N |
8. To skip the root file system if it mounted in read-write mode
$ fsck -R |
9. To skip showing title
$ fsck -T |
10. To run the fsck in verbose mode
$ fsck -V /dev/sde |
11. To automatically repair the file system, without ant skipping any questions
$ fsck -a /dev/sde |
12. Only print the problems and not to repair them
$ fsck -n /dev/sde |
13.To interactively repair the file systems
$ fsck -r /dev/sde |
14. To set the answer to “yes”
$ fsck -y /dev/sde |
Related Commands: fstab, mkfs, fsck.ext2 | fsck.ext3 | e2fsck, cramfsck, fsck.minix, fsck.msdos, fsck.jfs, fsck.nfs, fsck.vfat, fsck.xfs, fsck.xiafs, reiserfsck.
fsck command not found
If there is a message like “fsck command not found”, then you need to check if the “util-linux” package is installed or not. Please follow below detais to install the packge.
OS Version | Command to install |
RedHat / CentOS | yum install util-linix |
Debian / Ubuntu | apt install util-linux |