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