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