| FSCK_LFS(8) | System Manager's Manual | FSCK_LFS(8) |
fsck_lfs —
Log-structured File System consistency check and
interactive repair
fsck_lfs |
[-adfpqU] [-b
block] [-i
idaddr] [-m
mode] [-y |
-n] filesystem
... |
fsck_lfs 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 design of LFS takes care that no file system inconsistencies
can happen unless hardware or software failures intervene.
fsck_lfs will report and optionally correct any such
inconsistencies.
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_lfs 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_lfs will finish the file system checks, then
exit with an abnormal return status.
Without the -p option,
fsck_lfs 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 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_lfs will default to a
-n action.
The following flags are interpreted by
fsck_lfs:
-aavail
accounting.-b
block-d-ffsck_lfs will not check the
file system. This option forces fsck_lfs to check
the file system, regardless of the state of the clean flag.-i
idaddr-m
mode-nfsck_lfs except for
‘CONTINUE?’, which is assumed to be
affirmative; do not open the file system for writing.-pfsck_lfs does nothing.-q-U-yfsck_lfs; this should be used with great caution
as this is a free license to continue after essentially unlimited trouble
has been encountered.Inconsistencies 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.
The diagnostics produced by fsck_lfs are
fully enumerated and explained in Appendix A of
Fsck - The UNIX File System Check
Program.
The fsck_lfs program was first made
available in NetBSD 1.4.
Most of the fsck_lfs program was taken
from fsck_ffs(8); what was
not was written by Konrad Schroder
<perseant@NetBSD.org>.
| September 14, 2025 | NetBSD 11.99 |