FSCK_LFS(8)

NAME
fsck_lfs - Log-structured File System consistency check and interactive repair

SYNOPSIS
fsck_lfs [-b block#] [-d] [-p] [-y] [-n] filesystem ...

DESCRIPTION
Fsck_lfs performs interactive filesystem consistency checks and repair for each of the filesystems specified on the command line. It is normally invoked from fsck(8).

The design of LFS takes care that no filesystem 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 filesystem on which the correction will take place, and the nature of the correction. After successfully correcting a filesystem, fsck_lfs will print the number of files on that filesystem, the number of used and free blocks, and the percentage of fragmentation.

If sent a QUIT signal, fsck_lfs will finish the filesystem checks, then exit with an abnormal return status.

Without the -p option, fsck_lfs audits and interactively repairs inconsistent conditions for filesystems. If the filesystem 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 filesystem fsck_lfs will default to a -n action.

The following flags are interpreted by fsck_lfs.

-b  Use the block specified immediately after the flag as the super block for the filesystem. Block 32 is usually an alternative super block.

-d  Print debugging output.

-n  Assume a no response to all questions asked by fsck_lfs except for ‘CONTINUE?’, which is assumed to be affirmative; do not open the filesystem for writing.

-p  Specify ``preen'' mode. In fsck_lfs this currently does nothing, though in the future it will perform a roll-forward.

-y  Assume a yes response to all questions asked by fsck_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:
1.  Blocks claimed by more than one inode or the free map.
2.  Blocks claimed by an inode outside the range of the filesystem.
3.  Incorrect link counts.
4.  Size checks:
    Directory size not a multiple of DIRBLKSIZ.
    Partially truncated file.
5.  Bad inode format.
6.  Blocks not accounted for anywhere.
7.  Directory checks:
    File pointing to unallocated inode.
    Inode number out of range.
    Dot or dot-dot not the first two entries of a directory or having the wrong inode number.
8.  Super Block checks:
    More blocks for inodes than there are in the filesystem.
    Bad free block map format.
    Total free block and/or free inode count incorrect.

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.

DIAGNOSTICS
The diagnostics produced by fsck_lfs are fully enumerated and explained in Appendix A of Fsck - The UNIX File System Check Program.

BUGS
Fsck_lfs cannot currently make any repairs, even a roll-forward.

HISTORY
The fsck_lfs program was first made available in NetBSD 1.4.

AUTHOR
Most of the fsck_lfs program was taken from fsck_ffs(8); what was not was written by Konrad Schroder <perseant@hhhh.org>.

SEE ALSO
fstab(5), newlfs(8), reboot(8), fsck(8)