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 | .\" | |
ca67e7b4 | 5 | .\" @(#)fsck.8 6.4 (Berkeley) 5/5/88 |
2d5205c6 | 6 | .\" |
ca67e7b4 | 7 | .TH FSCK 8 "May 5, 1988" |
2d5205c6 KM |
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 | [ | |
0e46db50 KM |
23 | .B \-b |
24 | block# | |
25 | ] [ | |
6209594a KM |
26 | .B \-c |
27 | ] [ | |
2d5205c6 KM |
28 | .B \-y |
29 | ] [ | |
30 | .B \-n | |
31 | ] [ | |
2d5205c6 KM |
32 | filesystem |
33 | ] ... | |
34 | .SH DESCRIPTION | |
35 | The first form of | |
36 | .I fsck | |
37 | preens a standard set of filesystems or the specified file systems. | |
38 | It is normally used in the script | |
39 | .B /etc/rc | |
40 | during automatic reboot. | |
41 | In this case | |
42 | .I fsck | |
43 | reads the table | |
44 | .B /etc/fstab | |
45 | to determine which file systems to check. | |
46 | It uses the information there to inspect groups of disks in parallel taking | |
47 | maximum advantage of i/o overlap to check the file systems | |
48 | as quickly as possible. | |
49 | Normally, the root file system will be checked on pass 1, other | |
50 | ``root'' (``a'' partition) file systems on pass 2, other | |
51 | small file systems on separate passes (e.g. the ``d'' file systems | |
52 | on pass 3 and the ``e'' file systems on pass 4), and finally | |
53 | the large user file systems on the last pass, e.g. pass 5. | |
c27eea89 KM |
54 | Only partitions in fstab that are mounted ``rw'' or ``rq'' |
55 | and that have non-zero pass number are checked. | |
2d5205c6 KM |
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 | |
6209594a | 67 | Missing blocks in the free map |
2d5205c6 KM |
68 | .ns |
69 | .IP | |
6209594a | 70 | Blocks in the free map also in files |
2d5205c6 KM |
71 | .ns |
72 | .IP | |
73 | Counts in the super-block wrong | |
74 | .PP | |
c27eea89 | 75 | These are the only inconsistencies that |
2d5205c6 KM |
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 | |
c27eea89 KM |
86 | will print the number of files on that file system, |
87 | the number of used and free blocks, | |
88 | and the percentage of fragmentation. | |
89 | .PP | |
90 | If sent a QUIT signal, | |
91 | .I fsck | |
92 | will finish the file system checks, then exit with an abnormal | |
93 | return status that causes the automatic reboot to fail. | |
94 | This is useful when you wish to finish the file system checks, | |
95 | but do not want the machine to come up multiuser. | |
2d5205c6 KM |
96 | .PP |
97 | Without the | |
98 | .B \-p | |
99 | option, | |
100 | .I fsck | |
101 | audits and interactively repairs inconsistent conditions for file systems. | |
102 | If the file system is inconsistent the operator is prompted for concurrence | |
103 | before each correction is attempted. | |
c27eea89 KM |
104 | It should be noted that some of the corrective actions which are not |
105 | correctable under the | |
2d5205c6 | 106 | .B \-p |
c27eea89 | 107 | option will result in some loss of data. |
2d5205c6 KM |
108 | The amount and severity of data lost may be determined from the diagnostic |
109 | output. | |
110 | The default action for each consistency correction | |
111 | is to wait for the operator to respond \fByes\fP or \fBno\fP. | |
c27eea89 | 112 | If the operator does not have write permission on the file system |
2d5205c6 KM |
113 | .I fsck |
114 | will default to a | |
115 | .BR "\-n " action. | |
116 | .PP | |
117 | .I Fsck | |
118 | has more consistency checks than | |
119 | its predecessors | |
120 | .IR "check, dcheck, fcheck, " "and" " icheck" | |
121 | combined. | |
122 | .PP | |
123 | The following flags are interpreted by | |
124 | .I fsck. | |
125 | .TP 6 | |
0e46db50 KM |
126 | .B \-b |
127 | Use the block specified immediately after the flag as | |
6209594a | 128 | the super block for the file system. Block 32 is usually |
0e46db50 KM |
129 | an alternate super block. |
130 | .TP 6 | |
2d5205c6 KM |
131 | .B \-y |
132 | Assume a yes response to all questions asked by | |
133 | .I fsck; | |
134 | this should be used with great caution as this is a free license | |
135 | to continue after essentially unlimited trouble has been encountered. | |
136 | .TP 6 | |
137 | .B \-n | |
138 | Assume a no response to all questions asked by | |
139 | .I fsck; | |
140 | do not open the file system for writing. | |
6209594a KM |
141 | .TP 6 |
142 | .B \-c | |
143 | If the file system is in the old (static table) format, | |
144 | convert it to the new (dynamic table) format. | |
145 | If the file system is in the new format, | |
146 | convert it to the old format provided the old format | |
147 | can support the filesystem configuration. | |
148 | In interactive mode, | |
149 | .I fsck | |
150 | will list the direction the conversion is to be made | |
151 | and ask whether the conversion should be done. | |
152 | If a negative answer is given, | |
153 | no further operations are done on the filesystem. | |
154 | In preen mode, | |
155 | the direction of the conversion is listed and done if | |
156 | possible without user interaction. | |
157 | Conversion in preen mode is best used when all the file systems | |
158 | are being converted at once. | |
159 | The format of a file system can be determined from the | |
160 | first line of output from | |
161 | .IR dumpfs (8). | |
2d5205c6 KM |
162 | .PP |
163 | If no filesystems are given to | |
164 | .I fsck | |
165 | then a default list of file systems is read from | |
166 | the file | |
167 | .BR /etc/fstab . | |
168 | .PP | |
169 | .ne 10 | |
170 | Inconsistencies checked are as follows: | |
171 | .TP 6 | |
172 | 1. | |
6209594a | 173 | Blocks claimed by more than one inode or the free map. |
2d5205c6 KM |
174 | .br |
175 | .br | |
176 | .ns | |
177 | .TP 6 | |
178 | 2. | |
6209594a | 179 | Blocks claimed by an inode outside the range of the file system. |
2d5205c6 KM |
180 | .br |
181 | .br | |
182 | .ns | |
183 | .TP 6 | |
184 | 3. | |
185 | Incorrect link counts. | |
186 | .br | |
187 | .br | |
188 | .ns | |
189 | .TP 6 | |
190 | 4. | |
191 | Size checks: | |
192 | .br | |
193 | .ns | |
194 | .IP "" 12 | |
0e46db50 | 195 | Directory size not of proper format. |
2d5205c6 | 196 | .br |
6209594a KM |
197 | Partially truncated file. |
198 | .br | |
2d5205c6 KM |
199 | .br |
200 | .ns | |
201 | .TP 6 | |
202 | 5. | |
203 | Bad inode format. | |
204 | .br | |
205 | .br | |
206 | .ns | |
207 | .TP 6 | |
208 | 6. | |
209 | Blocks not accounted for anywhere. | |
210 | .br | |
211 | .br | |
212 | .ns | |
213 | .TP 6 | |
214 | 7. | |
215 | Directory checks: | |
216 | .br | |
217 | .br | |
218 | .ns | |
219 | .IP "" 12 | |
220 | File pointing to unallocated inode. | |
221 | .br | |
222 | Inode number out of range. | |
223 | .br | |
224 | .br | |
225 | .ns | |
226 | .TP 6 | |
227 | 8. | |
228 | Super Block checks: | |
229 | .br | |
230 | .br | |
231 | .ns | |
232 | .IP "" 12 | |
2d5205c6 KM |
233 | More blocks for inodes than there are in the file system. |
234 | .br | |
235 | .br | |
236 | .ns | |
237 | .TP 6 | |
238 | 9. | |
6209594a | 239 | Bad free block map format. |
2d5205c6 KM |
240 | .br |
241 | .br | |
242 | .ns | |
243 | .TP 6 | |
244 | 10. | |
245 | Total free block and/or free inode count incorrect. | |
246 | .PP | |
247 | Orphaned files and directories (allocated but unreferenced) are, | |
248 | with the operator's concurrence, reconnected by | |
249 | placing them in the | |
250 | .B lost+found | |
251 | directory. | |
c27eea89 KM |
252 | The name assigned is the inode number. |
253 | If the | |
254 | .I lost+found | |
255 | directory does not exist, it is created. | |
256 | If there is insufficient space its size is increased. | |
2d5205c6 KM |
257 | .PP |
258 | Checking the raw device is almost always faster. | |
259 | .SH FILES | |
260 | .br | |
261 | .ns | |
262 | .TP 21 | |
263 | /etc/fstab | |
264 | contains default list of file systems to check. | |
265 | .SH DIAGNOSTICS | |
266 | The diagnostics produced by | |
267 | .I fsck | |
c27eea89 KM |
268 | are fully enumerated and explained in Appendix A of |
269 | ``Fsck \- The UNIX File System Check Program'' (SMM:5). | |
2d5205c6 | 270 | .SH "SEE ALSO" |
0e46db50 KM |
271 | fstab(5), |
272 | fs(5), | |
8ad6dcc6 | 273 | fsdb(8), |
0e46db50 KM |
274 | newfs(8), |
275 | mkfs(8), | |
276 | crash(8V), | |
277 | reboot(8) | |
2d5205c6 | 278 | .SH BUGS |
2d5205c6 | 279 | There should be some way to start a \fBfsck \-p\fR at pass \fIn\fR. |