2 .\" Copyright (c) 1980, 1989, 1991, 1993
3 .\" The Regents of the University of California. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
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. 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.
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
29 .\" @(#)fsck.8 8.4 (Berkeley) 5/9/95
30 .\" $FreeBSD: src/sbin/fsck/fsck.8,v 1.14.2.3 2001/01/23 23:11:07 iedowse Exp $
32 .Dd September 29, 2016
37 .Nd UFS filesystem consistency check and interactive repair
49 .Op Fl l Ar maxparallel
56 preens a standard set of filesystems or the specified filesystems.
57 It is normally used in the script
59 during automatic reboot.
64 to determine which filesystems to check.
65 Only partitions in fstab that are mounted ``rw,'' ``rq'' or ``ro''
66 and that have non-zero pass number are checked.
67 Filesystems with pass number 1 (normally just the root filesystem)
68 are checked one at a time.
69 When pass 1 completes, all remaining filesystems are checked,
70 running one process per disk drive.
71 The disk drive containing each filesystem is inferred from the longest prefix
72 of the device name that ends in a digit; the remaining characters are assumed
73 to be the partition designator.
75 In "preen" mode the clean flag of each filesystem's superblock is examined
76 and only those filesystems that
77 are not marked clean are checked.
78 Filesystems are marked clean when they are unmounted,
79 when they have been mounted read-only, or when
81 runs on them successfully.
84 option is specified, the filesystems
85 will be checked regardless of the state of their clean flag.
87 The kernel takes care that only a restricted class of innocuous filesystem
88 inconsistencies can happen unless hardware or software failures intervene.
89 These are limited to the following:
91 .Bl -item -compact -offset indent
95 Link counts in inodes too large
97 Missing blocks in the free map
99 Blocks in the free map also in files
101 Counts in the super-block wrong
104 These are the only inconsistencies that
108 option will correct; if it encounters other inconsistencies, it exits
109 with an abnormal return status and an automatic reboot will then fail.
110 For each corrected inconsistency one or more lines will be printed
111 identifying the filesystem on which the correction will take place,
112 and the nature of the correction. After successfully correcting a filesystem,
114 will print the number of files on that filesystem,
115 the number of used and free blocks,
116 and the percentage of fragmentation.
122 will finish the filesystem checks, then exit with an abnormal
123 return status that causes an automatic reboot to fail.
124 This is useful when you want to finish the filesystem checks during an
126 but do not want the machine to come up multiuser after the checks complete.
136 signal, a line will be written to the standard output indicating
137 the name of the device currently being checked, the current phase
138 number and phase-specific progress information.
144 audits and interactively repairs inconsistent conditions for filesystems.
145 If the filesystem is inconsistent the operator is prompted for concurrence
146 before each correction is attempted.
147 It should be noted that some of the corrective actions which are not
148 correctable under the
150 option will result in some loss of data.
151 The amount and severity of data lost may be determined from the diagnostic
153 The default action for each consistency correction
154 is to wait for the operator to respond
158 If the operator does not have write permission on the filesystem
165 has more consistency checks than
167 .Em check , dcheck , fcheck ,
172 The following flags are interpreted by
174 .Bl -tag -width indent
176 Use the block specified immediately after the flag as
177 the super block for the filesystem. Block 32 is usually
178 an alternate super block.
180 Convert the filesystem to the specified level.
181 Note that the level of a filesystem can only be raised.
183 There are currently four levels defined:
184 .Bl -tag -width indent
186 The filesystem is in the old (static table) format.
188 The filesystem is in the new (dynamic table) format.
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.
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.
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.
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
218 filesystems when preening.
220 Limit the number of parallel checks to the number specified in the following
222 By default, the limit is the number of disks, running one process per disk.
223 If a smaller limit is given, the disks are checked round-robin, one filesystem
226 Just print the "last mounted on" information and exit, do no other checking.
228 Use the mode specified in octal immediately after the flag as the
229 permission bits to use when creating the
231 directory rather than the default 1777.
232 In particular, systems that do not wish to have lost files accessible
233 by all users on the system should use a more restrictive
234 set of permissions such as 700.
236 Assume a no response to all questions asked by
240 which is assumed to be affirmative;
241 do not open the filesystem for writing.
243 Preen filesystems (see above).
245 Assume a yes response to all questions asked by
247 this should be used with great caution as this is a free license
248 to continue after essentially unlimited trouble has been encountered.
251 If no filesystems are given to
253 then a default list of filesystems is read from
257 Inconsistencies checked are as follows:
260 Blocks claimed by more than one inode or the free map.
262 Blocks claimed by an inode outside the range of the filesystem.
264 Incorrect link counts.
267 .Bl -item -offset indent -compact
269 Directory size not a multiple of DIRBLKSIZ.
271 Partially truncated file.
276 Blocks not accounted for anywhere.
279 .Bl -item -offset indent -compact
281 File pointing to unallocated inode.
283 Inode number out of range.
285 Directories with unallocated blocks (holes).
287 Dot or dot-dot not the first two entries of a directory
288 or having the wrong inode number.
292 .Bl -item -offset indent -compact
294 More blocks for inodes than there are in the filesystem.
296 Bad free block map format.
298 Total free block and/or free inode count incorrect.
302 Orphaned files and directories (allocated but unreferenced) are,
303 with the operator's concurrence, reconnected by
307 The name assigned is the inode number.
310 directory does not exist, it is created.
311 If there is insufficient space its size is increased.
313 Because of inconsistencies between the block device and the buffer cache,
314 the raw device should always be used.
316 .Bl -tag -width /etc/fstab -compact
318 contains default list of filesystems to check.
321 The diagnostics produced by
323 are fully enumerated and explained in Appendix A of
325 .%T "Fsck \- The UNIX File System Check Program"