1998-12-03 02:27:35 +00:00
|
|
|
.\"
|
1994-05-26 06:35:07 +00:00
|
|
|
.\" Copyright (c) 1980, 1989, 1991, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
2017-02-28 23:42:47 +00:00
|
|
|
.\" 3. Neither the name of the University nor the names of its contributors
|
1994-05-26 06:35:07 +00:00
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1997-03-11 12:20:21 +00:00
|
|
|
.\" @(#)fsck.8 8.4 (Berkeley) 5/9/95
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1994-05-26 06:35:07 +00:00
|
|
|
.\"
|
This update eliminates a kernel stack disclosure bug in UFS/FFS
directory entries that is caused by uninitialized directory entry
padding written to the disk. It can be viewed by any user with read
access to that directory. Up to 3 bytes of kernel stack are disclosed
per file entry, depending on the the amount of padding the kernel
needs to pad out the entry to a 32 bit boundry. The offset in the
kernel stack that is disclosed is a function of the filename size.
Furthermore, if the user can create files in a directory, this 3
byte window can be expanded 3 bytes at a time to a 254 byte window
with 75% of the data in that window exposed. The additional exposure
is done by removing the entry, creating a new entry with a 4-byte
longer name, extracting 3 more bytes by reading the directory, and
repeating until a 252 byte name is created.
This exploit works in part because the area of the kernel stack
that is being disclosed is in an area that typically doesn't change
that often (perhaps a few times a second on a lightly loaded system),
and these file creates and unlinks themselves don't overwrite the
area of kernel stack being disclosed.
It appears that this bug originated with the creation of the Fast
File System in 4.1b-BSD (Circa 1982, more than 36 years ago!), and
is likely present in every Unix or Unix-like system that uses
UFS/FFS. Amazingly, nobody noticed until now.
This update also adds the -z flag to fsck_ffs to have it scrub
the leaked information in the name padding of existing directories.
It only needs to be run once on each UFS/FFS filesystem after a
patched kernel is installed and running.
Submitted by: David G. Lawrence <dg@dglawrence.com>
Reviewed by: kib
MFC after: 1 week
2019-05-03 21:54:14 +00:00
|
|
|
.Dd May 3, 2019
|
2001-02-12 17:50:14 +00:00
|
|
|
.Dt FSCK_FFS 8
|
2001-04-27 08:36:48 +00:00
|
|
|
.Os
|
1994-05-26 06:35:07 +00:00
|
|
|
.Sh NAME
|
2001-02-12 17:50:14 +00:00
|
|
|
.Nm fsck_ffs ,
|
|
|
|
.Nm fsck_ufs
|
2002-08-21 18:11:48 +00:00
|
|
|
.Nd file system consistency check and interactive repair
|
1994-05-26 06:35:07 +00:00
|
|
|
.Sh SYNOPSIS
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
This update eliminates a kernel stack disclosure bug in UFS/FFS
directory entries that is caused by uninitialized directory entry
padding written to the disk. It can be viewed by any user with read
access to that directory. Up to 3 bytes of kernel stack are disclosed
per file entry, depending on the the amount of padding the kernel
needs to pad out the entry to a 32 bit boundry. The offset in the
kernel stack that is disclosed is a function of the filename size.
Furthermore, if the user can create files in a directory, this 3
byte window can be expanded 3 bytes at a time to a 254 byte window
with 75% of the data in that window exposed. The additional exposure
is done by removing the entry, creating a new entry with a 4-byte
longer name, extracting 3 more bytes by reading the directory, and
repeating until a 252 byte name is created.
This exploit works in part because the area of the kernel stack
that is being disclosed is in an area that typically doesn't change
that often (perhaps a few times a second on a lightly loaded system),
and these file creates and unlinks themselves don't overwrite the
area of kernel stack being disclosed.
It appears that this bug originated with the creation of the Fast
File System in 4.1b-BSD (Circa 1982, more than 36 years ago!), and
is likely present in every Unix or Unix-like system that uses
UFS/FFS. Amazingly, nobody noticed until now.
This update also adds the -z flag to fsck_ffs to have it scrub
the leaked information in the name padding of existing directories.
It only needs to be run once on each UFS/FFS filesystem after a
patched kernel is installed and running.
Submitted by: David G. Lawrence <dg@dglawrence.com>
Reviewed by: kib
MFC after: 1 week
2019-05-03 21:54:14 +00:00
|
|
|
.Op Fl BCdEFfnpRrSyZz
|
2005-02-10 09:19:34 +00:00
|
|
|
.Op Fl b Ar block
|
1994-05-26 06:35:07 +00:00
|
|
|
.Op Fl c Ar level
|
|
|
|
.Op Fl m Ar mode
|
2002-08-27 00:49:27 +00:00
|
|
|
.Ar filesystem
|
1994-05-26 06:35:07 +00:00
|
|
|
.Ar ...
|
|
|
|
.Sh DESCRIPTION
|
2002-08-21 18:11:48 +00:00
|
|
|
The specified disk partitions and/or file systems are checked.
|
2009-01-30 18:33:05 +00:00
|
|
|
In "preen" or "check clean" mode the clean flag of each file system's
|
|
|
|
superblock is examined and only those file systems that are not marked clean
|
|
|
|
are checked.
|
2002-12-12 17:26:04 +00:00
|
|
|
File systems are marked clean when they are unmounted,
|
1997-03-11 12:20:21 +00:00
|
|
|
when they have been mounted read-only, or when
|
1998-12-03 02:41:11 +00:00
|
|
|
.Nm
|
1997-03-11 12:20:21 +00:00
|
|
|
runs on them successfully.
|
1998-12-03 02:41:11 +00:00
|
|
|
If the
|
|
|
|
.Fl f
|
2002-08-21 18:11:48 +00:00
|
|
|
option is specified, the file systems
|
1998-12-03 02:41:11 +00:00
|
|
|
will be checked regardless of the state of their clean flag.
|
1994-08-20 16:56:36 +00:00
|
|
|
.Pp
|
2002-08-21 18:11:48 +00:00
|
|
|
The kernel takes care that only a restricted class of innocuous file system
|
1994-05-26 06:35:07 +00:00
|
|
|
inconsistencies can happen unless hardware or software failures intervene.
|
|
|
|
These are limited to the following:
|
1998-12-03 02:27:35 +00:00
|
|
|
.Pp
|
|
|
|
.Bl -item -compact -offset indent
|
1994-05-26 06:35:07 +00:00
|
|
|
.It
|
|
|
|
Unreferenced inodes
|
|
|
|
.It
|
|
|
|
Link counts in inodes too large
|
|
|
|
.It
|
|
|
|
Missing blocks in the free map
|
|
|
|
.It
|
|
|
|
Blocks in the free map also in files
|
|
|
|
.It
|
|
|
|
Counts in the super-block wrong
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
These are the only inconsistencies that
|
1998-12-03 02:41:11 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
with the
|
|
|
|
.Fl p
|
|
|
|
option will correct; if it encounters other inconsistencies, it exits
|
|
|
|
with an abnormal return status and an automatic reboot will then fail.
|
|
|
|
For each corrected inconsistency one or more lines will be printed
|
2002-08-21 18:11:48 +00:00
|
|
|
identifying the file system on which the correction will take place,
|
2004-07-02 21:45:06 +00:00
|
|
|
and the nature of the correction.
|
|
|
|
After successfully correcting a file system,
|
1998-12-03 02:41:11 +00:00
|
|
|
.Nm
|
2002-08-21 18:11:48 +00:00
|
|
|
will print the number of files on that file system,
|
1994-05-26 06:35:07 +00:00
|
|
|
the number of used and free blocks,
|
|
|
|
and the percentage of fragmentation.
|
|
|
|
.Pp
|
|
|
|
If sent a
|
|
|
|
.Dv QUIT
|
|
|
|
signal,
|
1998-12-03 02:41:11 +00:00
|
|
|
.Nm
|
2002-08-21 18:11:48 +00:00
|
|
|
will finish the file system checks, then exit with an abnormal
|
1994-05-26 06:35:07 +00:00
|
|
|
return status that causes an automatic reboot to fail.
|
2002-08-21 18:11:48 +00:00
|
|
|
This is useful when you want to finish the file system checks during an
|
1994-05-26 06:35:07 +00:00
|
|
|
automatic reboot,
|
|
|
|
but do not want the machine to come up multiuser after the checks complete.
|
|
|
|
.Pp
|
2001-01-03 13:53:48 +00:00
|
|
|
If
|
|
|
|
.Nm
|
|
|
|
receives a
|
|
|
|
.Dv SIGINFO
|
|
|
|
(see the
|
|
|
|
.Dq status
|
|
|
|
argument for
|
|
|
|
.Xr stty 1 )
|
|
|
|
signal, a line will be written to the standard output indicating
|
|
|
|
the name of the device currently being checked, the current phase
|
|
|
|
number and phase-specific progress information.
|
|
|
|
.Pp
|
1994-05-26 06:35:07 +00:00
|
|
|
Without the
|
|
|
|
.Fl p
|
|
|
|
option,
|
1998-12-03 02:41:11 +00:00
|
|
|
.Nm
|
2002-08-21 18:11:48 +00:00
|
|
|
audits and interactively repairs inconsistent conditions for file systems.
|
|
|
|
If the file system is inconsistent the operator is prompted for concurrence
|
1994-05-26 06:35:07 +00:00
|
|
|
before each correction is attempted.
|
|
|
|
It should be noted that some of the corrective actions which are not
|
|
|
|
correctable under the
|
|
|
|
.Fl p
|
|
|
|
option will result in some loss of data.
|
|
|
|
The amount and severity of data lost may be determined from the diagnostic
|
|
|
|
output.
|
|
|
|
The default action for each consistency correction
|
|
|
|
is to wait for the operator to respond
|
|
|
|
.Li yes
|
|
|
|
or
|
|
|
|
.Li no .
|
2002-08-21 18:11:48 +00:00
|
|
|
If the operator does not have write permission on the file system
|
1998-12-03 02:41:11 +00:00
|
|
|
.Nm
|
2001-07-15 07:53:42 +00:00
|
|
|
will default to a
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl n
|
|
|
|
action.
|
|
|
|
.Pp
|
|
|
|
The following flags are interpreted by
|
2001-04-27 08:36:48 +00:00
|
|
|
.Nm :
|
1994-05-26 06:35:07 +00:00
|
|
|
.Bl -tag -width indent
|
2011-04-27 02:32:41 +00:00
|
|
|
.It Fl B
|
|
|
|
A check is done on the specified and possibly active file system.
|
|
|
|
The set of corrections that can be done is limited to those done
|
|
|
|
when running in preen mode (see the
|
2011-04-27 02:35:57 +00:00
|
|
|
.Fl p
|
|
|
|
flag).
|
|
|
|
If unexpected errors are found,
|
|
|
|
the file system is marked as needing a foreground check and
|
|
|
|
.Nm
|
|
|
|
exits without attempting any further cleaning.
|
1994-05-26 06:35:07 +00:00
|
|
|
.It Fl b
|
|
|
|
Use the block specified immediately after the flag as
|
2004-07-02 21:45:06 +00:00
|
|
|
the super block for the file system.
|
2005-09-20 08:02:38 +00:00
|
|
|
An alternate super block is usually located at block 32 for UFS1,
|
2019-08-07 16:56:00 +00:00
|
|
|
and block 192 for UFS2.
|
2012-02-10 12:01:19 +00:00
|
|
|
.Pp
|
|
|
|
See the
|
|
|
|
.Fl N
|
|
|
|
flag of
|
|
|
|
.Xr newfs 8 .
|
2009-01-30 18:33:05 +00:00
|
|
|
.It Fl C
|
2010-08-06 14:33:42 +00:00
|
|
|
Check if file system was dismounted cleanly.
|
2009-01-30 18:33:05 +00:00
|
|
|
If so, skip file system checks (like "preen").
|
|
|
|
However, if the file system was not cleanly dismounted, do full checks,
|
2010-08-16 15:18:30 +00:00
|
|
|
as if
|
2009-01-30 18:33:05 +00:00
|
|
|
.Nm
|
|
|
|
was invoked without
|
|
|
|
.Fl C .
|
1994-05-26 06:35:07 +00:00
|
|
|
.It Fl c
|
2002-08-21 18:11:48 +00:00
|
|
|
Convert the file system to the specified level.
|
|
|
|
Note that the level of a file system can only be raised.
|
1997-03-11 12:20:21 +00:00
|
|
|
There are currently four levels defined:
|
2001-04-16 15:12:58 +00:00
|
|
|
.Bl -tag -width indent
|
1994-05-26 06:35:07 +00:00
|
|
|
.It 0
|
2002-08-21 18:11:48 +00:00
|
|
|
The file system is in the old (static table) format.
|
1994-05-26 06:35:07 +00:00
|
|
|
.It 1
|
2002-08-21 18:11:48 +00:00
|
|
|
The file system is in the new (dynamic table) format.
|
1994-05-26 06:35:07 +00:00
|
|
|
.It 2
|
2002-08-21 18:11:48 +00:00
|
|
|
The file system supports 32-bit uid's and gid's,
|
2001-07-15 07:53:42 +00:00
|
|
|
short symbolic links are stored in the inode,
|
1994-05-26 06:35:07 +00:00
|
|
|
and directories have an added field showing the file type.
|
1997-03-11 12:20:21 +00:00
|
|
|
.It 3
|
|
|
|
If maxcontig is greater than one,
|
|
|
|
build the free segment maps to aid in finding contiguous sets of blocks.
|
|
|
|
If maxcontig is equal to one, delete any existing segment maps.
|
1994-05-26 06:35:07 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
In interactive mode,
|
1998-12-03 02:41:11 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
will list the conversion to be made
|
|
|
|
and ask whether the conversion should be done.
|
|
|
|
If a negative answer is given,
|
2002-08-21 18:11:48 +00:00
|
|
|
no further operations are done on the file system.
|
1994-05-26 06:35:07 +00:00
|
|
|
In preen mode,
|
|
|
|
the conversion is listed and done if
|
|
|
|
possible without user interaction.
|
2002-08-21 18:11:48 +00:00
|
|
|
Conversion in preen mode is best used when all the file systems
|
1994-05-26 06:35:07 +00:00
|
|
|
are being converted at once.
|
2002-08-21 18:11:48 +00:00
|
|
|
The format of a file system can be determined from the
|
2001-07-15 07:53:42 +00:00
|
|
|
first line of output from
|
1994-05-26 06:35:07 +00:00
|
|
|
.Xr dumpfs 8 .
|
2009-01-20 22:49:49 +00:00
|
|
|
.Pp
|
|
|
|
This option implies the
|
|
|
|
.Fl f
|
|
|
|
flag.
|
2017-02-14 21:14:24 +00:00
|
|
|
.It Fl d
|
|
|
|
Enable debugging messages.
|
|
|
|
.It Fl E
|
|
|
|
Clear unallocated blocks, notifying the underlying device that they
|
|
|
|
are not used and that their contents may be discarded.
|
|
|
|
This is useful for filesystems which have been mounted on systems
|
|
|
|
without TRIM support, or with TRIM support disabled, as well as
|
|
|
|
filesystems which have been copied from one device to another.
|
|
|
|
.Pp
|
|
|
|
See the
|
|
|
|
.Fl E
|
|
|
|
and
|
|
|
|
.Fl t
|
|
|
|
flags of
|
|
|
|
.Xr newfs 8 ,
|
|
|
|
and
|
|
|
|
the
|
|
|
|
.Fl t
|
|
|
|
flag of
|
|
|
|
.Xr tunefs 8 .
|
|
|
|
.It Fl F
|
|
|
|
Determine whether the file system needs to be cleaned immediately
|
|
|
|
in foreground, or if its cleaning can be deferred to background.
|
|
|
|
To be eligible for background cleaning it must have been running
|
|
|
|
with soft updates, not have been marked as needing a foreground check,
|
|
|
|
and be mounted and writable when the background check is to be done.
|
|
|
|
If these conditions are met, then
|
|
|
|
.Nm
|
|
|
|
exits with a zero exit status.
|
|
|
|
Otherwise it exits with a non-zero exit status.
|
|
|
|
If the file system is clean,
|
|
|
|
it will exit with a non-zero exit status so that the clean status
|
|
|
|
of the file system can be verified and reported during the foreground
|
|
|
|
checks.
|
|
|
|
Note that when invoked with the
|
|
|
|
.Fl F
|
|
|
|
flag, no cleanups are done.
|
|
|
|
The only thing that
|
|
|
|
.Nm
|
|
|
|
does is to determine whether a foreground or background
|
|
|
|
check is needed and exit with an appropriate status code.
|
1998-12-03 02:27:35 +00:00
|
|
|
.It Fl f
|
|
|
|
Force
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1998-12-03 02:27:35 +00:00
|
|
|
to check
|
|
|
|
.Sq clean
|
2002-08-21 18:11:48 +00:00
|
|
|
file systems when preening.
|
1998-12-03 02:27:35 +00:00
|
|
|
.It Fl m
|
|
|
|
Use the mode specified in octal immediately after the flag as the
|
|
|
|
permission bits to use when creating the
|
|
|
|
.Pa lost+found
|
|
|
|
directory rather than the default 1777.
|
|
|
|
In particular, systems that do not wish to have lost files accessible
|
|
|
|
by all users on the system should use a more restrictive
|
|
|
|
set of permissions such as 700.
|
|
|
|
.It Fl n
|
2001-07-15 07:53:42 +00:00
|
|
|
Assume a no response to all questions asked by
|
1998-12-03 02:41:11 +00:00
|
|
|
.Nm
|
1998-12-03 02:27:35 +00:00
|
|
|
except for
|
|
|
|
.Ql CONTINUE? ,
|
|
|
|
which is assumed to be affirmative;
|
2002-08-21 18:11:48 +00:00
|
|
|
do not open the file system for writing.
|
1998-12-03 02:27:35 +00:00
|
|
|
.It Fl p
|
2002-08-21 18:11:48 +00:00
|
|
|
Preen file systems (see above).
|
2013-12-30 01:16:08 +00:00
|
|
|
.It Fl R
|
|
|
|
Instruct fsck_ffs to restart itself if it encounters certain errors that
|
2016-10-05 20:38:49 +00:00
|
|
|
warrant another run.
|
|
|
|
It will limit itself to a maximum of 10 restarts in a given run in order
|
|
|
|
to avoid an endless loop with extremely corrupted filesystems.
|
2009-02-04 01:02:56 +00:00
|
|
|
.It Fl r
|
|
|
|
Free up excess unused inodes.
|
|
|
|
Decreasing the number of preallocated inodes reduces the
|
|
|
|
running time of future runs of
|
|
|
|
.Nm
|
|
|
|
and frees up space that can allocated to files.
|
|
|
|
The
|
|
|
|
.Fl r
|
|
|
|
option is ignored when running in preen mode.
|
2013-07-31 04:51:12 +00:00
|
|
|
.It Fl S
|
|
|
|
Surrender on error.
|
|
|
|
With this flag enabled, a hard error returned on disk i/o will cause
|
|
|
|
.Nm
|
|
|
|
to abort instead of continuing on and possibly tripping over more i/o errors.
|
1998-12-03 02:27:35 +00:00
|
|
|
.It Fl y
|
2001-07-15 07:53:42 +00:00
|
|
|
Assume a yes response to all questions asked by
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm ;
|
1998-12-03 02:27:35 +00:00
|
|
|
this should be used with great caution as this is a free license
|
|
|
|
to continue after essentially unlimited trouble has been encountered.
|
2013-04-29 20:13:09 +00:00
|
|
|
.It Fl Z
|
|
|
|
Similar to
|
|
|
|
.Fl E ,
|
|
|
|
but overwrites unused blocks with zeroes.
|
|
|
|
If both
|
|
|
|
.Fl E
|
|
|
|
and
|
|
|
|
.Fl Z
|
|
|
|
are specified, blocks are first zeroed and then erased.
|
This update eliminates a kernel stack disclosure bug in UFS/FFS
directory entries that is caused by uninitialized directory entry
padding written to the disk. It can be viewed by any user with read
access to that directory. Up to 3 bytes of kernel stack are disclosed
per file entry, depending on the the amount of padding the kernel
needs to pad out the entry to a 32 bit boundry. The offset in the
kernel stack that is disclosed is a function of the filename size.
Furthermore, if the user can create files in a directory, this 3
byte window can be expanded 3 bytes at a time to a 254 byte window
with 75% of the data in that window exposed. The additional exposure
is done by removing the entry, creating a new entry with a 4-byte
longer name, extracting 3 more bytes by reading the directory, and
repeating until a 252 byte name is created.
This exploit works in part because the area of the kernel stack
that is being disclosed is in an area that typically doesn't change
that often (perhaps a few times a second on a lightly loaded system),
and these file creates and unlinks themselves don't overwrite the
area of kernel stack being disclosed.
It appears that this bug originated with the creation of the Fast
File System in 4.1b-BSD (Circa 1982, more than 36 years ago!), and
is likely present in every Unix or Unix-like system that uses
UFS/FFS. Amazingly, nobody noticed until now.
This update also adds the -z flag to fsck_ffs to have it scrub
the leaked information in the name padding of existing directories.
It only needs to be run once on each UFS/FFS filesystem after a
patched kernel is installed and running.
Submitted by: David G. Lawrence <dg@dglawrence.com>
Reviewed by: kib
MFC after: 1 week
2019-05-03 21:54:14 +00:00
|
|
|
.It Fl z
|
|
|
|
Clear unused directory space.
|
|
|
|
The cleared space includes deleted file names and name padding.
|
1994-05-26 06:35:07 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Inconsistencies checked are as follows:
|
2000-12-18 15:16:24 +00:00
|
|
|
.Pp
|
|
|
|
.Bl -enum -compact
|
1994-05-26 06:35:07 +00:00
|
|
|
.It
|
|
|
|
Blocks claimed by more than one inode or the free map.
|
|
|
|
.It
|
2002-08-21 18:11:48 +00:00
|
|
|
Blocks claimed by an inode outside the range of the file system.
|
1994-05-26 06:35:07 +00:00
|
|
|
.It
|
|
|
|
Incorrect link counts.
|
|
|
|
.It
|
|
|
|
Size checks:
|
2000-12-18 15:16:24 +00:00
|
|
|
.Bl -item -offset indent -compact
|
2001-07-15 07:53:42 +00:00
|
|
|
.It
|
1994-05-26 06:35:07 +00:00
|
|
|
Directory size not a multiple of DIRBLKSIZ.
|
|
|
|
.It
|
|
|
|
Partially truncated file.
|
|
|
|
.El
|
|
|
|
.It
|
|
|
|
Bad inode format.
|
|
|
|
.It
|
|
|
|
Blocks not accounted for anywhere.
|
|
|
|
.It
|
|
|
|
Directory checks:
|
2000-12-18 15:16:24 +00:00
|
|
|
.Bl -item -offset indent -compact
|
2001-07-15 07:53:42 +00:00
|
|
|
.It
|
1994-05-26 06:35:07 +00:00
|
|
|
File pointing to unallocated inode.
|
|
|
|
.It
|
|
|
|
Inode number out of range.
|
|
|
|
.It
|
1998-12-03 02:27:35 +00:00
|
|
|
Directories with unallocated blocks (holes).
|
1996-10-08 14:54:53 +00:00
|
|
|
.It
|
1994-05-26 06:35:07 +00:00
|
|
|
Dot or dot-dot not the first two entries of a directory
|
|
|
|
or having the wrong inode number.
|
|
|
|
.El
|
|
|
|
.It
|
|
|
|
Super Block checks:
|
2000-12-18 15:16:24 +00:00
|
|
|
.Bl -item -offset indent -compact
|
2001-07-15 07:53:42 +00:00
|
|
|
.It
|
2002-08-21 18:11:48 +00:00
|
|
|
More blocks for inodes than there are in the file system.
|
1994-05-26 06:35:07 +00:00
|
|
|
.It
|
|
|
|
Bad free block map format.
|
|
|
|
.It
|
|
|
|
Total free block and/or free inode count incorrect.
|
|
|
|
.El
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Orphaned files and directories (allocated but unreferenced) are,
|
|
|
|
with the operator's concurrence, reconnected by
|
2001-07-15 07:53:42 +00:00
|
|
|
placing them in the
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pa lost+found
|
|
|
|
directory.
|
|
|
|
The name assigned is the inode number.
|
|
|
|
If the
|
|
|
|
.Pa lost+found
|
|
|
|
directory does not exist, it is created.
|
|
|
|
If there is insufficient space its size is increased.
|
2010-07-23 14:35:51 +00:00
|
|
|
.Pp
|
|
|
|
The full foreground
|
|
|
|
.Nm
|
|
|
|
checks for many more problems that may occur after an
|
|
|
|
unrecoverable disk write error.
|
|
|
|
Thus, it is recommended that you perform foreground
|
|
|
|
.Nm
|
|
|
|
on your systems periodically and whenever you encounter
|
|
|
|
unrecoverable disk write errors or file-system\-related panics.
|
1994-05-26 06:35:07 +00:00
|
|
|
.Sh FILES
|
|
|
|
.Bl -tag -width /etc/fstab -compact
|
|
|
|
.It Pa /etc/fstab
|
2002-08-21 18:11:48 +00:00
|
|
|
contains default list of file systems to check.
|
1994-05-26 06:35:07 +00:00
|
|
|
.El
|
2005-01-17 07:44:44 +00:00
|
|
|
.Sh EXIT STATUS
|
2001-12-04 16:17:35 +00:00
|
|
|
.Ex -std
|
2008-09-17 06:56:27 +00:00
|
|
|
.Pp
|
Exit fsck_ffs with non-zero status when file system is not repaired.
When the fsck_ffs program cannot fully repair a file system, it will
output the message PLEASE RERUN FSCK. However, it does not exit with a
non-zero status in this case (contradicting the man page claim that it
"exits with 0 on success, and >0 if an error occurs." The fsck
rc-script (when running "fsck -y") tests the status from fsck (which
passes along the exit status from fsck_ffs) and issues a "stop_boot"
if the status fails. However, this is not effective since fsck_ffs can
return zero even on (some) errors. Effectively, it is left to a later
step in the boot process when the file systems are mounted to detect
the still-unclean file system and stop the boot.
This change modifies fsck_ffs so that when it cannot fully repair the
file system and issues the PLEASE RERUN FSCK message it also exits
with a non-zero status.
While here, the fsck_ffs man page has also been updated to document
the failing exit status codes used by fsck_ffs. Previously, only exit
status 7 was documented. Some of these exit statuses are tested for in
the fsck rc-script, so they are clearly depended upon and deserve
documentation.
Reviewed by: mckusick, vangyzen, jilles (manpages)
MFC after: 1 week
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D13862
2018-01-15 19:25:11 +00:00
|
|
|
Specific non-zero exit status values used are:
|
|
|
|
.Bl -tag -width indent
|
|
|
|
.It 1
|
|
|
|
Usage error (missing or invalid command arguments).
|
|
|
|
.It 2
|
|
|
|
The
|
|
|
|
.Fl p
|
|
|
|
option was used and a
|
|
|
|
.Dv SIGQUIT
|
|
|
|
was received, indicating that the system should be returned to single
|
|
|
|
user mode after the file system check.
|
|
|
|
.It 3
|
|
|
|
The file system superblock cannot be read.
|
|
|
|
This could indicate that the file system device does not exist or is not yet
|
|
|
|
ready.
|
|
|
|
.It 4
|
|
|
|
A mounted file system was modified; the system should be rebooted.
|
|
|
|
.It 5
|
|
|
|
The
|
|
|
|
.Fl B
|
|
|
|
option was used and soft updates are not enabled on the file system.
|
|
|
|
.It 6
|
|
|
|
The
|
|
|
|
.Fl B
|
|
|
|
option was used and the kernel lacks needed support.
|
|
|
|
.It 7
|
|
|
|
The
|
2008-09-17 06:56:27 +00:00
|
|
|
.Fl F
|
Exit fsck_ffs with non-zero status when file system is not repaired.
When the fsck_ffs program cannot fully repair a file system, it will
output the message PLEASE RERUN FSCK. However, it does not exit with a
non-zero status in this case (contradicting the man page claim that it
"exits with 0 on success, and >0 if an error occurs." The fsck
rc-script (when running "fsck -y") tests the status from fsck (which
passes along the exit status from fsck_ffs) and issues a "stop_boot"
if the status fails. However, this is not effective since fsck_ffs can
return zero even on (some) errors. Effectively, it is left to a later
step in the boot process when the file systems are mounted to detect
the still-unclean file system and stop the boot.
This change modifies fsck_ffs so that when it cannot fully repair the
file system and issues the PLEASE RERUN FSCK message it also exits
with a non-zero status.
While here, the fsck_ffs man page has also been updated to document
the failing exit status codes used by fsck_ffs. Previously, only exit
status 7 was documented. Some of these exit statuses are tested for in
the fsck rc-script, so they are clearly depended upon and deserve
documentation.
Reviewed by: mckusick, vangyzen, jilles (manpages)
MFC after: 1 week
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D13862
2018-01-15 19:25:11 +00:00
|
|
|
option was used and the file system is clean.
|
|
|
|
.It 8
|
|
|
|
General error exit.
|
|
|
|
.It 16
|
|
|
|
The file system could not be completely repaired.
|
|
|
|
The file system may be able to be repaired by running
|
2008-09-17 06:56:27 +00:00
|
|
|
.Nm
|
Exit fsck_ffs with non-zero status when file system is not repaired.
When the fsck_ffs program cannot fully repair a file system, it will
output the message PLEASE RERUN FSCK. However, it does not exit with a
non-zero status in this case (contradicting the man page claim that it
"exits with 0 on success, and >0 if an error occurs." The fsck
rc-script (when running "fsck -y") tests the status from fsck (which
passes along the exit status from fsck_ffs) and issues a "stop_boot"
if the status fails. However, this is not effective since fsck_ffs can
return zero even on (some) errors. Effectively, it is left to a later
step in the boot process when the file systems are mounted to detect
the still-unclean file system and stop the boot.
This change modifies fsck_ffs so that when it cannot fully repair the
file system and issues the PLEASE RERUN FSCK message it also exits
with a non-zero status.
While here, the fsck_ffs man page has also been updated to document
the failing exit status codes used by fsck_ffs. Previously, only exit
status 7 was documented. Some of these exit statuses are tested for in
the fsck rc-script, so they are clearly depended upon and deserve
documentation.
Reviewed by: mckusick, vangyzen, jilles (manpages)
MFC after: 1 week
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D13862
2018-01-15 19:25:11 +00:00
|
|
|
on the file system again.
|
|
|
|
.El
|
2005-01-17 07:44:44 +00:00
|
|
|
.Sh DIAGNOSTICS
|
2001-07-15 07:53:42 +00:00
|
|
|
The diagnostics produced by
|
1998-12-03 02:41:11 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
are fully enumerated and explained in Appendix A of
|
|
|
|
.Rs
|
|
|
|
.%T "Fsck \- The UNIX File System Check Program"
|
|
|
|
.Re
|
|
|
|
.Sh SEE ALSO
|
1998-12-03 02:27:35 +00:00
|
|
|
.Xr fs 5 ,
|
1998-12-03 02:41:11 +00:00
|
|
|
.Xr fstab 5 ,
|
2001-02-12 17:50:14 +00:00
|
|
|
.Xr fsck 8 ,
|
1998-12-03 02:41:11 +00:00
|
|
|
.Xr fsdb 8 ,
|
1994-05-26 06:35:07 +00:00
|
|
|
.Xr newfs 8 ,
|
|
|
|
.Xr reboot 8
|
2016-10-05 20:38:49 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
A
|
|
|
|
.Nm fsck
|
|
|
|
utility appeared in
|
|
|
|
.Bx 4.0 .
|
|
|
|
It became
|
|
|
|
.Nm
|
|
|
|
in
|
|
|
|
.Fx 5.0
|
|
|
|
with the introduction of the filesystem independent wrapper as
|
|
|
|
.Nm fsck .
|