Linux "fsck" Command Line Options and Examples
check and repair a Linux filesystem
fsck is used to check and optionally repair one or more Linux filesystems. filesys can be a device name (e.g.
fsck [-lsAVRTMNP] [-r [fd]] [-C [fd]] [-t fstype] [filesystem...] [--] [fs-specific-options]
Command Line Options:
Report certain statistics for each fsck when it completes. These statistics include the exit status, the maximum run set size(in kilobytes), the elapsed all-clock time and the user and system CPU time used by the fsck run. For example:/dev/sda1: status 0, rss 92828, real 4.002804, user 2.677592, sys 0.86186GUI front-ends may specify a file descriptor fd, in which case the progress bar information will be sent to that file descrip‐tor in a machine parsable format. For example:/dev/sda1 0 92828 4.002804 2.677592 0.86186
fsck -r ...
Specifies the type(s) of filesystem to be checked. When the -A flag is specified, only filesystems that match fslist arechecked. The fslist parameter is a comma-separated list of filesystems and options specifiers. All of the filesystems inthis comma-separated list may be prefixed by a negation operator 'no' or '!', which requests that only those filesystems notlisted in fslist will be checked. If none of the filesystems in fslist is prefixed by a negation operator, then only thoselisted filesystems will be checked.Options specifiers may be included in the comma-separated fslist. They must have the format opts=fs-option. If an optionsspecifier is present, then only filesystems which contain fs-option in their mount options field of /etc/fstab will bechecked. If the options specifier is prefixed by a negation operator, then only those filesystems that do not have fs-optionin their mount options field of /etc/fstab will be checked.For example, if opts=ro appears in fslist, then only filesystems listed in /etc/fstab with the ro option will be checked.For compatibility with Mandrake distributions whose boot scripts depend upon an unauthorized UI change to the fsck program, ifa filesystem type of loop is found in fslist, it is treated as if opts=loop were specified as an argument to the -t option.Normally, the filesystem type is deduced by searching for filesys in the /etc/fstab file and using the corresponding entry.If the type cannot be deduced, and there is only a single filesystem given as an argument to the -t option, fsck will use thespecified filesystem type. If this type is not available, then the default filesystem type (currently ext2) is used.
fsck -t ...
Display completion/progress bars for those filesystem checkers (currently only for ext) which support them. fsck willmanage the filesystem checkers so that only one of them will display a progress bar at a time. GUI front-ends may specify afile descriptor fd, in which case the progress bar information will be sent to that file descriptor.
fsck -C ...
Do not check mounted filesystems and return an exit code of 0 for mounted filesystems.
fsck -M ...
just show what would be done.
fsck -N ...
Don't show the title on startup.
fsck -T ...
including all filesystem-specific commands that are executed.
fsck -V ...
Display help text and exit.
fsck -? ...
Display version information and exit.FILESYSTEM SPECIFIC OPTIONSOptions which are not understood by fsck are passed to the filesystem-specific checker!These options must not take arguments, as there is no way for fsck to be able to properly guess which options take arguments andwhich don't.Options and arguments which follow the -- are treated as filesystem-specific options to be passed to the filesystem-specific checker.Please note that fsck is not designed to pass arbitrarily complicated options to filesystem-specific checkers. If you're doing some‐thing complicated, please just execute the filesystem-specific checker directly. If you pass fsck some horribly complicated optionsand arguments, and it doesn't do what you expect, don't bother reporting it as a bug. You're almost certainly doing something thatyou shouldn't be doing with fsck. Options to different filesystem-specific fsck's are not standardized.FILES/etc/fstabENVIRONMENT VARIABLESThe fsck program's behavior is affected by the following environment variables:FSCK_FORCE_ALL_PARALLELIf this environment variable is set, fsck will attempt to check all of the specified filesystems in parallel, regardless ofwhether the filesystems appear to be on the same device. (This is useful for RAID systems or high-end storage systems such asthose sold by companies such as IBM or EMC.) Note that the fs_passno value is still used.FSCK_MAX_INSTThis environment variable will limit the maximum number of filesystem checkers that can be running at one time. This allowsconfigurations which have a large number of disks to avoid fsck starting too many filesystem checkers at once, which mightoverload CPU and memory resources available on the system. If this value is zero, then an unlimited number of processes canbe spawned. This is currently the default, but future versions of fsck may attempt to automatically determine how manyfilesystem checks can be run based on gathering accounting data from the operating system.PATH The PATH environment variable is used to find filesystem checkers.FSTAB_FILEThis environment variable allows the system administrator to override the standard location of the /etc/fstab file. It isalso useful for developers who are testing fsck.LIBBLKID_DEBUG=allenables libblkid debug output.LIBMOUNT_DEBUG=allenables libmount debug output.
fsck --version ...