fsck(1)
NAME
fsck - perform file system consistency check
SYNOPSIS
fsck [-pfwcyn] [-l number] [filesystem ...]
DESCRIPTION
Fsck checks a file system's consistency after a crash or to make sure
that an unknown file system may be safely mounted.
Fsck is really a forerunner to fsck1 through fsck2f, see fsck1(1) for
more details.
This program is a kind of manager to the four real checkers, it will read
/etc/fstab (see fstab(5)) to check all the file systems with a non-zero
pass number if no arguments are given, or it will use the fstab to
translate the name of a mount point to the proper device, so you can type
fsck /usr for instance. It will know which program to call by looking at
the superblock type.
The clean flag
Fsck is a bit more than just a forerunner, it will also manage the so-
called "file system clean flag". This flag is cleared by the kernel when
a file system is mounted, and set when it is unmounted or when the system
is rebooted with reboot(8), but only if it was set to begin with.
The clean flag will only be set if it is specifically enabled by a
special magic number in the superblock. It should only be enabled if the
file system is never ever used by a system that does not know about the
clean flag, because those systems will either choke on it (most likely),
or not clear it on mount.
Mkfs will enable the clean flag when making a flex file system, because
no other system can use this file system type anyway.
OPTIONS
-p Run in preen mode repairing noncritical errors automatically.
Errors that need operator intervention are only noted, but not
repaired. Even file systems that are mounted are checked, because
the root file system is mounted read-only at boot time. You should
reboot immediately if the root file system had to be repaired.
Several fsck's should be run in parallel for file systems with the
same pass number, but this is not yet implemented. (The output from
the different fsck's would make an unintelligible mess.)
-l number
Limit the number of fscks run in parallel in preen mode. (Useful,
isn't it?)
-f Force checking even if the file system is marked clean.
-w Only check file systems from fstab that are normally mounted read-
write.
-c Toggle the clean flag enable. On a file system with a clean flag it
will disable the flag and reset it, on a file system without the
clean flag enabled it will write the necessary magic number to
enable it. No check will be done, all other options will be
ignored.
-n Assume 'no' to all questions asked, the file system will be opened
read-only and only a report on all the errors will be generated.
Fsck will automatically revert to this mode if the file system can't
be opened read-write.
-y Assume 'yes' on all questions asked. This is a dangerous option,
because it will allow repairs being made without user supervision.
Better first run fsck -n to see what it is up to.
FILES
/etc/fstab Default list of file systems to check.
/etc/mtab To check if a file system is currently mounted.
SEE ALSO
fsck1(1), fstab(5), mkfs(1), mount(1).
EXIT STATUS
0 Either there were no errors, or all errors were successfully
corrected.
2 A QUIT signal has been typed while in preen mode. The fsck is
finished, but the reboot must be interrupted.
4 Errors have been corrected on a mounted file system.
8 There are serious errors that have not been fixed, or another severe
error.
12 An INTERRUPT signal stopped the fsck.
DIAGNOSTICS
The message you like to see at boot time: "/dev/hd3: is clean".
AUTHOR
Kees J. Bot (kjb@cs.vu.nl)