1*0736ba10Sdholland.\" $NetBSD: fsck_lfs.8,v 1.25 2014/07/12 16:11:27 dholland Exp $ 2369e9cadSperseant.\" 3369e9cadSperseant.\" Copyright (c) 1980, 1989, 1991, 1993 4369e9cadSperseant.\" The Regents of the University of California. All rights reserved. 5369e9cadSperseant.\" 6369e9cadSperseant.\" Redistribution and use in source and binary forms, with or without 7369e9cadSperseant.\" modification, are permitted provided that the following conditions 8369e9cadSperseant.\" are met: 9369e9cadSperseant.\" 1. Redistributions of source code must retain the above copyright 10369e9cadSperseant.\" notice, this list of conditions and the following disclaimer. 11369e9cadSperseant.\" 2. Redistributions in binary form must reproduce the above copyright 12369e9cadSperseant.\" notice, this list of conditions and the following disclaimer in the 13369e9cadSperseant.\" documentation and/or other materials provided with the distribution. 14276d62f6Sagc.\" 3. Neither the name of the University nor the names of its contributors 15369e9cadSperseant.\" may be used to endorse or promote products derived from this software 16369e9cadSperseant.\" without specific prior written permission. 17369e9cadSperseant.\" 18369e9cadSperseant.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19369e9cadSperseant.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20369e9cadSperseant.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21369e9cadSperseant.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22369e9cadSperseant.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23369e9cadSperseant.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24369e9cadSperseant.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25369e9cadSperseant.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26369e9cadSperseant.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27369e9cadSperseant.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28369e9cadSperseant.\" SUCH DAMAGE. 29369e9cadSperseant.\" 30369e9cadSperseant.\" @(#)fsck.8 8.3 (Berkeley) 11/29/94 31369e9cadSperseant.\" 32*0736ba10Sdholland.Dd July 12, 2014 33369e9cadSperseant.Dt FSCK_LFS 8 3473f545bbSwiz.Os 35369e9cadSperseant.Sh NAME 36369e9cadSperseant.Nm fsck_lfs 37d5c144cfSperseant.Nd Log-structured File System consistency check and interactive repair 38369e9cadSperseant.Sh SYNOPSIS 39369e9cadSperseant.Nm fsck_lfs 4059334248Schristos.Op Fl dfpqU 41e770b579Swiz.Op Fl b Ar block 42e770b579Swiz.Op Fl m Ar mode 4368db7998Sperseant.Op Fl y | n 44369e9cadSperseant.Ar filesystem 45369e9cadSperseant.Ar ... 46369e9cadSperseant.Sh DESCRIPTION 47279552d3Slukem.Nm 48b4508f65Swizperforms interactive filesystem consistency checks and repair for 49b4508f65Swizeach of the filesystems specified on the command line. 502fb4b1dbSwizIt is normally invoked from 51369e9cadSperseant.Xr fsck 8 . 52369e9cadSperseant.Pp 53369e9cadSperseantThe design of LFS takes care that no filesystem inconsistencies can 54369e9cadSperseanthappen unless hardware or software failures intervene. 55279552d3Slukem.Nm 56369e9cadSperseantwill report and optionally correct any such inconsistencies. 57369e9cadSperseant.Pp 58369e9cadSperseantFor each corrected inconsistency one or more lines will be printed 59369e9cadSperseantidentifying the filesystem on which the correction will take place, 602fb4b1dbSwizand the nature of the correction. 612fb4b1dbSwizAfter successfully correcting a filesystem, 62279552d3Slukem.Nm 63369e9cadSperseantwill print the number of files on that filesystem, 64369e9cadSperseantthe number of used and free blocks, 65369e9cadSperseantand the percentage of fragmentation. 66369e9cadSperseant.Pp 67369e9cadSperseantIf sent a 68369e9cadSperseant.Dv QUIT 69369e9cadSperseantsignal, 70279552d3Slukem.Nm 71369e9cadSperseantwill finish the filesystem checks, then exit with an abnormal return status. 72369e9cadSperseant.Pp 73369e9cadSperseantWithout the 74369e9cadSperseant.Fl p 75369e9cadSperseantoption, 76279552d3Slukem.Nm 77369e9cadSperseantaudits and interactively repairs inconsistent conditions for filesystems. 78b4508f65SwizIf the filesystem is inconsistent, the operator is prompted for concurrence 79369e9cadSperseantbefore each correction is attempted. 80369e9cadSperseantIt should be noted that some of the corrective actions will result in 81369e9cadSperseantsome loss of data. 82369e9cadSperseantThe amount and severity of data lost may be determined from the diagnostic 83369e9cadSperseantoutput. 84369e9cadSperseantThe default action for each consistency correction 85369e9cadSperseantis to wait for the operator to respond 86369e9cadSperseant.Li yes 87369e9cadSperseantor 88369e9cadSperseant.Li no . 89369e9cadSperseantIf the operator does not have write permission on the filesystem 90279552d3Slukem.Nm 91369e9cadSperseantwill default to a 92369e9cadSperseant.Fl n 93369e9cadSperseantaction. 94369e9cadSperseant.Pp 95369e9cadSperseantThe following flags are interpreted by 96b4508f65Swiz.Nm : 9721a2722fSwiz.Bl -tag -width XbXblockXX 98e770b579Swiz.It Fl b Ar block 99e770b579SwizUse 100e770b579Swiz.Ar block 101e770b579Swizas the super block for the filesystem. 102369e9cadSperseant.It Fl d 103369e9cadSperseantPrint debugging output. 10468db7998Sperseant.It Fl f 105b4508f65SwizForce checking of file systems. 106b4508f65SwizNormally, if a file system is cleanly unmounted, the kernel will 107b4508f65Swizset a 10868db7998Sperseant.Dq clean flag 10968db7998Sperseantin the file system superblock, and 11068db7998Sperseant.Nm 111b4508f65Swizwill not check the file system. 112b4508f65SwizThis option forces 11368db7998Sperseant.Nm 11468db7998Sperseantto check the file system, regardless of the state of the clean flag. 115e770b579Swiz.It Fl m Ar mode 116e770b579SwizUse 117e770b579Swiz.Ar mode 118e770b579Swizspecified in octal as the permission bits to use when creating the 11905d7d5d4Swiz.Pa lost+found 12005d7d5d4Swizdirectory rather than the default 1700. 12105d7d5d4SwizIn particular, systems that do not wish to have lost files accessible 12205d7d5d4Swizby all users on the system should use a more restrictive 12305d7d5d4Swizset of permissions such as 700. 124369e9cadSperseant.It Fl n 125369e9cadSperseantAssume a no response to all questions asked by 126279552d3Slukem.Nm 127369e9cadSperseantexcept for 128369e9cadSperseant.Ql CONTINUE? , 129369e9cadSperseantwhich is assumed to be affirmative; 130369e9cadSperseantdo not open the filesystem for writing. 131369e9cadSperseant.It Fl p 132b4508f65SwizSpecify 133b4508f65Swiz.Dq preen 134b4508f65Swizmode. 1352fb4b1dbSwizCurrently, in this mode 136279552d3Slukem.Nm 137*0736ba10Sdhollanddoes nothing. 138*0736ba10Sdholland.\" rolls forward from the older checkpoint, and performs no other action. 13968db7998Sperseant.It Fl q 14068db7998SperseantQuiet mode, do not output any messages for clean filesystems. 14159334248Schristos.It Fl U 14259334248SchristosResolve user ids to user names. 143369e9cadSperseant.It Fl y 144369e9cadSperseantAssume a yes response to all questions asked by 145990562bfSwiz.Nm ; 146369e9cadSperseantthis should be used with great caution as this is a free license 147369e9cadSperseantto continue after essentially unlimited trouble has been encountered. 148369e9cadSperseant.El 149369e9cadSperseant.Pp 150369e9cadSperseantInconsistencies checked are as follows: 151d7eb1430Sjoerg.Bl -enum -offset indent -compact 152369e9cadSperseant.It 153e6c70652SperseantBlocks claimed by more than one inode. 154369e9cadSperseant.It 155369e9cadSperseantBlocks claimed by an inode outside the range of the filesystem. 156369e9cadSperseant.It 157369e9cadSperseantIncorrect link counts. 158369e9cadSperseant.It 159369e9cadSperseantSize checks: 1608bd7cb6aSross.Bl -item -offset indent -compact 161369e9cadSperseant.It 162369e9cadSperseantDirectory size not a multiple of DIRBLKSIZ. 163369e9cadSperseant.It 164369e9cadSperseantPartially truncated file. 165369e9cadSperseant.El 166369e9cadSperseant.It 167369e9cadSperseantBad inode format. 168369e9cadSperseant.It 169369e9cadSperseantDirectory checks: 1708bd7cb6aSross.Bl -item -offset indent -compact 171369e9cadSperseant.It 172369e9cadSperseantFile pointing to unallocated inode. 173369e9cadSperseant.It 174369e9cadSperseantInode number out of range. 175369e9cadSperseant.It 176369e9cadSperseantDot or dot-dot not the first two entries of a directory 177369e9cadSperseantor having the wrong inode number. 178369e9cadSperseant.El 179369e9cadSperseant.It 180369e9cadSperseantSuper Block checks: 1818bd7cb6aSross.Bl -item -offset indent -compact 182369e9cadSperseant.It 183369e9cadSperseantMore blocks for inodes than there are in the filesystem. 184ba10361aSperseant.El 185ba10361aSperseant.It 186ba10361aSperseantIndex File checks: 187ba10361aSperseant.Bl -item -offset indent -compact 188ba10361aSperseant.It 18921a2722fSwiz.Dq \&In use 190b4508f65Swizinodes on free list, or free inodes not on free list. 191369e9cadSperseant.It 192b4508f65SwizSegment block counts incorrect, or 193b4508f65Swiz.Dq clean 194b4508f65Swizsegments containing live data. 195369e9cadSperseant.El 196369e9cadSperseant.El 197369e9cadSperseant.Pp 198369e9cadSperseantOrphaned files and directories (allocated but unreferenced) are, 199369e9cadSperseantwith the operator's concurrence, reconnected by 200369e9cadSperseantplacing them in the 201369e9cadSperseant.Pa lost+found 202369e9cadSperseantdirectory. 203369e9cadSperseantThe name assigned is the inode number. 204369e9cadSperseantIf the 205369e9cadSperseant.Pa lost+found 206369e9cadSperseantdirectory does not exist, it is created. 207369e9cadSperseantIf there is insufficient space its size is increased. 208369e9cadSperseant.Pp 209369e9cadSperseantBecause of inconsistencies between the block device and the buffer cache, 210369e9cadSperseantthe raw device should always be used. 211369e9cadSperseant.Sh DIAGNOSTICS 212369e9cadSperseantThe diagnostics produced by 213279552d3Slukem.Nm 214369e9cadSperseantare fully enumerated and explained in Appendix A of 215369e9cadSperseant.Rs 216369e9cadSperseant.%T "Fsck \- The UNIX File System Check Program" 217369e9cadSperseant.Re 218875bfce8Swiz.Sh SEE ALSO 219875bfce8Swiz.Xr fstab 5 , 220875bfce8Swiz.Xr fsck 8 , 221875bfce8Swiz.Xr newfs_lfs 8 , 222875bfce8Swiz.Xr reboot 8 223369e9cadSperseant.Sh HISTORY 224369e9cadSperseantThe 225369e9cadSperseant.Nm 226369e9cadSperseantprogram was first made available in 227369e9cadSperseant.Nx 1.4 . 228875bfce8Swiz.Sh AUTHORS 229369e9cadSperseantMost of the 230369e9cadSperseant.Nm 231369e9cadSperseantprogram was taken from 232369e9cadSperseant.Xr fsck_ffs 8 ; 233b08dad00Swizwhat was not was written by 234a5684d07Swiz.An Konrad Schroder Aq Mt perseant@NetBSD.org . 235