fsck is a unix file system check utility. It is used to repair , recover and fix disk issues. The following examples display various use cases and options
that can be used with fsck.

Check a filesystem :

fsck /dev/sda1

**Check all filesystems : **

fsck -A

( It is recommended to exclude root filesystem using -R option )

fsck -AR -y ( y means correct errors )

**Check specific filesystem type only : **

fsck -AR -t ext2 -y

**Exclude a filesystem type : **

fsck -AR -t noext2 -y

Exclude mounted filesystem:

fsck -M /dev/sda2

**Skip display Title : **

fsck -TAR

Force check :

fsck /dev/sda2 -f

**Automatically fix detected problems : **

fsck -y /dev/sda2

**Report problems to stdout but avoid repair : **

fsck -n /dev/sda6

Automatically repair damaged portion :

fsck -a -AR

Exit Codes for fsck:

0 – No Errors
1 – Filesystem errors corrected
2 – System needs reboot
4 – Filesystem errors not corrected
8 – Operational Error
16 – Usage or syntax error
32 – cancelled by user request
128 – shared library error.