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