xref: /minix3/sbin/fsck_ext2fs/fsck_ext2fs.8 (revision 94715d8e544a29153969034072cc27e737b55671)
1*94715d8eSBen Gras.\"	$NetBSD: fsck_ext2fs.8,v 1.19 2010/02/21 13:26:45 wiz Exp $
2*94715d8eSBen Gras.\"
3*94715d8eSBen Gras.\" Copyright (c) 1980, 1989, 1991, 1993
4*94715d8eSBen Gras.\"	The Regents of the University of California.  All rights reserved.
5*94715d8eSBen Gras.\"
6*94715d8eSBen Gras.\" Redistribution and use in source and binary forms, with or without
7*94715d8eSBen Gras.\" modification, are permitted provided that the following conditions
8*94715d8eSBen Gras.\" are met:
9*94715d8eSBen Gras.\" 1. Redistributions of source code must retain the above copyright
10*94715d8eSBen Gras.\"    notice, this list of conditions and the following disclaimer.
11*94715d8eSBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright
12*94715d8eSBen Gras.\"    notice, this list of conditions and the following disclaimer in the
13*94715d8eSBen Gras.\"    documentation and/or other materials provided with the distribution.
14*94715d8eSBen Gras.\" 3. Neither the name of the University nor the names of its contributors
15*94715d8eSBen Gras.\"    may be used to endorse or promote products derived from this software
16*94715d8eSBen Gras.\"    without specific prior written permission.
17*94715d8eSBen Gras.\"
18*94715d8eSBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19*94715d8eSBen Gras.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20*94715d8eSBen Gras.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21*94715d8eSBen Gras.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22*94715d8eSBen Gras.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23*94715d8eSBen Gras.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24*94715d8eSBen Gras.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25*94715d8eSBen Gras.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26*94715d8eSBen Gras.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27*94715d8eSBen Gras.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28*94715d8eSBen Gras.\" SUCH DAMAGE.
29*94715d8eSBen Gras.\"
30*94715d8eSBen Gras.\" Copyright (c) 1997 Manuel Bouyer.
31*94715d8eSBen Gras.\"
32*94715d8eSBen Gras.\" Redistribution and use in source and binary forms, with or without
33*94715d8eSBen Gras.\" modification, are permitted provided that the following conditions
34*94715d8eSBen Gras.\" are met:
35*94715d8eSBen Gras.\" 1. Redistributions of source code must retain the above copyright
36*94715d8eSBen Gras.\"    notice, this list of conditions and the following disclaimer.
37*94715d8eSBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright
38*94715d8eSBen Gras.\"    notice, this list of conditions and the following disclaimer in the
39*94715d8eSBen Gras.\"    documentation and/or other materials provided with the distribution.
40*94715d8eSBen Gras.\"
41*94715d8eSBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
42*94715d8eSBen Gras.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
43*94715d8eSBen Gras.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
44*94715d8eSBen Gras.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
45*94715d8eSBen Gras.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46*94715d8eSBen Gras.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47*94715d8eSBen Gras.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48*94715d8eSBen Gras.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49*94715d8eSBen Gras.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
50*94715d8eSBen Gras.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51*94715d8eSBen Gras.\"
52*94715d8eSBen Gras.\"	@(#)fsck.8	8.3 (Berkeley) 11/29/94
53*94715d8eSBen Gras.\"
54*94715d8eSBen Gras.Dd October 9, 2008
55*94715d8eSBen Gras.Dt FSCK_EXT2FS 8
56*94715d8eSBen Gras.Os
57*94715d8eSBen Gras.Sh NAME
58*94715d8eSBen Gras.Nm fsck_ext2fs
59*94715d8eSBen Gras.Nd ext2 File System consistency check and interactive repair
60*94715d8eSBen Gras.Sh SYNOPSIS
61*94715d8eSBen Gras.Nm
62*94715d8eSBen Gras.Op Fl dfnpUy
63*94715d8eSBen Gras.Op Fl b Ar block#
64*94715d8eSBen Gras.Op Fl c Ar level
65*94715d8eSBen Gras.Op Fl m Ar mode
66*94715d8eSBen Gras.Ar filesystem ...
67*94715d8eSBen Gras.Sh DESCRIPTION
68*94715d8eSBen Gras.Nm
69*94715d8eSBen Grasperforms interactive filesystem consistency checks and repair for each of
70*94715d8eSBen Grasthe filesystems specified on the command line.
71*94715d8eSBen GrasIt is normally invoked from
72*94715d8eSBen Gras.Xr fsck 8 .
73*94715d8eSBen Gras.Pp
74*94715d8eSBen GrasThe kernel takes care that only a restricted class of innocuous filesystem
75*94715d8eSBen Grasinconsistencies can happen unless hardware or software failures intervene.
76*94715d8eSBen GrasThese are limited to the following:
77*94715d8eSBen Gras.Pp
78*94715d8eSBen Gras.Bl -item -compact
79*94715d8eSBen Gras.It
80*94715d8eSBen GrasUnreferenced inodes
81*94715d8eSBen Gras.It
82*94715d8eSBen GrasLink counts in inodes too large
83*94715d8eSBen Gras.It
84*94715d8eSBen GrasMissing blocks in the free map
85*94715d8eSBen Gras.It
86*94715d8eSBen GrasBlocks in the free map also in files
87*94715d8eSBen Gras.It
88*94715d8eSBen GrasCounts in the super-block wrong
89*94715d8eSBen Gras.El
90*94715d8eSBen Gras.Pp
91*94715d8eSBen GrasThese are the only inconsistencies that
92*94715d8eSBen Gras.Nm
93*94715d8eSBen Grasin
94*94715d8eSBen Gras.Dq preen
95*94715d8eSBen Grasmode (with the
96*94715d8eSBen Gras.Fl p
97*94715d8eSBen Grasoption) will correct; if it encounters other inconsistencies, it exits
98*94715d8eSBen Graswith an abnormal return status.
99*94715d8eSBen GrasFor each corrected inconsistency one or more lines will be printed
100*94715d8eSBen Grasidentifying the filesystem on which the correction will take place,
101*94715d8eSBen Grasand the nature of the correction.
102*94715d8eSBen GrasAfter successfully correcting a filesystem,
103*94715d8eSBen Gras.Nm
104*94715d8eSBen Graswill print the number of files on that filesystem
105*94715d8eSBen Grasand the number of used and free blocks.
106*94715d8eSBen Gras.Pp
107*94715d8eSBen GrasIf sent a
108*94715d8eSBen Gras.Dv QUIT
109*94715d8eSBen Grassignal,
110*94715d8eSBen Gras.Nm
111*94715d8eSBen Graswill finish the filesystem checks, then exit with an abnormal return status.
112*94715d8eSBen Gras.Pp
113*94715d8eSBen GrasWithout the
114*94715d8eSBen Gras.Fl p
115*94715d8eSBen Grasoption,
116*94715d8eSBen Gras.Nm
117*94715d8eSBen Grasaudits and interactively repairs inconsistent conditions for filesystems.
118*94715d8eSBen GrasIf the filesystem is inconsistent the operator is prompted for concurrence
119*94715d8eSBen Grasbefore each correction is attempted.
120*94715d8eSBen GrasIt should be noted that some of the corrective actions which are not
121*94715d8eSBen Grascorrectable under the
122*94715d8eSBen Gras.Fl p
123*94715d8eSBen Grasoption will result in some loss of data.
124*94715d8eSBen GrasThe amount and severity of data lost may be determined from the diagnostic
125*94715d8eSBen Grasoutput.
126*94715d8eSBen GrasThe default action for each consistency correction
127*94715d8eSBen Grasis to wait for the operator to respond
128*94715d8eSBen Gras.Li yes
129*94715d8eSBen Grasor
130*94715d8eSBen Gras.Li no .
131*94715d8eSBen GrasIf the operator does not have write permission on the filesystem
132*94715d8eSBen Gras.Nm
133*94715d8eSBen Graswill default to a
134*94715d8eSBen Gras.Fl n
135*94715d8eSBen Grasaction.
136*94715d8eSBen Gras.Pp
137*94715d8eSBen GrasThe following flags are interpreted by
138*94715d8eSBen Gras.Nm .
139*94715d8eSBen Gras.Bl -tag -width indent
140*94715d8eSBen Gras.It Fl b
141*94715d8eSBen GrasUse the block specified immediately after the flag as
142*94715d8eSBen Grasthe super block for the filesystem.
143*94715d8eSBen GrasBlock 8193 is usually an alternate super block.
144*94715d8eSBen Gras.It Fl d
145*94715d8eSBen GrasPrint debugging output.
146*94715d8eSBen Gras.It Fl f
147*94715d8eSBen GrasForce checking of file systems.
148*94715d8eSBen GrasNormally, if a file system is cleanly unmounted, the kernel will set a
149*94715d8eSBen Gras.Dq clean flag
150*94715d8eSBen Grasin the file system superblock, and
151*94715d8eSBen Gras.Nm
152*94715d8eSBen Graswill not check the file system.
153*94715d8eSBen GrasThis option forces
154*94715d8eSBen Gras.Nm
155*94715d8eSBen Grasto check the file system, regardless of the state of the clean flag.
156*94715d8eSBen Gras.It Fl m
157*94715d8eSBen GrasUse the mode specified in octal immediately after the flag as the
158*94715d8eSBen Graspermission bits to use when creating the
159*94715d8eSBen Gras.Pa lost+found
160*94715d8eSBen Grasdirectory rather than the default 1777.
161*94715d8eSBen GrasIn particular, systems that do not wish to have lost files accessible
162*94715d8eSBen Grasby all users on the system should use a more restrictive
163*94715d8eSBen Grasset of permissions such as 700.
164*94715d8eSBen Gras.It Fl n
165*94715d8eSBen GrasAssume a no response to all questions asked by
166*94715d8eSBen Gras.Nm
167*94715d8eSBen Grasexcept for
168*94715d8eSBen Gras.Ql CONTINUE? ,
169*94715d8eSBen Graswhich is assumed to be affirmative;
170*94715d8eSBen Grasdo not open the filesystem for writing.
171*94715d8eSBen Gras.It Fl p
172*94715d8eSBen GrasSpecify
173*94715d8eSBen Gras.Dq preen
174*94715d8eSBen Grasmode, described above.
175*94715d8eSBen Gras.It Fl U
176*94715d8eSBen GrasResolve numeric userids to usernames.
177*94715d8eSBen Gras.It Fl y
178*94715d8eSBen GrasAssume a yes response to all questions asked by
179*94715d8eSBen Gras.Nm ;
180*94715d8eSBen Grasthis should be used with great caution as this is a free license
181*94715d8eSBen Grasto continue after essentially unlimited trouble has been encountered.
182*94715d8eSBen Gras.El
183*94715d8eSBen Gras.Pp
184*94715d8eSBen GrasInconsistencies checked are as follows:
185*94715d8eSBen Gras.Bl -enum -offset indent -compact
186*94715d8eSBen Gras.It
187*94715d8eSBen GrasBlocks claimed by more than one inode or the free map.
188*94715d8eSBen Gras.It
189*94715d8eSBen GrasBlocks claimed by an inode outside the range of the filesystem.
190*94715d8eSBen Gras.It
191*94715d8eSBen GrasIncorrect link counts.
192*94715d8eSBen Gras.It
193*94715d8eSBen GrasSize checks:
194*94715d8eSBen Gras.Bl -item -offset indent -compact
195*94715d8eSBen Gras.It
196*94715d8eSBen GrasDirectory size not a multiple of filesystem block size.
197*94715d8eSBen Gras.It
198*94715d8eSBen GrasPartially truncated file.
199*94715d8eSBen Gras.El
200*94715d8eSBen Gras.It
201*94715d8eSBen GrasBad inode format.
202*94715d8eSBen Gras.It
203*94715d8eSBen GrasBlocks not accounted for anywhere.
204*94715d8eSBen Gras.It
205*94715d8eSBen GrasDirectory checks:
206*94715d8eSBen Gras.Bl -item -offset indent -compact
207*94715d8eSBen Gras.It
208*94715d8eSBen GrasFile pointing to unallocated inode.
209*94715d8eSBen Gras.It
210*94715d8eSBen GrasInode number out of range.
211*94715d8eSBen Gras.It
212*94715d8eSBen GrasDot or dot-dot not the first two entries of a directory
213*94715d8eSBen Grasor having the wrong inode number.
214*94715d8eSBen Gras.El
215*94715d8eSBen Gras.It
216*94715d8eSBen GrasSuper Block checks:
217*94715d8eSBen Gras.Bl -item -offset indent -compact
218*94715d8eSBen Gras.It
219*94715d8eSBen GrasMore blocks for inodes than there are in the filesystem.
220*94715d8eSBen Gras.It
221*94715d8eSBen GrasBad free block map format.
222*94715d8eSBen Gras.It
223*94715d8eSBen GrasTotal free block and/or free inode count incorrect.
224*94715d8eSBen Gras.El
225*94715d8eSBen Gras.El
226*94715d8eSBen Gras.Pp
227*94715d8eSBen GrasOrphaned files and directories (allocated but unreferenced) are,
228*94715d8eSBen Graswith the operator's concurrence, reconnected by
229*94715d8eSBen Grasplacing them in the
230*94715d8eSBen Gras.Pa lost+found
231*94715d8eSBen Grasdirectory.
232*94715d8eSBen GrasThe name assigned is the inode number.
233*94715d8eSBen GrasIf the
234*94715d8eSBen Gras.Pa lost+found
235*94715d8eSBen Grasdirectory does not exist, it is created.
236*94715d8eSBen GrasIf there is insufficient space its size is increased.
237*94715d8eSBen Gras.Pp
238*94715d8eSBen GrasBecause of inconsistencies between the block device and the buffer cache,
239*94715d8eSBen Grasthe raw device should always be used.
240*94715d8eSBen Gras.Sh DIAGNOSTICS
241*94715d8eSBen GrasThe diagnostics produced by
242*94715d8eSBen Gras.Nm
243*94715d8eSBen Grasare fully enumerated and explained in Appendix A of
244*94715d8eSBen Gras.Rs
245*94715d8eSBen Gras.%T "Fsck \- The UNIX File System Check Program"
246*94715d8eSBen Gras.Re
247*94715d8eSBen Gras.Sh SEE ALSO
248*94715d8eSBen Gras.Xr fs 5 ,
249*94715d8eSBen Gras.Xr fstab 5 ,
250*94715d8eSBen Gras.Xr fsck 8 ,
251*94715d8eSBen Gras.Xr fsdb 8 ,
252*94715d8eSBen Gras.Xr newfs 8 ,
253*94715d8eSBen Gras.Xr reboot 8
254