]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/fsck/fsck.8
ifconfig: fix 'ifconfig -l ether'
[FreeBSD/FreeBSD.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 .Dd March 5, 2019
31 .Dt FSCK 8
32 .Os
33 .Sh NAME
34 .Nm fsck
35 .Nd file system consistency check and interactive repair
36 .Sh SYNOPSIS
37 .Nm
38 .Op Fl Cdfnpvy
39 .Op Fl B | F
40 .Op Fl T Ar fstype : Ns Ar fsoptions
41 .Op Fl t Ar fstype
42 .Op Fl c Ar fstab
43 .Oo Ar special | node Oc ...
44 .Sh DESCRIPTION
45 The
46 .Nm
47 utility invokes file system-specific programs to check
48 the special devices listed in the
49 .Xr fstab 5
50 file or in the command line for consistency.
51 .Pp
52 It is normally used in the script
53 .Pa /etc/rc
54 during automatic reboot.
55 Traditionally,
56 .Nm
57 is invoked before the file systems are mounted
58 and all checks are done to completion at that time.
59 If background checking is available,
60 .Nm
61 is invoked twice.
62 It is first invoked at the traditional time,
63 before the file systems are mounted, with the
64 .Fl F
65 flag to do checking on all the file systems
66 that cannot do background checking.
67 It is then invoked a second time,
68 after the system has completed going multiuser, with the
69 .Fl B
70 flag to do checking on all the file systems
71 that can do background checking.
72 Unlike the foreground checking,
73 the background checking is started asynchronously
74 so that other system activity can proceed
75 even on the file systems that are being checked.
76 .Pp
77 If no file systems are specified,
78 .Nm
79 reads the table
80 .Pa /etc/fstab
81 to determine which file systems to check.
82 Only partitions in
83 .Pa /etc/fstab
84 that are mounted
85 .Dq rw ,
86 .Dq rq
87 or
88 .Dq ro
89 and that have non-zero pass number are checked.
90 File systems with pass number 1 (normally just the root file system)
91 are always checked one at a time.
92 .Pp
93 If not in preen mode, the remaining entries are checked in order of
94 increasing pass number one at a time.
95 This is needed when interaction with
96 .Nm
97 is required.
98 .Pp
99 In preen mode, after pass 1 completes, all remaining file systems are checked,
100 in pass number order running one process per disk drive in parallel for each
101 pass number in increasing order.
102 .Pp
103 In other words: In preen mode all pass 1 partitions are checked sequentially.
104 Next all pass 2 partitions are checked in parallel, one process per disk drive.
105 Next all pass 3 partitions are checked in parallel, one process per disk drive.
106 etc.
107 .Pp
108 The disk drive containing each file system is inferred from the shortest prefix
109 of the device name that ends in a digit; the remaining characters are assumed
110 to be the partition and slice designators.
111 .Pp
112 If the
113 .Fl t
114 or
115 .Fl T
116 flags are not specified,
117 .Nm
118 will attempt to determine the file system type and call the
119 appropriate file system check utility.
120 Failure to detect the file system type will cause
121 .Nm
122 to fail with a message that the partition has an unknown file system type.
123 .Pp
124 The options are as follows:
125 .Bl -tag -width indent
126 .It Fl C
127 Check if the
128 .Dq clean
129 flag is set in the superblock and skip file system checks if file system was
130 properly dismounted and marked clean.
131 .It Fl c Ar fstab
132 Specify the
133 .Pa fstab
134 file to use.
135 .It Fl d
136 Debugging mode.
137 Just print the commands without executing them.
138 Available
139 only if
140 .Nm
141 is compiled to support it.
142 .It Fl f
143 Force checking of file systems.
144 Running
145 .Dq Li fsck -f
146 ignores the journal and does a full
147 consistency check of the disk so will find and fix the errors about which the
148 journal is unaware.
149 .It Fl n
150 Causes
151 .Nm
152 to assume no as the answer to all operator questions, except "CONTINUE?".
153 .It Fl p
154 Enter preen mode.
155 In preen mode, only a restricted class of innocuous
156 file system inconsistencies will be corrected.
157 If unexpected inconsistencies caused by hardware or
158 software failures are encountered, the check program
159 will exit with a failure.
160 See the manual pages for the individual check programs
161 for a list of the sorts of failures that they correct
162 when running in preen mode.
163 .It Fl F
164 Run in foreground mode.
165 The check program for each file system is invoked with the
166 .Fl F
167 flag to determine whether it wishes to run as part of
168 the boot up sequence,
169 or if it is able to do its job in background after the
170 system is up and running.
171 A non-zero exit code indicates that it wants to run in foreground
172 and the check program is invoked.
173 A zero exit code indicates that it is able to run later in background
174 and just a deferred message is printed.
175 .It Fl B
176 Run in background mode.
177 The check program for each file system is invoked with the
178 .Fl F
179 flag to determine whether it wishes to run as part of
180 the boot up sequence,
181 or if it is able to do its job in background after the
182 system is up and running.
183 A non-zero exit code indicates that it wanted to run in foreground
184 which is assumed to have been done, so the file system is skipped.
185 A zero exit code indicates that it is able to run in background
186 so the check program is invoked with the
187 .Fl B
188 flag to indicate that a check on the active file system should be done.
189 When running in background mode,
190 only one file system at a time will be checked.
191 Note that background
192 .Nm
193 is limited to checking for only the most commonly occurring
194 file system abnormalities.
195 Under certain circumstances,
196 some errors can escape background
197 .Nm .
198 It is recommended that you perform foreground
199 .Nm
200 on your systems periodically and whenever you encounter
201 file-system\-related panics.
202 .It Fl t Ar fstype
203 Invoke
204 .Nm
205 only for the comma separated list of file system types.
206 If the
207 list starts with
208 .Dq no
209 then invoke
210 .Nm
211 for the file system types that are not specified in the list.
212 .It Fl v
213 Print the commands before executing them.
214 .It Fl y
215 Causes
216 .Nm
217 to assume yes
218 as the answer to all operator questions.
219 .It Fl T Ar fstype : Ns Ar fsoptions
220 List of comma separated file system specific options for the specified
221 file system type, in the same format as
222 .Xr mount 8 .
223 .El
224 .Sh FILES
225 .Bl -tag -width /etc/fstab -compact
226 .It Pa /etc/fstab
227 file system table
228 .El
229 .Sh SEE ALSO
230 .Xr fstab 5 ,
231 .Xr fsck_ffs 8 ,
232 .Xr fsck_msdosfs 8 ,
233 .Xr mount 8
234 .Sh HISTORY
235 A
236 .Nm
237 utility appeared in
238 .Bx 4.0 .
239 It was reimplemented as a filesystem independent wrapper in
240 .Nx 1.3
241 and first appeared in
242 .Fx 5.0 .
243 The original filesystem specific utility became
244 .Xr fsck_ffs 8
245 at this point.