fsck - Linux Command Line for fixing disk errorsFollow @ggarron
fsck (File System Check) is a frontend utility that checks your file systems and if it founds some problem ask you about an action to take.
fsck [options] [filesystem-list]
- Global Options
- -A (all) means that it is going to process all the file systems listed in /etc/fstab file in parallel if this is possible, you should not use the filesystem-list when using this option, See the -s option for serial file system check, you can also use -t option to specify a specific file system type.
- -R (root-skip) This option force fsck to skip root filesystem, if it is mounted as read-write.
- -N (no) This option respond automatically no to all questions it may appear so you get the analysis but no action is take
- -t filesystemtype (file system type) Here you can specify the file system type to be checked if combined with -A option fsck will only check those File System listed in that file that are of the specified file sytem.
- -s (serial) This option forces fsck to do a serial and not parallel scanning
- Specific to ext2 and ext3 file systems
- -f (force) This option forces fsck to check a file system even if it is clean, as fsck skips by default clean file systems to do a quickly job
The exit code returned by fsck is the sum of the following conditions:
0 - No errors 1 - File system errors corrected 2 - System should be rebooted 4 - File system errors left uncorrected 8 - Operational error 16 - Usage or syntax error 32 - Fsck canceled by user request 128 - Shared library error
You can run fsck in interactive or batch mode, if in interactive you will be prompted before it takes any action, if running in batch mode it will take the better action automatically. Use -r option to make fsck run in interactive mode.
Also, this options makes fsck runs in batch mode.
- -a (automatic) Makes fsck runs in batch mode
- -p (preen) Same as -a
- -y (yes) Opposite to -n, so it assumes yes to all questions that may appear
Read fsck's man page for more options.