]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/fsck_ffs/fsck_ffs.8
This commit was generated by cvs2svn to compensate for changes in r98524,
[FreeBSD/FreeBSD.git] / sbin / fsck_ffs / fsck_ffs.8
1 .\"
2 .\" Copyright (c) 1980, 1989, 1991, 1993
3 .\"     The Regents of the University of California.  All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\"    must display the following acknowledgment:
15 .\"     This product includes software developed by the University of
16 .\"     California, Berkeley and its contributors.
17 .\" 4. Neither the name of the University nor the names of its contributors
18 .\"    may be used to endorse or promote products derived from this software
19 .\"    without specific prior written permission.
20 .\"
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" SUCH DAMAGE.
32 .\"
33 .\"     @(#)fsck.8      8.4 (Berkeley) 5/9/95
34 .\" $FreeBSD$
35 .\"
36 .Dd April 24, 2001
37 .Dt FSCK_FFS 8
38 .Os
39 .Sh NAME
40 .Nm fsck_ffs ,
41 .Nm fsck_ufs
42 .Nd filesystem consistency check and interactive repair
43 .Sh SYNOPSIS
44 .Nm
45 .Op Fl BFpfny
46 .Op Fl b Ar block#
47 .Op Fl c Ar level
48 .Op Fl m Ar mode
49 .Ar filesystem
50 .Ar ...
51 .Sh DESCRIPTION
52 The specified disk partitions and/or filesystems are checked.
53 In "preen" mode the clean flag of each filesystem's superblock is examined
54 and only those filesystems that
55 are not marked clean are checked.
56 Filesystems are marked clean when they are unmounted,
57 when they have been mounted read-only, or when
58 .Nm
59 runs on them successfully.
60 If the
61 .Fl f
62 option is specified, the filesystems
63 will be checked regardless of the state of their clean flag.
64 .Pp
65 The kernel takes care that only a restricted class of innocuous filesystem
66 inconsistencies can happen unless hardware or software failures intervene.
67 These are limited to the following:
68 .Pp
69 .Bl -item -compact -offset indent
70 .It
71 Unreferenced inodes
72 .It
73 Link counts in inodes too large
74 .It
75 Missing blocks in the free map
76 .It
77 Blocks in the free map also in files
78 .It
79 Counts in the super-block wrong
80 .El
81 .Pp
82 These are the only inconsistencies that
83 .Nm
84 with the
85 .Fl p
86 option will correct; if it encounters other inconsistencies, it exits
87 with an abnormal return status and an automatic reboot will then fail.
88 For each corrected inconsistency one or more lines will be printed
89 identifying the filesystem on which the correction will take place,
90 and the nature of the correction.  After successfully correcting a filesystem,
91 .Nm
92 will print the number of files on that filesystem,
93 the number of used and free blocks,
94 and the percentage of fragmentation.
95 .Pp
96 If sent a
97 .Dv QUIT
98 signal,
99 .Nm
100 will finish the filesystem checks, then exit with an abnormal
101 return status that causes an automatic reboot to fail.
102 This is useful when you want to finish the filesystem checks during an
103 automatic reboot,
104 but do not want the machine to come up multiuser after the checks complete.
105 .Pp
106 If
107 .Nm
108 receives a
109 .Dv SIGINFO
110 (see the
111 .Dq status
112 argument for
113 .Xr stty 1 )
114 signal, a line will be written to the standard output indicating
115 the name of the device currently being checked, the current phase
116 number and phase-specific progress information.
117 .Pp
118 Without the
119 .Fl p
120 option,
121 .Nm
122 audits and interactively repairs inconsistent conditions for filesystems.
123 If the filesystem is inconsistent the operator is prompted for concurrence
124 before each correction is attempted.
125 It should be noted that some of the corrective actions which are not
126 correctable under the
127 .Fl p
128 option will result in some loss of data.
129 The amount and severity of data lost may be determined from the diagnostic
130 output.
131 The default action for each consistency correction
132 is to wait for the operator to respond
133 .Li yes
134 or
135 .Li no .
136 If the operator does not have write permission on the filesystem
137 .Nm
138 will default to a
139 .Fl n
140 action.
141 .Pp
142 The following flags are interpreted by
143 .Nm :
144 .Bl -tag -width indent
145 .It Fl F
146 Determine whether the filesystem needs to be cleaned immediately
147 in foreground, or if its cleaning can be deferred to background.
148 To be eligible for background cleaning it must have been running
149 with soft updates, not have been marked as needing a foreground check,
150 and be mounted and writable when the background check is to be done.
151 If these conditions are met, then
152 .Nm
153 exits with a zero exit status.
154 Otherwise it exits with a non-zero exit status.
155 If the filesystem is clean,
156 it will exit with a non-zero exit status so that the clean status
157 of the filesystem can be verified and reported during the foreground
158 checks.
159 Note that when invoked with the
160 .Fl F
161 flag, no cleanups are done.
162 The only thing that
163 .Nm
164 does is to determine whether a foreground or background
165 check is needed and exit with an appropriate status code.
166 .It Fl B
167 A check is done on the specified and possibly active filesystem.
168 The set of corrections that can be done is limited to those done
169 when running in preen mode (see the
170 .Fl p
171 flag).
172 If unexpected errors are found,
173 the filesystem is marked as needing a foreground check and
174 .Nm
175 exits without attempting any further cleaning.
176 .It Fl b
177 Use the block specified immediately after the flag as
178 the super block for the filesystem.  Block 32 is usually
179 an alternate super block.
180 .It Fl c
181 Convert the filesystem to the specified level.
182 Note that the level of a filesystem can only be raised.
183 There are currently four levels defined:
184 .Bl -tag -width indent
185 .It 0
186 The filesystem is in the old (static table) format.
187 .It 1
188 The filesystem is in the new (dynamic table) format.
189 .It 2
190 The filesystem supports 32-bit uid's and gid's,
191 short symbolic links are stored in the inode,
192 and directories have an added field showing the file type.
193 .It 3
194 If maxcontig is greater than one,
195 build the free segment maps to aid in finding contiguous sets of blocks.
196 If maxcontig is equal to one, delete any existing segment maps.
197 .El
198 .Pp
199 In interactive mode,
200 .Nm
201 will list the conversion to be made
202 and ask whether the conversion should be done.
203 If a negative answer is given,
204 no further operations are done on the filesystem.
205 In preen mode,
206 the conversion is listed and done if
207 possible without user interaction.
208 Conversion in preen mode is best used when all the filesystems
209 are being converted at once.
210 The format of a filesystem can be determined from the
211 first line of output from
212 .Xr dumpfs 8 .
213 .It Fl f
214 Force
215 .Nm
216 to check
217 .Sq clean
218 filesystems when preening.
219 .It Fl m
220 Use the mode specified in octal immediately after the flag as the
221 permission bits to use when creating the
222 .Pa lost+found
223 directory rather than the default 1777.
224 In particular, systems that do not wish to have lost files accessible
225 by all users on the system should use a more restrictive
226 set of permissions such as 700.
227 .It Fl n
228 Assume a no response to all questions asked by
229 .Nm
230 except for
231 .Ql CONTINUE? ,
232 which is assumed to be affirmative;
233 do not open the filesystem for writing.
234 .It Fl p
235 Preen filesystems (see above).
236 .It Fl y
237 Assume a yes response to all questions asked by
238 .Nm ;
239 this should be used with great caution as this is a free license
240 to continue after essentially unlimited trouble has been encountered.
241 .El
242 .Pp
243 Inconsistencies checked are as follows:
244 .Pp
245 .Bl -enum -compact
246 .It
247 Blocks claimed by more than one inode or the free map.
248 .It
249 Blocks claimed by an inode outside the range of the filesystem.
250 .It
251 Incorrect link counts.
252 .It
253 Size checks:
254 .Bl -item -offset indent -compact
255 .It
256 Directory size not a multiple of DIRBLKSIZ.
257 .It
258 Partially truncated file.
259 .El
260 .It
261 Bad inode format.
262 .It
263 Blocks not accounted for anywhere.
264 .It
265 Directory checks:
266 .Bl -item -offset indent -compact
267 .It
268 File pointing to unallocated inode.
269 .It
270 Inode number out of range.
271 .It
272 Directories with unallocated blocks (holes).
273 .It
274 Dot or dot-dot not the first two entries of a directory
275 or having the wrong inode number.
276 .El
277 .It
278 Super Block checks:
279 .Bl -item -offset indent -compact
280 .It
281 More blocks for inodes than there are in the filesystem.
282 .It
283 Bad free block map format.
284 .It
285 Total free block and/or free inode count incorrect.
286 .El
287 .El
288 .Pp
289 Orphaned files and directories (allocated but unreferenced) are,
290 with the operator's concurrence, reconnected by
291 placing them in the
292 .Pa lost+found
293 directory.
294 The name assigned is the inode number.
295 If the
296 .Pa lost+found
297 directory does not exist, it is created.
298 If there is insufficient space its size is increased.
299 .Sh FILES
300 .Bl -tag -width /etc/fstab -compact
301 .It Pa /etc/fstab
302 contains default list of filesystems to check.
303 .El
304 .Sh DIAGNOSTICS
305 .Ex -std
306 .Pp
307 The diagnostics produced by
308 .Nm
309 are fully enumerated and explained in Appendix A of
310 .Rs
311 .%T "Fsck \- The UNIX File System Check Program"
312 .Re
313 .Sh SEE ALSO
314 .Xr fs 5 ,
315 .Xr fstab 5 ,
316 .Xr fsck 8 ,
317 .Xr fsdb 8 ,
318 .Xr newfs 8 ,
319 .Xr reboot 8