Commit | Line | Data |
---|---|---|
2d5205c6 KM |
1 | .\" Copyright (c) 1980 Regents of the University of California. |
2 | .\" All rights reserved. The Berkeley software License Agreement | |
3 | .\" specifies the terms and conditions for redistribution. | |
4 | .\" | |
5 | .\" @(#)fsck.8 4.1 (Berkeley) %G% | |
6 | .\" | |
7 | .TH FSCK 8 "4/1/81" | |
8 | .UC 4 | |
9 | .de us | |
10 | \\$1\l'|0\(ul' | |
11 | .. | |
12 | .SH NAME | |
13 | fsck \- file system consistency check and interactive repair | |
14 | .SH SYNOPSIS | |
15 | .B /etc/fsck | |
16 | .B \-p | |
17 | [ | |
18 | filesystem ... | |
19 | ] | |
20 | .br | |
21 | .B /etc/fsck | |
22 | [ | |
23 | .B \-y | |
24 | ] [ | |
25 | .B \-n | |
26 | ] [ | |
27 | .BR \-s X | |
28 | ] [ | |
29 | .BR \-S X | |
30 | ] [ | |
31 | .B \-t | |
32 | filename | |
33 | ] [ | |
34 | filesystem | |
35 | ] ... | |
36 | .SH DESCRIPTION | |
37 | The first form of | |
38 | .I fsck | |
39 | preens a standard set of filesystems or the specified file systems. | |
40 | It is normally used in the script | |
41 | .B /etc/rc | |
42 | during automatic reboot. | |
43 | In this case | |
44 | .I fsck | |
45 | reads the table | |
46 | .B /etc/fstab | |
47 | to determine which file systems to check. | |
48 | It uses the information there to inspect groups of disks in parallel taking | |
49 | maximum advantage of i/o overlap to check the file systems | |
50 | as quickly as possible. | |
51 | Normally, the root file system will be checked on pass 1, other | |
52 | ``root'' (``a'' partition) file systems on pass 2, other | |
53 | small file systems on separate passes (e.g. the ``d'' file systems | |
54 | on pass 3 and the ``e'' file systems on pass 4), and finally | |
55 | the large user file systems on the last pass, e.g. pass 5. | |
56 | A pass number of 0 in fstab causes a disk to not be checked; similarly | |
57 | partitions which are not shown as to be mounted ``rw'' or ``ro'' | |
58 | are not checked. | |
59 | .PP | |
60 | The system takes care that only a restricted class of innocuous | |
61 | inconsistencies can happen unless hardware or software failures intervene. | |
62 | These are limited to the following: | |
63 | .IP | |
64 | Unreferenced inodes | |
65 | .ns | |
66 | .IP | |
67 | Link counts in inodes too large | |
68 | .ns | |
69 | .IP | |
70 | Missing blocks in the free list | |
71 | .ns | |
72 | .IP | |
73 | Blocks in the free list also in files | |
74 | .ns | |
75 | .IP | |
76 | Counts in the super-block wrong | |
77 | .PP | |
78 | These are the only inconsistencies which | |
79 | .I fsck | |
80 | with the | |
81 | .B \-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. After successfully correcting a file | |
87 | system, | |
88 | .I fsck | |
89 | will print the number of files on that file system and the number of | |
90 | used and free blocks. | |
91 | .PP | |
92 | Without the | |
93 | .B \-p | |
94 | option, | |
95 | .I fsck | |
96 | audits and interactively repairs inconsistent conditions for file systems. | |
97 | If the file system is inconsistent the operator is prompted for concurrence | |
98 | before each correction is attempted. | |
99 | It should be noted that a number of the corrective actions which are not | |
100 | fixable under the | |
101 | .B \-p | |
102 | option will result in some loss | |
103 | of data. | |
104 | The amount and severity of data lost may be determined from the diagnostic | |
105 | output. | |
106 | The default action for each consistency correction | |
107 | is to wait for the operator to respond \fByes\fP or \fBno\fP. | |
108 | If the operator does not have write permission | |
109 | .I fsck | |
110 | will default to a | |
111 | .BR "\-n " action. | |
112 | .PP | |
113 | .I Fsck | |
114 | has more consistency checks than | |
115 | its predecessors | |
116 | .IR "check, dcheck, fcheck, " "and" " icheck" | |
117 | combined. | |
118 | .PP | |
119 | The following flags are interpreted by | |
120 | .I fsck. | |
121 | .TP 6 | |
122 | .B \-y | |
123 | Assume a yes response to all questions asked by | |
124 | .I fsck; | |
125 | this should be used with great caution as this is a free license | |
126 | to continue after essentially unlimited trouble has been encountered. | |
127 | .TP 6 | |
128 | .B \-n | |
129 | Assume a no response to all questions asked by | |
130 | .I fsck; | |
131 | do not open the file system for writing. | |
132 | .TP 6 | |
133 | .BR \-s \fIX | |
134 | Ignore the actual free list and (unconditionally) reconstruct a new | |
135 | one by rewriting the super-block of the file system. | |
136 | The file system should be unmounted while this is done; if this | |
137 | is not possible, care should be taken that the system is quiescent | |
138 | and that it is rebooted immediately afterwards. | |
139 | This precaution is necessary so that the old, bad, in-core copy | |
140 | of the superblock will not continue to be used, or written on the file system. | |
141 | .IP | |
142 | The | |
143 | .BR \-s \fIX | |
144 | option allows for creating an optimal free-list organization. | |
145 | The following forms of | |
146 | .I X | |
147 | are supported for the following devices: | |
148 | .sp | |
149 | .nf | |
150 | \-s3 (RP03) | |
151 | \-s4 (RP04, RP05, RP06) | |
152 | \-sBlocks-per-cylinder\fB:\fRBlocks-to-skip (for anything else) | |
153 | .fi | |
154 | .IP "" 6 | |
155 | If | |
156 | .I X | |
157 | is not given, | |
158 | the values used when the filesystem was created | |
159 | are used. | |
160 | If these values were not specified, then the value | |
161 | .I 400:9 | |
162 | is used. | |
163 | .TP 6 | |
164 | .BR \-S \fIX | |
165 | Conditionally reconstruct the free list. This option | |
166 | is like | |
167 | .BR \-s \fIX | |
168 | above except that the free list is rebuilt only | |
169 | if there were no discrepancies discovered in the | |
170 | file system. Using | |
171 | .B \-S | |
172 | will force a no response to all questions asked | |
173 | by | |
174 | .I fsck. | |
175 | This option is useful for forcing free list reorganization | |
176 | on uncontaminated file systems. | |
177 | .TP 6 | |
178 | .B \-t | |
179 | If | |
180 | .I fsck | |
181 | cannot obtain enough memory to keep its tables, | |
182 | it uses a scratch file. If the \f3\-t\fP option is | |
183 | specified, the file named in the next argument | |
184 | is used as the scratch file, if needed. Without the | |
185 | .BR "\-t " flag, | |
186 | .I fsck | |
187 | will prompt the operator for the name of the | |
188 | scratch file. The file chosen should not be on the | |
189 | filesystem being checked, and if it is not | |
190 | a special file or did not already exist, it is | |
191 | removed when | |
192 | .I fsck | |
193 | completes. | |
194 | .PP | |
195 | If no filesystems are given to | |
196 | .I fsck | |
197 | then a default list of file systems is read from | |
198 | the file | |
199 | .BR /etc/fstab . | |
200 | .PP | |
201 | .ne 10 | |
202 | Inconsistencies checked are as follows: | |
203 | .TP 6 | |
204 | 1. | |
205 | Blocks claimed by more than one inode or the free list. | |
206 | .br | |
207 | .br | |
208 | .ns | |
209 | .TP 6 | |
210 | 2. | |
211 | Blocks claimed by an inode or the free list outside the range of the file system. | |
212 | .br | |
213 | .br | |
214 | .ns | |
215 | .TP 6 | |
216 | 3. | |
217 | Incorrect link counts. | |
218 | .br | |
219 | .br | |
220 | .ns | |
221 | .TP 6 | |
222 | 4. | |
223 | Size checks: | |
224 | .br | |
225 | .ns | |
226 | .IP "" 12 | |
227 | Directory size not 16-byte aligned. | |
228 | .br | |
229 | .br | |
230 | .ns | |
231 | .TP 6 | |
232 | 5. | |
233 | Bad inode format. | |
234 | .br | |
235 | .br | |
236 | .ns | |
237 | .TP 6 | |
238 | 6. | |
239 | Blocks not accounted for anywhere. | |
240 | .br | |
241 | .br | |
242 | .ns | |
243 | .TP 6 | |
244 | 7. | |
245 | Directory checks: | |
246 | .br | |
247 | .br | |
248 | .ns | |
249 | .IP "" 12 | |
250 | File pointing to unallocated inode. | |
251 | .br | |
252 | Inode number out of range. | |
253 | .br | |
254 | .br | |
255 | .ns | |
256 | .TP 6 | |
257 | 8. | |
258 | Super Block checks: | |
259 | .br | |
260 | .br | |
261 | .ns | |
262 | .IP "" 12 | |
263 | More than 65536 inodes. | |
264 | .br | |
265 | More blocks for inodes than there are in the file system. | |
266 | .br | |
267 | .br | |
268 | .ns | |
269 | .TP 6 | |
270 | 9. | |
271 | Bad free block list format. | |
272 | .br | |
273 | .br | |
274 | .ns | |
275 | .TP 6 | |
276 | 10. | |
277 | Total free block and/or free inode count incorrect. | |
278 | .PP | |
279 | Orphaned files and directories (allocated but unreferenced) are, | |
280 | with the operator's concurrence, reconnected by | |
281 | placing them in the | |
282 | .B lost+found | |
283 | directory. | |
284 | The name assigned is the inode number. The only restriction | |
285 | is that the directory | |
286 | .B lost+found | |
287 | must preexist | |
288 | in the root of the filesystem being checked and | |
289 | must have empty slots in which entries can be made. | |
290 | This is accomplished by making | |
291 | .BR lost+found , | |
292 | copying a number of files to the directory, and then removing them | |
293 | (before | |
294 | .I | |
295 | fsck | |
296 | is executed). | |
297 | .PP | |
298 | Checking the raw device is almost always faster. | |
299 | .SH FILES | |
300 | .br | |
301 | .ns | |
302 | .TP 21 | |
303 | /etc/fstab | |
304 | contains default list of file systems to check. | |
305 | .SH DIAGNOSTICS | |
306 | The diagnostics produced by | |
307 | .I fsck | |
308 | are intended to be self-explanatory. | |
309 | .SH "SEE ALSO" | |
310 | fstab(5), fs(5), crash(8), reboot(8) | |
311 | .SH BUGS | |
312 | Inode numbers for | |
313 | .BR . "" | |
314 | and | |
315 | .BR .. "" | |
316 | in each directory should be checked for validity. | |
317 | .PP | |
318 | \f3\-g\fP and \f3\-b\fP options from | |
319 | .I check | |
320 | should be available in | |
321 | .I fsck. | |
322 | .PP | |
323 | There should be some way to start a \fBfsck \-p\fR at pass \fIn\fR. |