1.\" $NetBSD: fsck_lfs.8,v 1.25 2014/07/12 16:11:27 dholland Exp $ 2.\" 3.\" Copyright (c) 1980, 1989, 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)fsck.8 8.3 (Berkeley) 11/29/94 31.\" 32.Dd July 12, 2014 33.Dt FSCK_LFS 8 34.Os 35.Sh NAME 36.Nm fsck_lfs 37.Nd Log-structured File System consistency check and interactive repair 38.Sh SYNOPSIS 39.Nm fsck_lfs 40.Op Fl dfpqU 41.Op Fl b Ar block 42.Op Fl m Ar mode 43.Op Fl y | n 44.Ar filesystem 45.Ar ... 46.Sh DESCRIPTION 47.Nm 48performs interactive filesystem consistency checks and repair for 49each of the filesystems specified on the command line. 50It is normally invoked from 51.Xr fsck 8 . 52.Pp 53The design of LFS takes care that no filesystem inconsistencies can 54happen unless hardware or software failures intervene. 55.Nm 56will report and optionally correct any such inconsistencies. 57.Pp 58For each corrected inconsistency one or more lines will be printed 59identifying the filesystem on which the correction will take place, 60and the nature of the correction. 61After successfully correcting a filesystem, 62.Nm 63will print the number of files on that filesystem, 64the number of used and free blocks, 65and the percentage of fragmentation. 66.Pp 67If sent a 68.Dv QUIT 69signal, 70.Nm 71will finish the filesystem checks, then exit with an abnormal return status. 72.Pp 73Without the 74.Fl p 75option, 76.Nm 77audits and interactively repairs inconsistent conditions for filesystems. 78If the filesystem is inconsistent, the operator is prompted for concurrence 79before each correction is attempted. 80It should be noted that some of the corrective actions will result in 81some loss of data. 82The amount and severity of data lost may be determined from the diagnostic 83output. 84The default action for each consistency correction 85is to wait for the operator to respond 86.Li yes 87or 88.Li no . 89If the operator does not have write permission on the filesystem 90.Nm 91will default to a 92.Fl n 93action. 94.Pp 95The following flags are interpreted by 96.Nm : 97.Bl -tag -width XbXblockXX 98.It Fl b Ar block 99Use 100.Ar block 101as the super block for the filesystem. 102.It Fl d 103Print debugging output. 104.It Fl f 105Force checking of file systems. 106Normally, if a file system is cleanly unmounted, the kernel will 107set a 108.Dq clean flag 109in the file system superblock, and 110.Nm 111will not check the file system. 112This option forces 113.Nm 114to check the file system, regardless of the state of the clean flag. 115.It Fl m Ar mode 116Use 117.Ar mode 118specified in octal as the permission bits to use when creating the 119.Pa lost+found 120directory rather than the default 1700. 121In particular, systems that do not wish to have lost files accessible 122by all users on the system should use a more restrictive 123set of permissions such as 700. 124.It Fl n 125Assume a no response to all questions asked by 126.Nm 127except for 128.Ql CONTINUE? , 129which is assumed to be affirmative; 130do not open the filesystem for writing. 131.It Fl p 132Specify 133.Dq preen 134mode. 135Currently, in this mode 136.Nm 137does nothing. 138.\" rolls forward from the older checkpoint, and performs no other action. 139.It Fl q 140Quiet mode, do not output any messages for clean filesystems. 141.It Fl U 142Resolve user ids to user names. 143.It Fl y 144Assume a yes response to all questions asked by 145.Nm ; 146this should be used with great caution as this is a free license 147to continue after essentially unlimited trouble has been encountered. 148.El 149.Pp 150Inconsistencies checked are as follows: 151.Bl -enum -offset indent -compact 152.It 153Blocks claimed by more than one inode. 154.It 155Blocks claimed by an inode outside the range of the filesystem. 156.It 157Incorrect link counts. 158.It 159Size checks: 160.Bl -item -offset indent -compact 161.It 162Directory size not a multiple of DIRBLKSIZ. 163.It 164Partially truncated file. 165.El 166.It 167Bad inode format. 168.It 169Directory checks: 170.Bl -item -offset indent -compact 171.It 172File pointing to unallocated inode. 173.It 174Inode number out of range. 175.It 176Dot or dot-dot not the first two entries of a directory 177or having the wrong inode number. 178.El 179.It 180Super Block checks: 181.Bl -item -offset indent -compact 182.It 183More blocks for inodes than there are in the filesystem. 184.El 185.It 186Index File checks: 187.Bl -item -offset indent -compact 188.It 189.Dq \&In use 190inodes on free list, or free inodes not on free list. 191.It 192Segment block counts incorrect, or 193.Dq clean 194segments containing live data. 195.El 196.El 197.Pp 198Orphaned files and directories (allocated but unreferenced) are, 199with the operator's concurrence, reconnected by 200placing them in the 201.Pa lost+found 202directory. 203The name assigned is the inode number. 204If the 205.Pa lost+found 206directory does not exist, it is created. 207If there is insufficient space its size is increased. 208.Pp 209Because of inconsistencies between the block device and the buffer cache, 210the raw device should always be used. 211.Sh DIAGNOSTICS 212The diagnostics produced by 213.Nm 214are fully enumerated and explained in Appendix A of 215.Rs 216.%T "Fsck \- The UNIX File System Check Program" 217.Re 218.Sh SEE ALSO 219.Xr fstab 5 , 220.Xr fsck 8 , 221.Xr newfs_lfs 8 , 222.Xr reboot 8 223.Sh HISTORY 224The 225.Nm 226program was first made available in 227.Nx 1.4 . 228.Sh AUTHORS 229Most of the 230.Nm 231program was taken from 232.Xr fsck_ffs 8 ; 233what was not was written by 234.An Konrad Schroder Aq Mt perseant@NetBSD.org . 235