History log of /freebsd-current/sbin/fsck_ffs/fsck_ffs.8
Revision Date Author Comments
# 1a720cbe 15-May-2024 Alexander Ziaee <concussious@runbox.com>

man filesystems: fix xrefs after move to section 4

Reviewed by: des, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1077


# 51e16cb8 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

sbin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 115459be 17-Nov-2023 Gordon Bergling <gbe@FreeBSD.org>

SEE ALSO section improvements for tuning(7), tunefs(8) and fsck_ffs(8)

cross-reference ffs(7) in fsck_ffs(8)
cross-reference ffs(7) and tuning(7) in tunefs(8)
cross-reference ffs(7) in tuning(7)

PR: 263433
Reviewed by: bcr
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D42631


# b2c76c41 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line nroff pattern

Remove /^\.\\"\s*\$FreeBSD\$$\n/


# 47d3e2f8 07-Aug-2019 Kirk McKusick <mckusick@FreeBSD.org>

Correct the location of the first backup superblock in fsck_ffs.8.
Make a note in the newfs.8 manual page to update the first backup
superblock location when changing the default fragment size for
the filesystem.

Reported by: O. Hartmann


# 0061238f 03-May-2019 Kirk McKusick <mckusick@FreeBSD.org>

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


# 469759f8 15-Jan-2018 David Bright <dab@FreeBSD.org>

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


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# db83b143 14-Feb-2017 Renato Botelho <garga@FreeBSD.org>

* Add missing parameters to usage()
* Add missing parameters to manpage synopsis
* Add missing description of -d flag
* Sort flags descriptions

Reviewed by: allanjude, kib
Approved by: allanjude
MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)
Differential Revision: https://reviews.freebsd.org/D9152


# ac52fd7f 05-Oct-2016 Sevan Janiyan <sevan@FreeBSD.org>

Add history section to fsck_ffs(8)
Move sentence to a new line as advised by igor.

PR: 212474
Approved by: bcr (mentor)
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D8104


# 7703a6ff 29-Dec-2013 Scott Long <scottl@FreeBSD.org>

Add the -R option to allow fsck_ffs to restart itself when too many critical
errors have been detected in a particular run.

Clean up the global state variables so that a restart can happen correctly.

Separate the global variables in fsck_ffs and fsdb to their own file. This
fixes header sharing with fscd.

Correctly initialize, static-ize, and remove global variables as needed in
dir.c. This fixes a problem with lost+found directories that was causing
a segfault.

Correctly initialize, static-ize, and remove global variables as needed in
suj.c.

Initialize the suj globals before allocating the disk object, not after.
Also ensure that 'preen' mode doesn't conflict with 'restart' mode

Submitted by: scottl, max
Reviewed by: max, mckusick (earlier version)
Obtained from: Netflix
MFC after: 3 days


# 80d5f59d 30-Jul-2013 Scott Long <scottl@FreeBSD.org>

Document the -S flag to fsck_ffs

Obtained from: Netflix


# 2b5373de 29-Apr-2013 Dag-Erling Smørgrav <des@FreeBSD.org>

Add a -Z option which zeroes unused blocks. It can be combined with -E,
in which case unused blocks are first zeroed and then erased.

Reviewed by: mckusick
MFC after: 3 weeks


# 92858a92 09-Feb-2012 Edward Tomasz Napierala <trasz@FreeBSD.org>

Be more helpful about alternate superblocks.


# 8d3dfc26 29-Apr-2011 Dag-Erling Smørgrav <des@FreeBSD.org>

Add an -E option to mirror newfs's. The idea is that if you have a system
that was built before ffs grew support for TRIM, your filesystem will have
plenty of free blocks that the flash chip doesn't know are free, so it
can't take advantage of them for wear leveling. Once you've upgraded your
kernel, you enable TRIM on the filesystem (tunefs -t enable), then run
fsck_ffs -E on it before mounting it.

I tested this patch by half-filling an mdconfig'ed filesystem image,
running fsck_ffs -E on it, then verifying that the contents were not
damaged by comparing them to a pristine copy using rsync's checksum
functionality. There is no reliable way to test it on real hardware.

Many thanks to mckusick@, who provided the tricky parts of this patch and
reviewed the final version.

Reviewed by: mckusick@
MFC after: 3 weeks


# dc069d64 26-Apr-2011 Dag-Erling Smørgrav <des@FreeBSD.org>

Fix boo-boo in previous commit.

MFC after: 3 weeks


# af18c835 26-Apr-2011 Dag-Erling Smørgrav <des@FreeBSD.org>

Alphabetize the options. No date bump since no actual change to the text.

MFC after: 3 weeks


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# c2025a76 16-Aug-2010 Joel Dahl <joel@FreeBSD.org>

Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while
translating these manual pages. Minor corrections by me.

Submitted by: Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>


# f6ac2391 06-Aug-2010 Joel Dahl <joel@FreeBSD.org>

Fix typos and spelling mistakes.


# 5ee561ee 23-Jul-2010 Kirk McKusick <mckusick@FreeBSD.org>

Note that foreground fsck should be run after a filesystem related panic.

Suggested by: Mikhail Teterin (mi@)
MFC after: 1 week


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 910b491e 03-Feb-2009 Kirk McKusick <mckusick@FreeBSD.org>

Update the actions previously attempted by the -D option to make them
robust. With these changes fsck is now able to detect and reliably
rebuild corrupted cylinder group maps. The -D option is no longer
necessary as it has been replaced by a prompt asking whether the
corrupted cylinder group should be rebuilt and doing so when requested.
These actions are only offered and taken when running fsck in manual
mode. Corrupted cylinder groups found during preen mode cause the fsck
to fail.

Add the -r option to free up excess unused inodes. Decreasing the
number of preallocated inodes reduces the running time of future
runs of fsck and frees up space that can allocated to files. The -r
option is ignored when running in preen mode.

Reviewed by: Xin LI <delphij@>
Sponsored by: Rsync.net


# 111a5220 30-Jan-2009 David E. O'Brien <obrien@FreeBSD.org>

Add the '-C' "check clean" flag. If the FS is marked clean, skip file
system checking. However, if the file system is not clean, perform a
full fsck.

Reviewed by: delphij
Obtained from: Juniper Networks


# 7f94ca72 20-Jan-2009 Xin LI <delphij@FreeBSD.org>

Rename option 'C' to 'D' (damaged) in order to avoid a conflict with upcoming
Juniper 'C' (clean) flag.

Requested by: obrien
MFC after: 1 week


# 07580acc 11-Jan-2009 Xin LI <delphij@FreeBSD.org>

Fix typo.

Submitted by: Ben Kaduk <minimarmot gmail com>
MFC after: 3 days


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 6f5c4436 17-Sep-2008 Remko Lodder <remko@FreeBSD.org>

Document the -F 's return statement.
If the application returns succesfully
the return code is 7 (which means the
filesystem is clean).

PR: 127432
Submitted by: edwin
MFC after: 3 days


# 14320f1e 10-Apr-2008 Xin LI <delphij@FreeBSD.org>

Add a new flag, '-C' which enables a special mode that is intended for
catastrophic recovery. Currently, this mode only validates whether a
cylindergroup has good signature data, and prompts the user to decide
whether to clear it as a whole.

This mode is useful when there is data damage on a disk and you are
working on copy of the original disk, as fsck_ffs(8) tends to abnormally
exit in such case, as a last resort to recover data from the disk.


# d80980c8 20-Sep-2005 Xin LI <delphij@FreeBSD.org>

Mention the default location of alternative super block on a
UFS2 file system, in fsck_ffs(8).

Submitted by: KOMATSU Shinichiro <koma2 at lovepeers ! org>
PR: docs/86362
MFC After: 3 days


# 8d646af5 10-Feb-2005 Ruslan Ermilov <ru@FreeBSD.org>

Sync program's usage() with manpage's SYNOPSIS.


# a866e170 17-Jan-2005 Ruslan Ermilov <ru@FreeBSD.org>

Added the EXIT STATUS section where appropriate.


# 9806e231 02-Jul-2004 Ruslan Ermilov <ru@FreeBSD.org>

Mechanically kill hard sentence breaks.


# 4c723140 09-Apr-2004 Mark Murray <markm@FreeBSD.org>

Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp


# 8d5d039f 12-Dec-2002 Ruslan Ermilov <ru@FreeBSD.org>

Uniformly refer to a file system as "file system".

Approved by: re


# 5af4935a 26-Aug-2002 Tom Rhodes <trhodes@FreeBSD.org>

Fix some 'SYNOPSIS' and 'usage' messages.


# ce66ddb7 21-Aug-2002 Tom Rhodes <trhodes@FreeBSD.org>

s/filesystem/file system/g as discussed on -developers


# 830a9d77 04-Dec-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: section 1 and 8 manpages document their exit
codes under the DIAGNOSTICS section, not RETURN VALUES, which
is for section 2, 3, and 9 manpages.


# 17489e76 03-Dec-2001 David E. O'Brien <obrien@FreeBSD.org>

Actually I haven't enumerated the return values yet (thats why I hadn't
committed it yet). So vague'ize the wording a little bit to make up
for it.


# 2d68bf45 03-Dec-2001 David E. O'Brien <obrien@FreeBSD.org>

Default to WARNS=2.
Binary builds that cannot handle this must explicitly set WARNS=0.

Reviewed by: mike


# 7ebcc426 15-Jul-2001 Dima Dorfman <dd@FreeBSD.org>

Remove whitespace at EOL.


# f8923543 27-Apr-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police:
document date updated, removed history info from the .Os call, cosmetics.


# 15fca934 24-Apr-2001 Kirk McKusick <mckusick@FreeBSD.org>

Add support for the -F flag which determines whether a specified
filesystem needs foreground checking (usually at boot time) or
can defer to background checking (after the system is up and running).
See the manual page, fsck_ffs(8), for details on the -F and -B options.
These options are primarily intended for use by the fsck front end.

All output is directed to stdout so that the output is coherent
when redirected to a file or a pipe. Unify the code with the fsck
front end that allows either a device or a mount point to be
specified as the argument to be checked.


# 7df8ffa1 16-Apr-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: prepare for mdocNG.


# 8684bec0 12-Feb-2001 Nik Clayton <nik@FreeBSD.org>

Use ".Nm fsck_ffs", so that this turns up in whatis(1), and others.
Add .Xr to fsck.

Prompted by: JM Jr's script that shows binaries with no whatis info
Reviewed by: adrian


# fefd74d8 03-Jan-2001 Ian Dowse <iedowse@FreeBSD.org>

Document fsck_ffs's new SIGINFO handler.

Reviewed by: sheldonh


# 1252c1bb 18-Dec-2000 Ruslan Ermilov <ru@FreeBSD.org>

Prepare for mdoc(7)NG.


# 7c7fb079 20-Nov-2000 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: use the new features of the Nm macro.


# 7f3dea24 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 6b100474 02-Dec-1998 Julian Elischer <julian@FreeBSD.org>

Cosmetic and documentation changes brought from earlier FreeBSD versions.
(e.g. RCS Id:)


# d33e92f9 02-Dec-1998 Julian Elischer <julian@FreeBSD.org>

Reviewed by: Don Lewis <Don.Lewis@tsc.tdk.com>
Submitted by: Kirk McKusick <mckusick@McKusick.COM>
Obtained from: Mckusick, BSDI and a host of others

This exactly matches Kirks sources imported under the
Tag MCKUSICK2. These are as supplied by kirk with one small
change needed to compile under freeBSD.

Some FreeBSD patches will be added back, though many have been
added to Kirk's sources already.


# 2d34272b 15-Jun-1998 Philippe Charnier <charnier@FreeBSD.org>

Correct use of .Nm. Add rcsid. Remove unused #includes. Use err(3).


# d97b1da1 12-Mar-1997 Bruce Evans <bde@FreeBSD.org>

Restored lost reference to fsdb(8).

Fixed weird quoting of $Id$.


# 780a5c1e 10-Mar-1997 Peter Wemm <peter@FreeBSD.org>

Merge from Lite2. Note that Lite2 has it's own filesystem clean check
skipping code that overrides ours sooner. One should be eliminated,
but for now it works.


# c0ec1f37 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# af202156 12-Jan-1997 Wolfram Schneider <wosch@FreeBSD.org>

Sort cross references.


# 47ceb636 08-Oct-1996 Guido van Rooij <guido@FreeBSD.org>

Fix the case where fsck would not see sparse directories and the kernel would
panic. If such a thing is fixed fsck needs a rerun (and bugs the user to do
so).

Reviewed by: Kirk McKusick


# 097d42f4 05-Feb-1996 Mike Pritchard <mpp@FreeBSD.org>

Correct some man page cross references and some file
locations.


# 64988eb3 16-Mar-1995 Poul-Henning Kamp <phk@FreeBSD.org>

Remove reference to fsdb(8). We don't have it.


# 41cee58c 20-Aug-1994 David Greenman <dg@FreeBSD.org>

Added filesystem clean bit support. This only affects fsck during a
preen (-p), and in that case the filesystem is skipped if it is clean.
A new flag "-f" for 'force' has been added which basically gives back
the old behavior of checking all the filesystems all the time. This
very closely models the behavior of SunOS and Ultrix.


# 8fae3551 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite sbin Sources

Note: XNSrouted and routed NOT imported here, they shall be imported with
usr.sbin.