]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - sbin/fsck/fsck.8
MFC r368207,368607:
[FreeBSD/stable/10.git] / sbin / fsck / fsck.8
1 .\"     $NetBSD: fsck.8,v 1.19 1999/03/10 00:08:33 erh Exp $
2 .\"
3 .\" Copyright (c) 1996 Christos Zoulas.  All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\"    must display the following acknowledgement:
15 .\"     This product includes software developed by Christos Zoulas.
16 .\" 4. The name of the author may not be used to endorse or promote products
17 .\"    derived from this software without specific prior written permission.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 .\"
30 .\" $FreeBSD$
31 .\"
32 .Dd October 5, 2016
33 .Dt FSCK 8
34 .Os
35 .Sh NAME
36 .Nm fsck
37 .Nd file system consistency check and interactive repair
38 .Sh SYNOPSIS
39 .Nm
40 .Op Fl Cdfnpvy
41 .Op Fl B | F
42 .Op Fl T Ar fstype : Ns Ar fsoptions
43 .Op Fl t Ar fstype
44 .Op Fl c Ar fstab
45 .Oo Ar special | node Oc ...
46 .Sh DESCRIPTION
47 The
48 .Nm
49 utility invokes file system-specific programs to check
50 the special devices listed in the
51 .Xr fstab 5
52 file or in the command line for consistency.
53 .Pp
54 It is normally used in the script
55 .Pa /etc/rc
56 during automatic reboot.
57 Traditionally,
58 .Nm
59 is invoked before the file systems are mounted
60 and all checks are done to completion at that time.
61 If background checking is available,
62 .Nm
63 is invoked twice.
64 It is first invoked at the traditional time,
65 before the file systems are mounted, with the
66 .Fl F
67 flag to do checking on all the file systems
68 that cannot do background checking.
69 It is then invoked a second time,
70 after the system has completed going multiuser, with the
71 .Fl B
72 flag to do checking on all the file systems
73 that can do background checking.
74 Unlike the foreground checking,
75 the background checking is started asynchronously
76 so that other system activity can proceed
77 even on the file systems that are being checked.
78 .Pp
79 If no file systems are specified,
80 .Nm
81 reads the table
82 .Pa /etc/fstab
83 to determine which file systems to check.
84 Only partitions in
85 .Pa /etc/fstab
86 that are mounted
87 .Dq rw ,
88 .Dq rq
89 or
90 .Dq ro
91 and that have non-zero pass number are checked.
92 File systems with pass number 1 (normally just the root file system)
93 are always checked one at a time.
94 .Pp
95 If not in preen mode, the remaining entries are checked in order of
96 increasing pass number one at a time.
97 This is needed when interaction with
98 .Nm
99 is required.
100 .Pp
101 In preen mode, after pass 1 completes, all remaining file systems are checked,
102 in pass number order running one process per disk drive in parallel for each
103 pass number in increasing order.
104 .Pp
105 In other words: In preen mode all pass 1 partitions are checked sequentially.
106 Next all pass 2 partitions are checked in parallel, one process per disk drive.
107 Next all pass 3 partitions are checked in parallel, one process per disk drive.
108 etc.
109 .Pp
110 The disk drive containing each file system is inferred from the shortest prefix
111 of the device name that ends in a digit; the remaining characters are assumed
112 to be the partition and slice designators.
113 .Pp
114 If the
115 .Fl t
116 or
117 .Fl T
118 flags are not specified,
119 .Nm
120 will attempt to determine the file system type and call the
121 appropriated file system check utility.
122 Failure to detect the file system type will cause
123 .Nm
124 to fail with a message that the partition has an unknown file system type.
125 .Pp
126 The options are as follows:
127 .Bl -tag -width indent
128 .It Fl C
129 Check if the
130 .Dq clean
131 flag is set in the superblock and skip file system checks if file system was
132 properly dismounted and marked clean.
133 .It Fl c Ar fstab
134 Specify the
135 .Pa fstab
136 file to use.
137 .It Fl d
138 Debugging mode.
139 Just print the commands without executing them.
140 Available
141 only if
142 .Nm
143 is compiled to support it.
144 .It Fl f
145 Force checking of file systems, even when they are marked clean (for file systems
146 that support this).
147 .It Fl n
148 Causes
149 .Nm
150 to assume no as the answer to all operator questions, except "CONTINUE?".
151 .It Fl p
152 Enter preen mode.
153 In preen mode, only a restricted class of innocuous
154 file system inconsistencies will be corrected.
155 If unexpected inconsistencies caused by hardware or
156 software failures are encountered, the check program
157 will exit with a failure.
158 See the manual pages for the individual check programs
159 for a list of the sorts of failures that they correct
160 when running in preen mode.
161 .It Fl F
162 Run in foreground mode.
163 The check program for each file system is invoked with the
164 .Fl F
165 flag to determine whether it wishes to run as part of
166 the boot up sequence,
167 or if it is able to do its job in background after the
168 system is up and running.
169 A non-zero exit code indicates that it wants to run in foreground
170 and the check program is invoked.
171 A zero exit code indicates that it is able to run later in background
172 and just a deferred message is printed.
173 .It Fl B
174 Run in background mode.
175 The check program for each file system is invoked with the
176 .Fl F
177 flag to determine whether it wishes to run as part of
178 the boot up sequence,
179 or if it is able to do its job in background after the
180 system is up and running.
181 A non-zero exit code indicates that it wanted to run in foreground
182 which is assumed to have been done, so the file system is skipped.
183 A zero exit code indicates that it is able to run in background
184 so the check program is invoked with the
185 .Fl B
186 flag to indicate that a check on the active file system should be done.
187 When running in background mode,
188 only one file system at a time will be checked.
189 Note that background
190 .Nm
191 is limited to checking for only the most commonly occurring
192 file system abnormalities.
193 Under certain circumstances,
194 some errors can escape background
195 .Nm .
196 It is recommended that you perform foreground
197 .Nm
198 on your systems periodically and whenever you encounter
199 file-system\-related panics.
200 .It Fl t Ar fstype
201 Invoke
202 .Nm
203 only for the comma separated list of file system types.
204 If the
205 list starts with
206 .Dq no
207 then invoke
208 .Nm
209 for the file system types that are not specified in the list.
210 .It Fl v
211 Print the commands before executing them.
212 .It Fl y
213 Causes
214 .Nm
215 to assume yes
216 as the answer to all operator questions.
217 .It Fl T Ar fstype : Ns Ar fsoptions
218 List of comma separated file system specific options for the specified
219 file system type, in the same format as
220 .Xr mount 8 .
221 .El
222 .Sh FILES
223 .Bl -tag -width /etc/fstab -compact
224 .It Pa /etc/fstab
225 file system table
226 .El
227 .Sh SEE ALSO
228 .Xr fstab 5 ,
229 .Xr fsck_ffs 8 ,
230 .Xr fsck_msdosfs 8 ,
231 .Xr mount 8
232 .Sh HISTORY
233 A
234 .Nm
235 utility appeared in
236 .Bx 4.0 .
237 It was reimplemented as a filesystem independent wrapper in
238 .Nx 1.3
239 and first appeared in
240 .Fx 5.0 .
241 The original filesystem specific utility became
242 .Xr fsck_ffs 8
243 at this point.