1*697ce855Ssevan.\" $NetBSD: fsck_ext2fs.8,v 1.21 2018/08/27 15:16:49 sevan Exp $ 28f7c2b37Sbouyer.\" 38f7c2b37Sbouyer.\" Copyright (c) 1980, 1989, 1991, 1993 48f7c2b37Sbouyer.\" The Regents of the University of California. All rights reserved. 58f7c2b37Sbouyer.\" 68f7c2b37Sbouyer.\" Redistribution and use in source and binary forms, with or without 78f7c2b37Sbouyer.\" modification, are permitted provided that the following conditions 88f7c2b37Sbouyer.\" are met: 98f7c2b37Sbouyer.\" 1. Redistributions of source code must retain the above copyright 108f7c2b37Sbouyer.\" notice, this list of conditions and the following disclaimer. 118f7c2b37Sbouyer.\" 2. Redistributions in binary form must reproduce the above copyright 128f7c2b37Sbouyer.\" notice, this list of conditions and the following disclaimer in the 138f7c2b37Sbouyer.\" documentation and/or other materials provided with the distribution. 14bf07c871Sagc.\" 3. Neither the name of the University nor the names of its contributors 15bf07c871Sagc.\" may be used to endorse or promote products derived from this software 16bf07c871Sagc.\" without specific prior written permission. 17bf07c871Sagc.\" 18bf07c871Sagc.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19bf07c871Sagc.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20bf07c871Sagc.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21bf07c871Sagc.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22bf07c871Sagc.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23bf07c871Sagc.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24bf07c871Sagc.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25bf07c871Sagc.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26bf07c871Sagc.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27bf07c871Sagc.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28bf07c871Sagc.\" SUCH DAMAGE. 29bf07c871Sagc.\" 30bf07c871Sagc.\" Copyright (c) 1997 Manuel Bouyer. 31bf07c871Sagc.\" 32bf07c871Sagc.\" Redistribution and use in source and binary forms, with or without 33bf07c871Sagc.\" modification, are permitted provided that the following conditions 34bf07c871Sagc.\" are met: 35bf07c871Sagc.\" 1. Redistributions of source code must retain the above copyright 36bf07c871Sagc.\" notice, this list of conditions and the following disclaimer. 37bf07c871Sagc.\" 2. Redistributions in binary form must reproduce the above copyright 38bf07c871Sagc.\" notice, this list of conditions and the following disclaimer in the 39bf07c871Sagc.\" documentation and/or other materials provided with the distribution. 408f7c2b37Sbouyer.\" 412f853da9Sbouyer.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 422f853da9Sbouyer.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 432f853da9Sbouyer.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 442f853da9Sbouyer.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 452f853da9Sbouyer.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 462f853da9Sbouyer.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 472f853da9Sbouyer.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 482f853da9Sbouyer.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 492f853da9Sbouyer.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 502f853da9Sbouyer.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 518f7c2b37Sbouyer.\" 528f7c2b37Sbouyer.\" @(#)fsck.8 8.3 (Berkeley) 11/29/94 538f7c2b37Sbouyer.\" 54*697ce855Ssevan.Dd August 27, 2018 55bcb582e7Smikel.Dt FSCK_EXT2FS 8 5673f545bbSwiz.Os 578f7c2b37Sbouyer.Sh NAME 588f7c2b37Sbouyer.Nm fsck_ext2fs 591a64f420Swiz.Nd ext2 File System consistency check and interactive repair 608f7c2b37Sbouyer.Sh SYNOPSIS 61990562bfSwiz.Nm 62104f1a2cSwiz.Op Fl dfnpUy 638f7c2b37Sbouyer.Op Fl b Ar block# 648f7c2b37Sbouyer.Op Fl m Ar mode 65f6590b22Smycroft.Ar filesystem ... 668f7c2b37Sbouyer.Sh DESCRIPTION 674b836889Slukem.Nm 688f7c2b37Sbouyerperforms interactive filesystem consistency checks and repair for each of 692fb4b1dbSwizthe filesystems specified on the command line. 702fb4b1dbSwizIt is normally invoked from 718f7c2b37Sbouyer.Xr fsck 8 . 728f7c2b37Sbouyer.Pp 738f7c2b37SbouyerThe kernel takes care that only a restricted class of innocuous filesystem 748f7c2b37Sbouyerinconsistencies can happen unless hardware or software failures intervene. 758f7c2b37SbouyerThese are limited to the following: 768f7c2b37Sbouyer.Pp 778f7c2b37Sbouyer.Bl -item -compact 788f7c2b37Sbouyer.It 798f7c2b37SbouyerUnreferenced inodes 808f7c2b37Sbouyer.It 818f7c2b37SbouyerLink counts in inodes too large 828f7c2b37Sbouyer.It 838f7c2b37SbouyerMissing blocks in the free map 848f7c2b37Sbouyer.It 858f7c2b37SbouyerBlocks in the free map also in files 868f7c2b37Sbouyer.It 878f7c2b37SbouyerCounts in the super-block wrong 888f7c2b37Sbouyer.El 898f7c2b37Sbouyer.Pp 908f7c2b37SbouyerThese are the only inconsistencies that 914b836889Slukem.Nm 92104f1a2cSwizin 93104f1a2cSwiz.Dq preen 948f7c2b37Sbouyermode (with the 958f7c2b37Sbouyer.Fl p 968f7c2b37Sbouyeroption) will correct; if it encounters other inconsistencies, it exits 978f7c2b37Sbouyerwith an abnormal return status. 988f7c2b37SbouyerFor each corrected inconsistency one or more lines will be printed 998f7c2b37Sbouyeridentifying the filesystem on which the correction will take place, 1002fb4b1dbSwizand the nature of the correction. 1012fb4b1dbSwizAfter successfully correcting a filesystem, 1024b836889Slukem.Nm 1038f7c2b37Sbouyerwill print the number of files on that filesystem 1048f7c2b37Sbouyerand the number of used and free blocks. 1058f7c2b37Sbouyer.Pp 1068f7c2b37SbouyerIf sent a 1078f7c2b37Sbouyer.Dv QUIT 1088f7c2b37Sbouyersignal, 1094b836889Slukem.Nm 1108f7c2b37Sbouyerwill finish the filesystem checks, then exit with an abnormal return status. 1118f7c2b37Sbouyer.Pp 1128f7c2b37SbouyerWithout the 1138f7c2b37Sbouyer.Fl p 1148f7c2b37Sbouyeroption, 1154b836889Slukem.Nm 1168f7c2b37Sbouyeraudits and interactively repairs inconsistent conditions for filesystems. 1178f7c2b37SbouyerIf the filesystem is inconsistent the operator is prompted for concurrence 1188f7c2b37Sbouyerbefore each correction is attempted. 1198f7c2b37SbouyerIt should be noted that some of the corrective actions which are not 1208f7c2b37Sbouyercorrectable under the 1218f7c2b37Sbouyer.Fl p 1228f7c2b37Sbouyeroption will result in some loss of data. 1238f7c2b37SbouyerThe amount and severity of data lost may be determined from the diagnostic 1248f7c2b37Sbouyeroutput. 1258f7c2b37SbouyerThe default action for each consistency correction 1268f7c2b37Sbouyeris to wait for the operator to respond 1278f7c2b37Sbouyer.Li yes 1288f7c2b37Sbouyeror 1298f7c2b37Sbouyer.Li no . 1308f7c2b37SbouyerIf the operator does not have write permission on the filesystem 1314b836889Slukem.Nm 1328f7c2b37Sbouyerwill default to a 1338f7c2b37Sbouyer.Fl n 1348f7c2b37Sbouyeraction. 1358f7c2b37Sbouyer.Pp 1368f7c2b37SbouyerThe following flags are interpreted by 137990562bfSwiz.Nm . 1388f7c2b37Sbouyer.Bl -tag -width indent 1398f7c2b37Sbouyer.It Fl b 1408f7c2b37SbouyerUse the block specified immediately after the flag as 1412fb4b1dbSwizthe super block for the filesystem. 1422fb4b1dbSwizBlock 8193 is usually an alternate super block. 1438f7c2b37Sbouyer.It Fl d 1448f7c2b37SbouyerPrint debugging output. 1458f7c2b37Sbouyer.It Fl f 1462fb4b1dbSwizForce checking of file systems. 1472fb4b1dbSwizNormally, if a file system is cleanly unmounted, the kernel will set a 1488f7c2b37Sbouyer.Dq clean flag 1498f7c2b37Sbouyerin the file system superblock, and 1508f7c2b37Sbouyer.Nm 1512fb4b1dbSwizwill not check the file system. 1522fb4b1dbSwizThis option forces 1538f7c2b37Sbouyer.Nm 1548f7c2b37Sbouyerto check the file system, regardless of the state of the clean flag. 1558f7c2b37Sbouyer.It Fl m 1568f7c2b37SbouyerUse the mode specified in octal immediately after the flag as the 1578f7c2b37Sbouyerpermission bits to use when creating the 1588f7c2b37Sbouyer.Pa lost+found 1598f7c2b37Sbouyerdirectory rather than the default 1777. 1608f7c2b37SbouyerIn particular, systems that do not wish to have lost files accessible 1618f7c2b37Sbouyerby all users on the system should use a more restrictive 1628f7c2b37Sbouyerset of permissions such as 700. 1638f7c2b37Sbouyer.It Fl n 1648f7c2b37SbouyerAssume a no response to all questions asked by 1654b836889Slukem.Nm 1668f7c2b37Sbouyerexcept for 1678f7c2b37Sbouyer.Ql CONTINUE? , 1688f7c2b37Sbouyerwhich is assumed to be affirmative; 1698f7c2b37Sbouyerdo not open the filesystem for writing. 1708f7c2b37Sbouyer.It Fl p 171104f1a2cSwizSpecify 172104f1a2cSwiz.Dq preen 173104f1a2cSwizmode, described above. 17459334248Schristos.It Fl U 17559334248SchristosResolve numeric userids to usernames. 1768f7c2b37Sbouyer.It Fl y 1778f7c2b37SbouyerAssume a yes response to all questions asked by 178990562bfSwiz.Nm ; 1798f7c2b37Sbouyerthis should be used with great caution as this is a free license 1808f7c2b37Sbouyerto continue after essentially unlimited trouble has been encountered. 1818f7c2b37Sbouyer.El 1828f7c2b37Sbouyer.Pp 1838f7c2b37SbouyerInconsistencies checked are as follows: 184d7eb1430Sjoerg.Bl -enum -offset indent -compact 1858f7c2b37Sbouyer.It 1868f7c2b37SbouyerBlocks claimed by more than one inode or the free map. 1878f7c2b37Sbouyer.It 1888f7c2b37SbouyerBlocks claimed by an inode outside the range of the filesystem. 1898f7c2b37Sbouyer.It 1908f7c2b37SbouyerIncorrect link counts. 1918f7c2b37Sbouyer.It 1928f7c2b37SbouyerSize checks: 1938bd7cb6aSross.Bl -item -offset indent -compact 1948f7c2b37Sbouyer.It 1958f7c2b37SbouyerDirectory size not a multiple of filesystem block size. 1968f7c2b37Sbouyer.It 1978f7c2b37SbouyerPartially truncated file. 1988f7c2b37Sbouyer.El 1998f7c2b37Sbouyer.It 2008f7c2b37SbouyerBad inode format. 2018f7c2b37Sbouyer.It 2028f7c2b37SbouyerBlocks not accounted for anywhere. 2038f7c2b37Sbouyer.It 2048f7c2b37SbouyerDirectory checks: 2058bd7cb6aSross.Bl -item -offset indent -compact 2068f7c2b37Sbouyer.It 2078f7c2b37SbouyerFile pointing to unallocated inode. 2088f7c2b37Sbouyer.It 2098f7c2b37SbouyerInode number out of range. 2108f7c2b37Sbouyer.It 2118f7c2b37SbouyerDot or dot-dot not the first two entries of a directory 2128f7c2b37Sbouyeror having the wrong inode number. 2138f7c2b37Sbouyer.El 2148f7c2b37Sbouyer.It 2158f7c2b37SbouyerSuper Block checks: 2168bd7cb6aSross.Bl -item -offset indent -compact 2178f7c2b37Sbouyer.It 2188f7c2b37SbouyerMore blocks for inodes than there are in the filesystem. 2198f7c2b37Sbouyer.It 2208f7c2b37SbouyerBad free block map format. 2218f7c2b37Sbouyer.It 2228f7c2b37SbouyerTotal free block and/or free inode count incorrect. 2238f7c2b37Sbouyer.El 2248f7c2b37Sbouyer.El 2258f7c2b37Sbouyer.Pp 2268f7c2b37SbouyerOrphaned files and directories (allocated but unreferenced) are, 2278f7c2b37Sbouyerwith the operator's concurrence, reconnected by 2288f7c2b37Sbouyerplacing them in the 2298f7c2b37Sbouyer.Pa lost+found 2308f7c2b37Sbouyerdirectory. 2318f7c2b37SbouyerThe name assigned is the inode number. 2328f7c2b37SbouyerIf the 2338f7c2b37Sbouyer.Pa lost+found 2348f7c2b37Sbouyerdirectory does not exist, it is created. 2358f7c2b37SbouyerIf there is insufficient space its size is increased. 2368f7c2b37Sbouyer.Pp 2378f7c2b37SbouyerBecause of inconsistencies between the block device and the buffer cache, 2388f7c2b37Sbouyerthe raw device should always be used. 2398f7c2b37Sbouyer.Sh DIAGNOSTICS 2408f7c2b37SbouyerThe diagnostics produced by 2414b836889Slukem.Nm 2428f7c2b37Sbouyerare fully enumerated and explained in Appendix A of 2438f7c2b37Sbouyer.Rs 2448f7c2b37Sbouyer.%T "Fsck \- The UNIX File System Check Program" 2458f7c2b37Sbouyer.Re 2468f7c2b37Sbouyer.Sh SEE ALSO 2478f7c2b37Sbouyer.Xr fs 5 , 248bb03964eSwiz.Xr fstab 5 , 249bcb582e7Smikel.Xr fsck 8 , 2508f7c2b37Sbouyer.Xr fsdb 8 , 2518f7c2b37Sbouyer.Xr newfs 8 , 252bcb582e7Smikel.Xr reboot 8 253a7a41f50Ssevan.Sh HISTORY 254a7a41f50SsevanA 255a7a41f50Ssevan.Nm 256a7a41f50Ssevanutility appeared in 257a7a41f50Ssevan.Nx 1.3 . 258a7a41f50Ssevan.Sh AUTHORS 259a7a41f50Ssevan.Nm 260a7a41f50Ssevanwas written by 261a7a41f50Ssevan.An Manuel Bouyer Aq Mt bouyer@NetBSD.org . 262