1 .\" $NetBSD: fsck_ffs.8,v 1.45 2009/05/07 06:54:23 lukem Exp $
3 .\" Copyright (c) 1980, 1989, 1991, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
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.
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
30 .\" @(#)fsck.8 8.3 (Berkeley) 11/29/94
37 .Nd Fast File System consistency check and interactive repair
45 .Op Fl x Ar snap-backup
50 performs interactive file system consistency checks and repair for each of
51 the file systems specified on the command line.
52 It is normally invoked from
55 The kernel takes care that only a restricted class of innocuous file system
56 inconsistencies can happen unless hardware or software failures intervene.
57 These are limited to the following:
59 .Bl -item -compact -offset indent
63 Link counts in inodes too large
65 Missing blocks in the free map
67 Blocks in the free map also in files
69 Counts in the super-block wrong
72 These are the only inconsistencies that
78 option) will correct; if it encounters other inconsistencies, it exits
79 with an abnormal return status.
80 For each corrected inconsistency one or more lines will be printed
81 identifying the file system on which the correction will take place,
82 and the nature of the correction.
83 After successfully correcting a file system,
85 will print the number of files on that file system,
86 the number of used and free blocks,
87 and the percentage of fragmentation.
93 will finish the file system checks, then exit with an abnormal return status.
104 a line will be written to the standard error output indicating
105 the name of the device currently being checked, the current phase
106 number and phase-specific progress information.
112 audits and interactively repairs inconsistent conditions for file systems.
113 If the file system is inconsistent the operator is prompted for concurrence
114 before each correction is attempted.
115 It should be noted that some of the corrective actions which are not
116 correctable under the
118 option will result in some loss of data.
119 The amount and severity of data lost may be determined from the diagnostic
121 The default action for each consistency correction
122 is to wait for the operator to respond
126 If the operator does not have write permission on the file system
133 has more consistency checks than
135 .Em check , dcheck , fcheck ,
140 The following flags are interpreted by
142 .Bl -tag -width XBXbyteorderXX -offset indent
144 Interpret the filesystem as an Apple UFS filesystem, even if
145 there is no Apple UFS volume label present.
146 .It Fl B Ar byteorder
147 Convert the file system metadata to
149 byte order if needed.
150 Valid byte orders are
156 is interrupted while swapping the metadata byte order, the file system cannot
159 will print a message in interactive mode if the file system is not in host
164 as the super block for the file system.
165 Block 32 is usually an alternative super block.
167 Convert the FFSv1 file system to the level
169 Note that the level of a file system can only be raised.
170 There are currently five levels defined:
171 .Bl -tag -width 3n -offset indent
173 The file system is in the old (static table) format.
175 The file system is in the new (dynamic table) format.
177 The file system supports 32-bit UIDs and GIDs,
178 short symbolic links are stored in the inode,
179 and directories have an added field showing the file type.
181 If maxcontig is greater than one,
182 build the free segment maps to aid in finding contiguous sets of blocks.
183 If maxcontig is equal to one, delete any existing segment maps.
185 Rearrange the super block to the same layout as FFSv2;
186 disable the rotational layout tables and per cylinder group
192 will list the conversion to be made
193 and ask whether the conversion should be done.
194 If a negative answer is given,
195 no further operations are done on the file system.
197 the conversion is listed and done if
198 possible without user interaction.
199 Conversion in preen mode is best used when all the file systems
200 are being converted at once.
204 can be examined to determine the format of the file system
207 and the file system level
211 Print debugging output.
215 is a file system image, rather than a raw character device.
219 and no attempts will be made to read a disklabel.
221 Force checking of file systems.
222 Normally, if a file system is cleanly unmounted, the kernel will set a
224 in the file system super block, and
226 will not check the file system.
229 to check the file system, regardless of the state of the clean flag.
233 as the permission bits to use when creating the
235 directory rather than the default 1700.
236 In particular, systems that do not wish to have lost files accessible
237 by all users on the system should use a more restrictive
238 set of permissions such as 700.
240 Assume a no response to all questions asked by
244 which is assumed to be affirmative;
245 do not open the file system for writing.
247 Display a progress meter for the file system check.
248 A new meter is displayed for each of the 5 file system check passes, unless
250 is specified, in which case only one meter for overall progress is displayed.
251 Progress meters are disabled if the
257 mode, described above.
258 .It Fl x Ar snap-backup
261 as backup to check a read-write mounted filesystem.
267 The point is to check an internally-consistent version of the
268 filesystem to find out if it is damaged; on failure one should unmount
269 the filesystem and repair it.
271 Resolve user ids to usernames.
275 but uses a file system internal snapshot on the file system to be checked.
277 Assume a yes response to all questions asked by
279 this should be used with great caution as this is a free license
280 to continue after essentially unlimited trouble has been encountered.
283 Inconsistencies checked are as follows:
284 .Bl -enum -offset indent -compact
286 Blocks claimed by more than one inode or the free map.
288 Blocks claimed by an inode outside the range of the file system.
290 Incorrect link counts.
293 .Bl -item -offset indent -compact
295 Directory size not a multiple of DIRBLKSIZ.
297 Partially truncated file.
302 Blocks not accounted for anywhere.
305 .Bl -item -offset indent -compact
307 File pointing to unallocated inode.
309 Inode number out of range.
311 Dot or dot-dot not the first two entries of a directory
312 or having the wrong inode number.
316 .Bl -item -offset indent -compact
318 More blocks for inodes than there are in the file system.
320 Bad free block map format.
322 Total free block and/or free inode count incorrect.
326 Orphaned files and directories (allocated but unreferenced) are,
327 with the operator's concurrence, reconnected by
331 The name assigned is the inode number.
334 directory does not exist, it is created.
335 If there is insufficient space its size is increased.
337 Because of inconsistencies between the block device and the buffer cache,
338 the raw device should always be used.
340 The diagnostics produced by
342 are fully enumerated and explained in Appendix A of
344 .%T "Fsck \- The UNIX File System Check Program"