| FSCK_FFS(8) | System Manager's Manual | FSCK_FFS(8) | 
fsck_ffs —
| fsck_ffs | [ -adFfPpqUXz] [-Bbyteorder] [-bblock] [-clevel] [-mmode] [-xsnap-backup] [-y|-n] filesystem ... | 
fsck_ffs performs interactive file system consistency
  checks and repair for each of the file systems specified on the command line.
  It is normally invoked from
  fsck(8).
The kernel takes care that only a restricted class of innocuous file system inconsistencies can happen unless hardware or software failures intervene. These are limited to the following:
These are the only inconsistencies that
    fsck_ffs in “preen” mode (with the
    -p option) will correct; if it encounters other
    inconsistencies, it exits with an abnormal return status. For each corrected
    inconsistency one or more lines will be printed identifying the file system
    on which the correction will take place, and the nature of the correction.
    After successfully correcting a file system,
    fsck_ffs will print the number of files on that file
    system, the number of used and free blocks, and the percentage of
    fragmentation.
If sent a QUIT signal,
    fsck_ffs will finish the file system checks, then
    exit with an abnormal return status.
If fsck_ffs receives a
    SIGINFO signal (see the status
    argument for stty(1)), a line
    will be written to the standard error output indicating the name of the
    device currently being checked, the current phase number and phase-specific
    progress information.
Without the -p option,
    fsck_ffs audits and interactively repairs
    inconsistent conditions for file systems. If the file system is inconsistent
    the operator is prompted for concurrence before each correction is
    attempted. It should be noted that some of the corrective actions which are
    not correctable under the -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
    yes or no. If the operator
    does not have write permission on the file system
    fsck_ffs will default to a
    -n action.
fsck_ffs has more consistency checks than
    its predecessors check, dcheck,
    fcheck, and icheck combined.
The following flags are interpreted by
    fsck_ffs.
-a-B
    byteorderfsck_ffs is interrupted
      while swapping the metadata byte order, the file system cannot be
      recovered. fsck_ffs will print a message in
      interactive mode if the file system is not in host byte order.-b
    block-b option of the
      scan_ffs(8) utility can
      also be used to find the offset of other super block backups in a file
      system.-c
    level-O
          0 option to
          newfs(8).-O
          1 option to
          newfs(8).Note that FFSv2 file systems are always level 4.
In interactive mode, fsck_ffs will
        list the conversion to be made and ask whether the conversion should be
        done. If a negative answer is given, no further operations are done on
        the file system. In preen mode, the conversion is listed and done if
        possible without user interaction. Conversion in preen mode is best used
        when all the file systems are being converted at once.
The output of dumpfs(8) can be examined to determine the format of the file system (“format” in the second line) and the file system level (“fslevel” in the sixth line).
-d-F-ffsck_ffs will not check
      the file system. This option forces fsck_ffs to
      check the file system, regardless of the state of the clean flag.-m
    mode-nfsck_ffs except for
      ‘CONTINUE?’, which is assumed to be
      affirmative; do not open the file system for writing.-P-p is specified, in which case only one meter for
      overall progress is displayed. Progress meters are disabled if the
      -d option is specified.-p-q-U-X-x but uses a file system internal
      snapshot on the file system to be checked.-x
    snap-backup-n. See
      fss(4) for more details. The
      point is to check an internally-consistent version of the filesystem to
      find out if it is damaged; on failure one should unmount the filesystem
      and repair it.-yfsck_ffs; this should be used with great caution
      as this is a free license to continue after essentially unlimited trouble
      has been encountered.-zInconsistencies checked are as follows:
Orphaned files and directories (allocated but unreferenced) are, with the operator's concurrence, reconnected by placing them in the lost+found directory. The name assigned is the inode number. If the lost+found directory does not exist, it is created. If there is insufficient space its size is increased.
Because of inconsistencies between the block device and the buffer cache, the raw device should always be used.
fsck_ffs are fully
  enumerated and explained in Appendix A of
  Fsck - The UNIX File System Check
  Program.
fsck utility appeared in
  4.0BSD. It was renamed to
  fsck_ffs in NetBSD 1.3 with
  the introduction of a filesystem independent wrapper as
  fsck.
| May 4, 2018 | NetBSD 9.4 |