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