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 | .\" | |
96cc60b3 | 5 | .\" @(#)fsck.8 6.1 (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 | |
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 | ] [ | |
2d5205c6 KM |
26 | .B \-y |
27 | ] [ | |
28 | .B \-n | |
29 | ] [ | |
2d5205c6 KM |
30 | filesystem |
31 | ] ... | |
32 | .SH DESCRIPTION | |
33 | The first form of | |
34 | .I fsck | |
35 | preens a standard set of filesystems or the specified file systems. | |
36 | It is normally used in the script | |
37 | .B /etc/rc | |
38 | during automatic reboot. | |
39 | In this case | |
40 | .I fsck | |
41 | reads the table | |
42 | .B /etc/fstab | |
43 | to determine which file systems to check. | |
44 | It uses the information there to inspect groups of disks in parallel taking | |
45 | maximum advantage of i/o overlap to check the file systems | |
46 | as quickly as possible. | |
47 | Normally, the root file system will be checked on pass 1, other | |
48 | ``root'' (``a'' partition) file systems on pass 2, other | |
49 | small file systems on separate passes (e.g. the ``d'' file systems | |
50 | on pass 3 and the ``e'' file systems on pass 4), and finally | |
51 | the large user file systems on the last pass, e.g. pass 5. | |
52 | A pass number of 0 in fstab causes a disk to not be checked; similarly | |
53 | partitions which are not shown as to be mounted ``rw'' or ``ro'' | |
54 | are not checked. | |
55 | .PP | |
56 | The system takes care that only a restricted class of innocuous | |
57 | inconsistencies can happen unless hardware or software failures intervene. | |
58 | These are limited to the following: | |
59 | .IP | |
60 | Unreferenced inodes | |
61 | .ns | |
62 | .IP | |
63 | Link counts in inodes too large | |
64 | .ns | |
65 | .IP | |
66 | Missing blocks in the free list | |
67 | .ns | |
68 | .IP | |
69 | Blocks in the free list also in files | |
70 | .ns | |
71 | .IP | |
72 | Counts in the super-block wrong | |
73 | .PP | |
74 | These are the only inconsistencies which | |
75 | .I fsck | |
76 | with the | |
77 | .B \-p | |
78 | option will correct; if it encounters other inconsistencies, it exits | |
79 | with an abnormal return status and an automatic reboot will then fail. | |
80 | For each corrected inconsistency one or more lines will be printed | |
81 | identifying the file system on which the correction will take place, | |
82 | and the nature of the correction. After successfully correcting a file | |
83 | system, | |
84 | .I fsck | |
85 | will print the number of files on that file system and the number of | |
86 | used and free blocks. | |
87 | .PP | |
88 | Without the | |
89 | .B \-p | |
90 | option, | |
91 | .I fsck | |
92 | audits and interactively repairs inconsistent conditions for file systems. | |
93 | If the file system is inconsistent the operator is prompted for concurrence | |
94 | before each correction is attempted. | |
95 | It should be noted that a number of the corrective actions which are not | |
96 | fixable under the | |
97 | .B \-p | |
98 | option will result in some loss | |
99 | of data. | |
100 | The amount and severity of data lost may be determined from the diagnostic | |
101 | output. | |
102 | The default action for each consistency correction | |
103 | is to wait for the operator to respond \fByes\fP or \fBno\fP. | |
104 | If the operator does not have write permission | |
105 | .I fsck | |
106 | will default to a | |
107 | .BR "\-n " action. | |
108 | .PP | |
109 | .I Fsck | |
110 | has more consistency checks than | |
111 | its predecessors | |
112 | .IR "check, dcheck, fcheck, " "and" " icheck" | |
113 | combined. | |
114 | .PP | |
115 | The following flags are interpreted by | |
116 | .I fsck. | |
117 | .TP 6 | |
0e46db50 KM |
118 | .B \-b |
119 | Use the block specified immediately after the flag as | |
120 | the super block for the file system. Block 32 is always | |
121 | an alternate super block. | |
122 | .TP 6 | |
2d5205c6 KM |
123 | .B \-y |
124 | Assume a yes response to all questions asked by | |
125 | .I fsck; | |
126 | this should be used with great caution as this is a free license | |
127 | to continue after essentially unlimited trouble has been encountered. | |
128 | .TP 6 | |
129 | .B \-n | |
130 | Assume a no response to all questions asked by | |
131 | .I fsck; | |
132 | do not open the file system for writing. | |
2d5205c6 KM |
133 | .PP |
134 | If no filesystems are given to | |
135 | .I fsck | |
136 | then a default list of file systems is read from | |
137 | the file | |
138 | .BR /etc/fstab . | |
139 | .PP | |
140 | .ne 10 | |
141 | Inconsistencies checked are as follows: | |
142 | .TP 6 | |
143 | 1. | |
144 | Blocks claimed by more than one inode or the free list. | |
145 | .br | |
146 | .br | |
147 | .ns | |
148 | .TP 6 | |
149 | 2. | |
150 | Blocks claimed by an inode or the free list outside the range of the file system. | |
151 | .br | |
152 | .br | |
153 | .ns | |
154 | .TP 6 | |
155 | 3. | |
156 | Incorrect link counts. | |
157 | .br | |
158 | .br | |
159 | .ns | |
160 | .TP 6 | |
161 | 4. | |
162 | Size checks: | |
163 | .br | |
164 | .ns | |
165 | .IP "" 12 | |
0e46db50 | 166 | Directory size not of proper format. |
2d5205c6 KM |
167 | .br |
168 | .br | |
169 | .ns | |
170 | .TP 6 | |
171 | 5. | |
172 | Bad inode format. | |
173 | .br | |
174 | .br | |
175 | .ns | |
176 | .TP 6 | |
177 | 6. | |
178 | Blocks not accounted for anywhere. | |
179 | .br | |
180 | .br | |
181 | .ns | |
182 | .TP 6 | |
183 | 7. | |
184 | Directory checks: | |
185 | .br | |
186 | .br | |
187 | .ns | |
188 | .IP "" 12 | |
189 | File pointing to unallocated inode. | |
190 | .br | |
191 | Inode number out of range. | |
192 | .br | |
193 | .br | |
194 | .ns | |
195 | .TP 6 | |
196 | 8. | |
197 | Super Block checks: | |
198 | .br | |
199 | .br | |
200 | .ns | |
201 | .IP "" 12 | |
2d5205c6 KM |
202 | .br |
203 | More blocks for inodes than there are in the file system. | |
204 | .br | |
205 | .br | |
206 | .ns | |
207 | .TP 6 | |
208 | 9. | |
209 | Bad free block list format. | |
210 | .br | |
211 | .br | |
212 | .ns | |
213 | .TP 6 | |
214 | 10. | |
215 | Total free block and/or free inode count incorrect. | |
216 | .PP | |
217 | Orphaned files and directories (allocated but unreferenced) are, | |
218 | with the operator's concurrence, reconnected by | |
219 | placing them in the | |
220 | .B lost+found | |
221 | directory. | |
222 | The name assigned is the inode number. The only restriction | |
223 | is that the directory | |
224 | .B lost+found | |
225 | must preexist | |
226 | in the root of the filesystem being checked and | |
227 | must have empty slots in which entries can be made. | |
228 | This is accomplished by making | |
229 | .BR lost+found , | |
230 | copying a number of files to the directory, and then removing them | |
231 | (before | |
232 | .I | |
233 | fsck | |
234 | is executed). | |
235 | .PP | |
236 | Checking the raw device is almost always faster. | |
237 | .SH FILES | |
238 | .br | |
239 | .ns | |
240 | .TP 21 | |
241 | /etc/fstab | |
242 | contains default list of file systems to check. | |
243 | .SH DIAGNOSTICS | |
244 | The diagnostics produced by | |
245 | .I fsck | |
246 | are intended to be self-explanatory. | |
247 | .SH "SEE ALSO" | |
0e46db50 KM |
248 | fstab(5), |
249 | fs(5), | |
250 | newfs(8), | |
251 | mkfs(8), | |
252 | crash(8V), | |
253 | reboot(8) | |
2d5205c6 KM |
254 | .SH BUGS |
255 | Inode numbers for | |
256 | .BR . "" | |
257 | and | |
258 | .BR .. "" | |
259 | in each directory should be checked for validity. | |
260 | .PP | |
2d5205c6 | 261 | There should be some way to start a \fBfsck \-p\fR at pass \fIn\fR. |