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