Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | .\" Copyright (c) 1980, 1989 Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" Redistribution and use in source and binary forms, with or without | |
5 | .\" modification, are permitted provided that the following conditions | |
6 | .\" are met: | |
7 | .\" 1. Redistributions of source code must retain the above copyright | |
8 | .\" notice, this list of conditions and the following disclaimer. | |
9 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
10 | .\" notice, this list of conditions and the following disclaimer in the | |
11 | .\" documentation and/or other materials provided with the distribution. | |
12 | .\" 3. All advertising materials mentioning features or use of this software | |
13 | .\" must display the following acknowledgement: | |
14 | .\" This product includes software developed by the University of | |
15 | .\" California, Berkeley and its contributors. | |
16 | .\" 4. Neither the name of the University nor the names of its contributors | |
17 | .\" may be used to endorse or promote products derived from this software | |
18 | .\" without specific prior written permission. | |
19 | .\" | |
20 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
21 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
24 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | .\" SUCH DAMAGE. | |
31 | .\" | |
32 | .\" @(#)fsck.8 6.9 (Berkeley) 4/20/91 | |
33 | .\" | |
4c30d378 JH |
34 | .\" $Header: /b/source/CVS/src/sbin/fsck/fsck.8,v 1.3 1993/03/23 00:27:48 cgd Exp $ |
35 | .\" | |
15637ed4 RG |
36 | .TH FSCK 8 "April 20, 1991" |
37 | .UC 4 | |
38 | .de us | |
39 | \\$1\l'|0\(ul' | |
40 | .. | |
41 | .SH NAME | |
42 | fsck \- file system consistency check and interactive repair | |
43 | .SH SYNOPSIS | |
44 | .B fsck | |
45 | .B \-p | |
46 | [ | |
47 | .B \-m | |
48 | mode | |
49 | ] | |
50 | .br | |
51 | .B fsck | |
52 | [ | |
53 | .B \-b | |
54 | block# | |
55 | ] [ | |
56 | .B \-c | |
57 | ] [ | |
58 | .B \-y | |
59 | ] [ | |
60 | .B \-n | |
61 | ] [ | |
62 | .B \-m | |
63 | mode | |
64 | ] [ | |
65 | filesystem | |
66 | ] ... | |
67 | .SH DESCRIPTION | |
68 | The first form of | |
69 | .I fsck | |
70 | preens a standard set of filesystems or the specified file systems. | |
71 | It is normally used in the script | |
72 | .B /etc/rc | |
73 | during automatic reboot. | |
74 | Here | |
75 | .I fsck | |
76 | reads the table | |
77 | .B /etc/fstab | |
78 | to determine which file systems to check. | |
79 | Only partitions in fstab that are mounted ``rw,'' ``rq'' or ``ro'' | |
80 | and that have non-zero pass number are checked. | |
81 | Filesystems with pass number 1 (normally just the root filesystem) | |
82 | are checked one at a time. | |
83 | When pass 1 completes, all remaining filesystems are checked, | |
84 | running one process per disk drive. | |
85 | The disk drive containing each filesystem is inferred from the longest prefix | |
86 | of the device name that ends in a digit; the remaining characters are assumed | |
87 | to be the partition designator. | |
88 | .PP | |
89 | The system takes care that only a restricted class of innocuous | |
90 | inconsistencies can happen unless hardware or software failures intervene. | |
91 | These are limited to the following: | |
92 | .IP | |
93 | Unreferenced inodes | |
94 | .ns | |
95 | .IP | |
96 | Link counts in inodes too large | |
97 | .ns | |
98 | .IP | |
99 | Missing blocks in the free map | |
100 | .ns | |
101 | .IP | |
102 | Blocks in the free map also in files | |
103 | .ns | |
104 | .IP | |
105 | Counts in the super-block wrong | |
106 | .PP | |
107 | These are the only inconsistencies that | |
108 | .I fsck | |
109 | with the | |
110 | .B \-p | |
111 | option will correct; if it encounters other inconsistencies, it exits | |
112 | with an abnormal return status and an automatic reboot will then fail. | |
113 | For each corrected inconsistency one or more lines will be printed | |
114 | identifying the file system on which the correction will take place, | |
115 | and the nature of the correction. After successfully correcting a file | |
116 | system, | |
117 | .I fsck | |
118 | will print the number of files on that file system, | |
119 | the number of used and free blocks, | |
120 | and the percentage of fragmentation. | |
121 | .PP | |
122 | If sent a QUIT signal, | |
123 | .I fsck | |
124 | will finish the file system checks, then exit with an abnormal | |
125 | return status that causes an automatic reboot to fail. | |
126 | This is useful when to finish the file system checks during an automatic reboot, | |
127 | but do not want the machine to come up multiuser after the checks complete. | |
128 | .PP | |
129 | Without the | |
130 | .B \-p | |
131 | option, | |
132 | .I fsck | |
133 | audits and interactively repairs inconsistent conditions for file systems. | |
134 | If the file system is inconsistent the operator is prompted for concurrence | |
135 | before each correction is attempted. | |
136 | It should be noted that some of the corrective actions which are not | |
137 | correctable under the | |
138 | .B \-p | |
139 | option will result in some loss of data. | |
140 | The amount and severity of data lost may be determined from the diagnostic | |
141 | output. | |
142 | The default action for each consistency correction | |
143 | is to wait for the operator to respond \fByes\fP or \fBno\fP. | |
144 | If the operator does not have write permission on the file system | |
145 | .I fsck | |
146 | will default to a | |
147 | .BR "\-n " action. | |
148 | .PP | |
149 | .I Fsck | |
150 | has more consistency checks than | |
151 | its predecessors | |
152 | .IR "check, dcheck, fcheck, " "and" " icheck" | |
153 | combined. | |
154 | .PP | |
155 | The following flags are interpreted by | |
156 | .I fsck. | |
157 | .TP 6 | |
158 | .B \-b | |
159 | Use the block specified immediately after the flag as | |
160 | the super block for the file system. Block 32 is usually | |
161 | an alternate super block. | |
162 | .TP 6 | |
163 | .B \-l | |
164 | Limit the number of parallel checks to the number specified in the following | |
165 | argument. | |
166 | By default, the limit is the number of disks, running one process per disk. | |
167 | If a smaller limit is given, the disks are checked round-robin, one filesystem | |
168 | at a time. | |
169 | .TP 6 | |
170 | .B \-m | |
171 | Use the mode specified in octal immediately after the flag as the | |
172 | permission bits to use when creating the lost+found directory | |
173 | rather than the default 1777. | |
174 | In particular, systems that do not wish to have lost files accessible | |
175 | by all users on the system should use a more restrictive | |
176 | set of permissions such as 700. | |
177 | .TP 6 | |
178 | .B \-y | |
179 | Assume a yes response to all questions asked by | |
180 | .IR fsck ; | |
181 | this should be used with great caution as this is a free license | |
182 | to continue after essentially unlimited trouble has been encountered. | |
183 | .TP 6 | |
184 | .B \-n | |
185 | Assume a no response to all questions asked by | |
186 | .I fsck | |
187 | except for ``CONTINUE?'', which is assumed to be affirmative; | |
188 | do not open the file system for writing. | |
189 | .TP 6 | |
190 | .B \-c | |
191 | If the file system is in the old (static table) format, | |
192 | convert it to the new (dynamic table) format. | |
193 | If the file system is in the new format, | |
194 | convert it to the old format provided the old format | |
195 | can support the filesystem configuration. | |
196 | In interactive mode, | |
197 | .I fsck | |
198 | will list the direction the conversion is to be made | |
199 | and ask whether the conversion should be done. | |
200 | If a negative answer is given, | |
201 | no further operations are done on the filesystem. | |
202 | In preen mode, | |
203 | the direction of the conversion is listed and done if | |
204 | possible without user interaction. | |
205 | Conversion in preen mode is best used when all the file systems | |
206 | are being converted at once. | |
207 | The format of a file system can be determined from the | |
208 | first line of output from | |
209 | .IR dumpfs (8). | |
210 | .PP | |
211 | If no filesystems are given to | |
212 | .I fsck | |
213 | then a default list of file systems is read from | |
214 | the file | |
215 | .BR /etc/fstab . | |
216 | .PP | |
217 | .ne 10 | |
218 | Inconsistencies checked are as follows: | |
219 | .TP 6 | |
220 | 1. | |
221 | Blocks claimed by more than one inode or the free map. | |
222 | .br | |
223 | .br | |
224 | .ns | |
225 | .TP 6 | |
226 | 2. | |
227 | Blocks claimed by an inode outside the range of the file system. | |
228 | .br | |
229 | .br | |
230 | .ns | |
231 | .TP 6 | |
232 | 3. | |
233 | Incorrect link counts. | |
234 | .br | |
235 | .br | |
236 | .ns | |
237 | .TP 6 | |
238 | 4. | |
239 | Size checks: | |
240 | .br | |
241 | .ns | |
242 | .IP "" 12 | |
243 | Directory size not of proper format. | |
244 | .br | |
245 | Partially truncated file. | |
246 | .br | |
247 | .br | |
248 | .ns | |
249 | .TP 6 | |
250 | 5. | |
251 | Bad inode format. | |
252 | .br | |
253 | .br | |
254 | .ns | |
255 | .TP 6 | |
256 | 6. | |
257 | Blocks not accounted for anywhere. | |
258 | .br | |
259 | .br | |
260 | .ns | |
261 | .TP 6 | |
262 | 7. | |
263 | Directory checks: | |
264 | .br | |
265 | .br | |
266 | .ns | |
267 | .IP "" 12 | |
268 | File pointing to unallocated inode. | |
269 | .br | |
270 | Inode number out of range. | |
271 | .br | |
272 | Dot or dot-dot not the first two entries of a directory | |
273 | or having the wrong inode number. | |
274 | .br | |
275 | .br | |
276 | .ns | |
277 | .TP 6 | |
278 | 8. | |
279 | Super Block checks: | |
280 | .br | |
281 | .br | |
282 | .ns | |
283 | .IP "" 12 | |
284 | More blocks for inodes than there are in the file system. | |
285 | .br | |
286 | .br | |
287 | .ns | |
288 | .TP 6 | |
289 | 9. | |
290 | Bad free block map format. | |
291 | .br | |
292 | .br | |
293 | .ns | |
294 | .TP 6 | |
295 | 10. | |
296 | Total free block and/or free inode count incorrect. | |
297 | .PP | |
298 | Orphaned files and directories (allocated but unreferenced) are, | |
299 | with the operator's concurrence, reconnected by | |
300 | placing them in the | |
301 | .B lost+found | |
302 | directory. | |
303 | The name assigned is the inode number. | |
304 | If the | |
305 | .I lost+found | |
306 | directory does not exist, it is created. | |
307 | If there is insufficient space its size is increased. | |
308 | .PP | |
309 | Because of inconsistencies between the block device and the buffer cache, | |
310 | the raw device should always be used. | |
311 | .SH FILES | |
312 | .br | |
313 | .ns | |
314 | .TP 21 | |
315 | /etc/fstab | |
316 | contains default list of file systems to check. | |
317 | .SH DIAGNOSTICS | |
318 | The diagnostics produced by | |
319 | .I fsck | |
320 | are fully enumerated and explained in Appendix A of | |
321 | ``Fsck \- The UNIX File System Check Program'' (SMM:5). | |
322 | .SH "SEE ALSO" | |
323 | fstab(5), | |
324 | fs(5), | |
325 | fsdb(8), | |
326 | newfs(8), | |
327 | mkfs(8), | |
328 | reboot(8) |