616 lines
14 KiB
HTML
616 lines
14 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of FSCK</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>FSCK</H1>
|
|
Section: System Administration (8)<BR>Updated: February 2009<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
fsck - check and repair a Linux filesystem
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>fsck</B>
|
|
|
|
[<B>-lsAVRTMNP</B>]
|
|
|
|
[<B>-r</B>
|
|
|
|
[<I>fd</I>]]
|
|
|
|
[<B>-C</B>
|
|
|
|
[<I>fd</I>]]
|
|
|
|
[<B>-t</B>
|
|
|
|
<I>fstype</I>]
|
|
|
|
[<I>filesystem</I>...]
|
|
|
|
[<B>--</B>]
|
|
|
|
[<I>fs-specific-options</I>]
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>fsck</B>
|
|
|
|
is used to check and optionally repair one or more Linux filesystems.
|
|
<I>filesys</I>
|
|
|
|
can be a device name (e.g.
|
|
<I>/dev/hdc1</I>, <I>/dev/sdb2</I>),
|
|
|
|
a mount point (e.g.
|
|
<I>/</I>, <I>/usr</I>, <I>/home</I>),
|
|
|
|
or an filesystem label or UUID specifier (e.g.
|
|
UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root).
|
|
Normally, the
|
|
<B>fsck</B>
|
|
|
|
program will try to handle filesystems on different physical disk drives
|
|
in parallel to reduce the total amount of time needed to check all of them.
|
|
<P>
|
|
|
|
If no filesystems are specified on the command line, and the
|
|
<B>-A</B>
|
|
|
|
option is not specified,
|
|
<B>fsck</B>
|
|
|
|
will default to checking filesystems in
|
|
<I>/etc/fstab</I>
|
|
|
|
serially. This is equivalent to the
|
|
<B>-As</B>
|
|
|
|
options.
|
|
<P>
|
|
|
|
The exit code returned by
|
|
<B>fsck</B>
|
|
|
|
is the sum of the following conditions:
|
|
<P>
|
|
|
|
<DL COMPACT><DT id="1"><DD>
|
|
|
|
<DL COMPACT>
|
|
<DT id="2"><B>0</B>
|
|
|
|
<DD>
|
|
No errors
|
|
<DT id="3"><B>1</B>
|
|
|
|
<DD>
|
|
Filesystem errors corrected
|
|
<DT id="4"><B>2</B>
|
|
|
|
<DD>
|
|
System should be rebooted
|
|
<DT id="5"><B>4</B>
|
|
|
|
<DD>
|
|
Filesystem errors left uncorrected
|
|
<DT id="6"><B>8</B>
|
|
|
|
<DD>
|
|
Operational error
|
|
<DT id="7"><B>16</B>
|
|
|
|
<DD>
|
|
Usage or syntax error
|
|
<DT id="8"><B>32</B>
|
|
|
|
<DD>
|
|
Checking canceled by user request
|
|
<DT id="9"><B>128</B>
|
|
|
|
<DD>
|
|
Shared-library error
|
|
|
|
</DL>
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
The exit code returned when multiple filesystems are checked
|
|
is the bit-wise OR of the exit codes for each
|
|
filesystem that is checked.
|
|
<P>
|
|
|
|
In actuality,
|
|
<B>fsck</B>
|
|
|
|
is simply a front-end for the various filesystem checkers
|
|
(<B>fsck</B>.<I>fstype</I>) available under Linux. The
|
|
filesystem-specific checker is searched for in the
|
|
PATH environment variable. If the PATH is undefined then
|
|
fallback to "/sbin".
|
|
<P>
|
|
|
|
Please see the filesystem-specific checker manual pages for
|
|
further details.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="10"><B>-l</B>
|
|
|
|
<DD>
|
|
Create an exclusive
|
|
<B><A HREF="/cgi-bin/man/man2html?2+flock">flock</A></B>(2)
|
|
|
|
lock file (/run/fsck/<diskname>.lock) for whole-disk device.
|
|
This option can be used with one device only (this means that <B>-A</B> and
|
|
<B>-l</B> are mutually exclusive). This option is recommended when more
|
|
<B><A HREF="/cgi-bin/man/man2html?8+fsck">fsck</A></B>(8)
|
|
|
|
instances are executed in the same time. The option is ignored when used for
|
|
multiple devices or for non-rotating disks. <B>fsck</B> does not lock underlying
|
|
devices when executed to check stacked devices (e.g. MD or DM) - this feature is
|
|
not implemented yet.
|
|
<DT id="11"><B>-r</B> [<B></B><I>fd</I>]
|
|
|
|
<DD>
|
|
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:
|
|
<P>
|
|
/dev/sda1: status 0, rss 92828, real 4.002804, user 2.677592, sys 0.86186
|
|
<P>
|
|
GUI front-ends may specify a file descriptor
|
|
<I>fd</I>,
|
|
|
|
in which case the progress bar information will be sent to that file descriptor
|
|
in a machine parsable format. For example:
|
|
<P>
|
|
/dev/sda1 0 92828 4.002804 2.677592 0.86186
|
|
<DT id="12"><B>-s</B>
|
|
|
|
<DD>
|
|
Serialize
|
|
<B>fsck</B>
|
|
|
|
operations. This is a good idea if you are checking multiple
|
|
filesystems and the checkers are in an interactive mode. (Note:
|
|
<B><A HREF="/cgi-bin/man/man2html?8+e2fsck">e2fsck</A></B>(8)
|
|
|
|
runs in an interactive mode by default. To make
|
|
<B><A HREF="/cgi-bin/man/man2html?8+e2fsck">e2fsck</A></B>(8)
|
|
|
|
run in a non-interactive mode, you must either specify the
|
|
<B>-p</B>
|
|
|
|
or
|
|
<B>-a</B>
|
|
|
|
option, if you wish for errors to be corrected automatically, or the
|
|
<B>-n</B>
|
|
|
|
option if you do not.)
|
|
<DT id="13"><B>-t</B><I> fslist</I>
|
|
|
|
<DD>
|
|
Specifies the type(s) of filesystem to be checked. When the
|
|
<B>-A</B>
|
|
|
|
flag is specified, only filesystems that match
|
|
<I>fslist</I>
|
|
|
|
are checked. The
|
|
<I>fslist</I>
|
|
|
|
parameter is a comma-separated list of filesystems and options
|
|
specifiers. All of the filesystems in this comma-separated list may be
|
|
prefixed by a negation operator
|
|
'<B>no</B>'
|
|
|
|
or
|
|
'<B>!</B>',
|
|
|
|
which requests that only those filesystems not listed in
|
|
<I>fslist</I>
|
|
|
|
will be checked. If none of the filesystems in
|
|
<I>fslist</I>
|
|
|
|
is prefixed by a negation operator, then only those listed filesystems
|
|
will be checked.
|
|
<P>
|
|
Options specifiers may be included in the comma-separated
|
|
<I>fslist</I>.
|
|
|
|
They must have the format
|
|
<B>opts=</B><I>fs-option</I>.
|
|
|
|
If an options specifier is present, then only filesystems which contain
|
|
<I>fs-option</I>
|
|
|
|
in their mount options field of
|
|
<I>/etc/fstab</I>
|
|
|
|
will be checked. If the options specifier is prefixed by a negation
|
|
operator, then only
|
|
those filesystems that do not have
|
|
<I>fs-option</I>
|
|
|
|
in their mount options field of
|
|
<I>/etc/fstab</I>
|
|
|
|
will be checked.
|
|
<P>
|
|
For example, if
|
|
<B>opts=ro</B>
|
|
|
|
appears in
|
|
<I>fslist</I>,
|
|
|
|
then only filesystems listed in
|
|
<I>/etc/fstab</I>
|
|
|
|
with the
|
|
<B>ro</B>
|
|
|
|
option will be checked.
|
|
<P>
|
|
For compatibility with Mandrake distributions whose boot scripts
|
|
depend upon an unauthorized UI change to the
|
|
<B>fsck</B>
|
|
|
|
program, if a filesystem type of
|
|
<B>loop</B>
|
|
|
|
is found in
|
|
<I>fslist</I>,
|
|
|
|
it is treated as if
|
|
<B>opts=loop</B>
|
|
|
|
were specified as an argument to the
|
|
<B>-t</B>
|
|
|
|
option.
|
|
<P>
|
|
Normally, the filesystem type is deduced by searching for
|
|
<I>filesys</I>
|
|
|
|
in the
|
|
<I>/etc/fstab</I>
|
|
|
|
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
|
|
<B>-t</B>
|
|
|
|
option,
|
|
<B>fsck</B>
|
|
|
|
will use the specified filesystem type. If this type is not
|
|
available, then the default filesystem type (currently ext2) is used.
|
|
<DT id="14"><B>-A</B>
|
|
|
|
<DD>
|
|
Walk through the
|
|
<I>/etc/fstab</I>
|
|
|
|
file and try to check all filesystems in one run. This option is
|
|
typically used from the
|
|
<I>/etc/rc</I>
|
|
|
|
system initialization file, instead of multiple commands for checking
|
|
a single filesystem.
|
|
<P>
|
|
The root filesystem will be checked first unless the
|
|
<B>-P</B>
|
|
|
|
option is specified (see below). After that,
|
|
filesystems will be checked in the order specified by the
|
|
<I>fs_passno</I>
|
|
|
|
(the sixth) field in the
|
|
<I>/etc/fstab</I>
|
|
|
|
file.
|
|
Filesystems with a
|
|
<I>fs_passno</I>
|
|
|
|
value of 0 are skipped and are not checked at all. Filesystems with a
|
|
<I>fs_passno</I>
|
|
|
|
value of greater than zero will be checked in order,
|
|
with filesystems with the lowest
|
|
<I>fs_passno</I>
|
|
|
|
number being checked first.
|
|
If there are multiple filesystems with the same pass number,
|
|
<B>fsck</B>
|
|
|
|
will attempt to check them in parallel, although it will avoid running
|
|
multiple filesystem checks on the same physical disk.
|
|
<P>
|
|
<B>fsck</B>
|
|
|
|
does not check stacked devices (RAIDs, dm-crypt, ...) in parallel with any other
|
|
device. See below for FSCK_FORCE_ALL_PARALLEL setting. The /sys filesystem is
|
|
used to determine dependencies between devices.
|
|
<P>
|
|
Hence, a very common configuration in
|
|
<I>/etc/fstab</I>
|
|
|
|
files is to set the root filesystem to have a
|
|
<I>fs_passno</I>
|
|
|
|
value of 1
|
|
and to set all other filesystems to have a
|
|
<I>fs_passno</I>
|
|
|
|
value of 2. This will allow
|
|
<B>fsck</B>
|
|
|
|
to automatically run filesystem checkers in parallel if it is advantageous
|
|
to do so. System administrators might choose
|
|
not to use this configuration if they need to avoid multiple filesystem
|
|
checks running in parallel for some reason - for example, if the
|
|
machine in question is short on memory so that
|
|
excessive paging is a concern.
|
|
<P>
|
|
<B>fsck</B>
|
|
|
|
normally does not check whether the device actually exists before
|
|
calling a filesystem specific checker. Therefore non-existing
|
|
devices may cause the system to enter filesystem repair mode during
|
|
boot if the filesystem specific checker returns a fatal error. The
|
|
<I>/etc/fstab</I>
|
|
|
|
mount option
|
|
<B>nofail</B>
|
|
|
|
may be used to have
|
|
<B>fsck</B>
|
|
|
|
skip non-existing devices.
|
|
<B>fsck</B>
|
|
|
|
also skips non-existing devices that have the special filesystem type
|
|
<B>auto</B>.
|
|
|
|
<DT id="15"><B>-C</B> [<B></B><I>fd</I>]
|
|
|
|
<DD>
|
|
Display completion/progress bars for those filesystem checkers (currently
|
|
only for ext[234]) which support them. <B>fsck</B> will manage the
|
|
filesystem checkers so that only one of them will display
|
|
a progress bar at a time. GUI front-ends may specify a file descriptor
|
|
<I>fd</I>,
|
|
|
|
in which case the progress bar information will be sent to that file descriptor.
|
|
<DT id="16"><B>-M</B>
|
|
|
|
<DD>
|
|
Do not check mounted filesystems and return an exit code of 0
|
|
for mounted filesystems.
|
|
<DT id="17"><B>-N</B>
|
|
|
|
<DD>
|
|
Don't execute, just show what would be done.
|
|
<DT id="18"><B>-P</B>
|
|
|
|
<DD>
|
|
When the
|
|
<B>-A</B>
|
|
|
|
flag is set, check the root filesystem in parallel with the other filesystems.
|
|
This is not the safest thing in the world to do,
|
|
since if the root filesystem is in doubt things like the
|
|
<B><A HREF="/cgi-bin/man/man2html?8+e2fsck">e2fsck</A></B>(8)
|
|
|
|
executable might be corrupted! This option is mainly provided
|
|
for those sysadmins who don't want to repartition the root
|
|
filesystem to be small and compact (which is really the right solution).
|
|
<DT id="19"><B>-R</B>
|
|
|
|
<DD>
|
|
When checking all filesystems with the
|
|
<B>-A</B>
|
|
|
|
flag, skip the root filesystem. (This is useful in case the root
|
|
filesystem has already been mounted read-write.)
|
|
<DT id="20"><B>-T</B>
|
|
|
|
<DD>
|
|
Don't show the title on startup.
|
|
<DT id="21"><B>-V</B>
|
|
|
|
<DD>
|
|
Produce verbose output, including all filesystem-specific commands
|
|
that are executed.
|
|
<DT id="22"><B>-?</B>, <B>--help</B><DD>
|
|
Display help text and exit.
|
|
<DT id="23"><B>--version</B><DD>
|
|
Display version information and exit.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>FILESYSTEM SPECIFIC OPTIONS</H2>
|
|
|
|
<B>Options which are not understood by fsck are passed to the filesystem-specific checker! </B>
|
|
|
|
<P>
|
|
|
|
These options
|
|
<B>must</B>
|
|
|
|
not take arguments, as there is no
|
|
way for
|
|
<B>fsck</B>
|
|
|
|
to be able to properly guess which options take arguments and which
|
|
don't.
|
|
<P>
|
|
|
|
Options and arguments which follow the
|
|
<B>--</B>
|
|
|
|
are treated as filesystem-specific options to be passed to the
|
|
filesystem-specific checker.
|
|
<P>
|
|
|
|
Please note that <B>fsck</B> is not
|
|
designed to pass arbitrarily complicated options to filesystem-specific
|
|
checkers. If you're doing something complicated, please just
|
|
execute the filesystem-specific checker directly. If you pass
|
|
<B>fsck</B>
|
|
|
|
some horribly complicated options and arguments, and it doesn't do
|
|
what you expect,
|
|
<B>don't bother reporting it as a bug.</B>
|
|
|
|
You're almost certainly doing something that you shouldn't be doing
|
|
with
|
|
<B>fsck</B>.
|
|
|
|
Options to different filesystem-specific fsck's are not standardized.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>FILES</H2>
|
|
|
|
<I>/etc/fstab</I>
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H2>ENVIRONMENT VARIABLES</H2>
|
|
|
|
The
|
|
<B>fsck</B>
|
|
|
|
program's behavior is affected by the following environment variables:
|
|
<DL COMPACT>
|
|
<DT id="24"><B>FSCK_FORCE_ALL_PARALLEL</B>
|
|
|
|
<DD>
|
|
If this environment variable is set,
|
|
<B>fsck</B>
|
|
|
|
will attempt to check all of the specified filesystems in parallel, regardless of
|
|
whether the filesystems appear to be on the same device. (This is useful for
|
|
RAID systems or high-end storage systems such as those sold by companies such
|
|
as IBM or EMC.) Note that the fs_passno value is still used.
|
|
<DT id="25"><B>FSCK_MAX_INST</B>
|
|
|
|
<DD>
|
|
This environment variable will limit the maximum number of filesystem
|
|
checkers that can be running at one time. This allows configurations
|
|
which have a large number of disks to avoid
|
|
<B>fsck</B>
|
|
|
|
starting too many filesystem checkers at once, which might overload
|
|
CPU and memory resources available on the system. If this value is
|
|
zero, then an unlimited number of processes can be spawned. This is
|
|
currently the default, but future versions of
|
|
<B>fsck</B>
|
|
|
|
may attempt to automatically determine how many filesystem checks can
|
|
be run based on gathering accounting data from the operating system.
|
|
<DT id="26"><B>PATH</B>
|
|
|
|
<DD>
|
|
The
|
|
<B>PATH</B>
|
|
|
|
environment variable is used to find filesystem checkers.
|
|
<DT id="27"><B>FSTAB_FILE</B>
|
|
|
|
<DD>
|
|
This environment variable allows the system administrator
|
|
to override the standard location of the
|
|
<I>/etc/fstab</I>
|
|
|
|
file. It is also useful for developers who are testing
|
|
<B>fsck</B>.
|
|
|
|
<DT id="28"><B>LIBBLKID_DEBUG=all</B>
|
|
|
|
<DD>
|
|
enables libblkid debug output.
|
|
<DT id="29"><B>LIBMOUNT_DEBUG=all</B>
|
|
|
|
<DD>
|
|
enables libmount debug output.
|
|
</DL>
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+fstab">fstab</A></B>(5),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+mkfs">mkfs</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+fsck.ext2">fsck.ext2</A></B>(8)
|
|
|
|
or
|
|
<B><A HREF="/cgi-bin/man/man2html?8+fsck.ext3">fsck.ext3</A></B>(8)
|
|
|
|
or
|
|
<B><A HREF="/cgi-bin/man/man2html?8+e2fsck">e2fsck</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+cramfsck">cramfsck</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+fsck.jfs">fsck.jfs</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+fsck.nfs">fsck.nfs</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+fsck.minix">fsck.minix</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+fsck.msdos">fsck.msdos</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+fsck.vfat">fsck.vfat</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+fsck.xfs">fsck.xfs</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+reiserfsck">reiserfsck</A></B>(8)
|
|
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>AUTHORS</H2>
|
|
|
|
<PRE>
|
|
Theodore Ts'o <<A HREF="mailto:tytso@mit.edu">tytso@mit.edu</A>>
|
|
Karel Zak <<A HREF="mailto:kzak@redhat.com">kzak@redhat.com</A>>
|
|
</PRE>
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H2>AVAILABILITY</H2>
|
|
|
|
The fsck command is part of the util-linux package and is available from
|
|
|
|
Linux Kernel Archive
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="30"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="31"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="32"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="33"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="34"><A HREF="#lbAF">FILESYSTEM SPECIFIC OPTIONS</A><DD>
|
|
<DT id="35"><A HREF="#lbAG">FILES</A><DD>
|
|
<DT id="36"><A HREF="#lbAH">ENVIRONMENT VARIABLES</A><DD>
|
|
<DT id="37"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
<DT id="38"><A HREF="#lbAJ">AUTHORS</A><DD>
|
|
<DT id="39"><A HREF="#lbAK">AVAILABILITY</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:12 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|