]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/fsck/fsck.8
Add ELF flag to disable ASLR stack gap.
[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 .\" $FreeBSD$
31 .\"
32 .Dd March 5, 2019
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.
146 Running
147 .Dq Li fsck -f
148 ignores the journal and does a full
149 consistency check of the disk so will find and fix the errors about which the
150 journal is unaware.
151 .It Fl n
152 Causes
153 .Nm
154 to assume no as the answer to all operator questions, except "CONTINUE?".
155 .It Fl p
156 Enter preen mode.
157 In preen mode, only a restricted class of innocuous
158 file system inconsistencies will be corrected.
159 If unexpected inconsistencies caused by hardware or
160 software failures are encountered, the check program
161 will exit with a failure.
162 See the manual pages for the individual check programs
163 for a list of the sorts of failures that they correct
164 when running in preen mode.
165 .It Fl F
166 Run in foreground mode.
167 The check program for each file system is invoked with the
168 .Fl F
169 flag to determine whether it wishes to run as part of
170 the boot up sequence,
171 or if it is able to do its job in background after the
172 system is up and running.
173 A non-zero exit code indicates that it wants to run in foreground
174 and the check program is invoked.
175 A zero exit code indicates that it is able to run later in background
176 and just a deferred message is printed.
177 .It Fl B
178 Run in background mode.
179 The check program for each file system is invoked with the
180 .Fl F
181 flag to determine whether it wishes to run as part of
182 the boot up sequence,
183 or if it is able to do its job in background after the
184 system is up and running.
185 A non-zero exit code indicates that it wanted to run in foreground
186 which is assumed to have been done, so the file system is skipped.
187 A zero exit code indicates that it is able to run in background
188 so the check program is invoked with the
189 .Fl B
190 flag to indicate that a check on the active file system should be done.
191 When running in background mode,
192 only one file system at a time will be checked.
193 Note that background
194 .Nm
195 is limited to checking for only the most commonly occurring
196 file system abnormalities.
197 Under certain circumstances,
198 some errors can escape background
199 .Nm .
200 It is recommended that you perform foreground
201 .Nm
202 on your systems periodically and whenever you encounter
203 file-system\-related panics.
204 .It Fl t Ar fstype
205 Invoke
206 .Nm
207 only for the comma separated list of file system types.
208 If the
209 list starts with
210 .Dq no
211 then invoke
212 .Nm
213 for the file system types that are not specified in the list.
214 .It Fl v
215 Print the commands before executing them.
216 .It Fl y
217 Causes
218 .Nm
219 to assume yes
220 as the answer to all operator questions.
221 .It Fl T Ar fstype : Ns Ar fsoptions
222 List of comma separated file system specific options for the specified
223 file system type, in the same format as
224 .Xr mount 8 .
225 .El
226 .Sh FILES
227 .Bl -tag -width /etc/fstab -compact
228 .It Pa /etc/fstab
229 file system table
230 .El
231 .Sh SEE ALSO
232 .Xr fstab 5 ,
233 .Xr fsck_ffs 8 ,
234 .Xr fsck_msdosfs 8 ,
235 .Xr mount 8
236 .Sh HISTORY
237 A
238 .Nm
239 utility appeared in
240 .Bx 4.0 .
241 It was reimplemented as a filesystem independent wrapper in
242 .Nx 1.3
243 and first appeared in
244 .Fx 5.0 .
245 The original filesystem specific utility became
246 .Xr fsck_ffs 8
247 at this point.