xref: /freebsd/sbin/fsck/fsck.8 (revision 775f689c85a90c0106a1baacbeb1cbac3a9b3696)
19a317438SAdrian Chadd.\"	$NetBSD: fsck.8,v 1.19 1999/03/10 00:08:33 erh Exp $
29a317438SAdrian Chadd.\"
39a317438SAdrian Chadd.\" Copyright (c) 1996 Christos Zoulas.  All rights reserved.
49a317438SAdrian Chadd.\"
59a317438SAdrian Chadd.\" Redistribution and use in source and binary forms, with or without
69a317438SAdrian Chadd.\" modification, are permitted provided that the following conditions
79a317438SAdrian Chadd.\" are met:
89a317438SAdrian Chadd.\" 1. Redistributions of source code must retain the above copyright
99a317438SAdrian Chadd.\"    notice, this list of conditions and the following disclaimer.
109a317438SAdrian Chadd.\" 2. Redistributions in binary form must reproduce the above copyright
119a317438SAdrian Chadd.\"    notice, this list of conditions and the following disclaimer in the
129a317438SAdrian Chadd.\"    documentation and/or other materials provided with the distribution.
139a317438SAdrian Chadd.\" 3. All advertising materials mentioning features or use of this software
149a317438SAdrian Chadd.\"    must display the following acknowledgement:
159a317438SAdrian Chadd.\"	This product includes software developed by Christos Zoulas.
169a317438SAdrian Chadd.\" 4. The name of the author may not be used to endorse or promote products
179a317438SAdrian Chadd.\"    derived from this software without specific prior written permission.
189a317438SAdrian Chadd.\"
199a317438SAdrian Chadd.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
209a317438SAdrian Chadd.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
219a317438SAdrian Chadd.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
229a317438SAdrian Chadd.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
239a317438SAdrian Chadd.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
249a317438SAdrian Chadd.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
259a317438SAdrian Chadd.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
269a317438SAdrian Chadd.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
279a317438SAdrian Chadd.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
289a317438SAdrian Chadd.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
299a317438SAdrian Chadd.\"
306b806d21SRuslan Ermilov.\" $FreeBSD$
316b806d21SRuslan Ermilov.\"
32*775f689cSSevan Janiyan.Dd October 5, 2016
339a317438SAdrian Chadd.Dt FSCK 8
341252c1bbSRuslan Ermilov.Os
359a317438SAdrian Chadd.Sh NAME
369a317438SAdrian Chadd.Nm fsck
379a317438SAdrian Chadd.Nd file system consistency check and interactive repair
389a317438SAdrian Chadd.Sh SYNOPSIS
397c7fb079SRuslan Ermilov.Nm
40111a5220SDavid E. O'Brien.Op Fl Cdfnpvy
41a02a0079SKirk McKusick.Op Fl B | F
42d0353b83SRuslan Ermilov.Op Fl T Ar fstype : Ns Ar fsoptions
438d646af5SRuslan Ermilov.Op Fl t Ar fstype
44f2104fc0SMaxim Sobolev.Op Fl c Ar fstab
458d646af5SRuslan Ermilov.Oo Ar special | node Oc ...
469a317438SAdrian Chadd.Sh DESCRIPTION
479a317438SAdrian ChaddThe
489a317438SAdrian Chadd.Nm
49e1205e80SPhilippe Charnierutility invokes file system-specific programs to check
509a317438SAdrian Chaddthe special devices listed in the
519a317438SAdrian Chadd.Xr fstab 5
529a317438SAdrian Chaddfile or in the command line for consistency.
539a317438SAdrian Chadd.Pp
549a317438SAdrian ChaddIt is normally used in the script
559a317438SAdrian Chadd.Pa /etc/rc
569a317438SAdrian Chaddduring automatic reboot.
57a02a0079SKirk McKusickTraditionally,
58a02a0079SKirk McKusick.Nm
59a02a0079SKirk McKusickis invoked before the file systems are mounted
60a02a0079SKirk McKusickand all checks are done to completion at that time.
61a02a0079SKirk McKusickIf background checking is available,
62a02a0079SKirk McKusick.Nm
63a02a0079SKirk McKusickis invoked twice.
64a02a0079SKirk McKusickIt is first invoked at the traditional time,
65a02a0079SKirk McKusickbefore the file systems are mounted, with the
66a02a0079SKirk McKusick.Fl F
67a02a0079SKirk McKusickflag to do checking on all the file systems
68a02a0079SKirk McKusickthat cannot do background checking.
69a02a0079SKirk McKusickIt is then invoked a second time,
70a02a0079SKirk McKusickafter the system has completed going multiuser, with the
71a02a0079SKirk McKusick.Fl B
72a02a0079SKirk McKusickflag to do checking on all the file systems
73a02a0079SKirk McKusickthat can do background checking.
74a02a0079SKirk McKusickUnlike the foreground checking,
7557bd0fc6SJens Schweikhardtthe background checking is started asynchronously
76a02a0079SKirk McKusickso that other system activity can proceed
77a02a0079SKirk McKusickeven on the file systems that are being checked.
78a02a0079SKirk McKusick.Pp
79fa0379c1SRuslan ErmilovIf no file systems are specified,
809a317438SAdrian Chadd.Nm
819a317438SAdrian Chaddreads the table
829a317438SAdrian Chadd.Pa /etc/fstab
839a317438SAdrian Chaddto determine which file systems to check.
84fa0379c1SRuslan ErmilovOnly partitions in
85fa0379c1SRuslan Ermilov.Pa /etc/fstab
86fa0379c1SRuslan Ermilovthat are mounted
87fa0379c1SRuslan Ermilov.Dq rw ,
88fa0379c1SRuslan Ermilov.Dq rq
89fa0379c1SRuslan Ermilovor
90fa0379c1SRuslan Ermilov.Dq ro
919a317438SAdrian Chaddand that have non-zero pass number are checked.
929a317438SAdrian ChaddFile systems with pass number 1 (normally just the root file system)
930af7bca2SPoul-Henning Kampare always checked one at a time.
940af7bca2SPoul-Henning Kamp.Pp
950af7bca2SPoul-Henning KampIf not in preen mode, the remaining entries are checked in order of
960af7bca2SPoul-Henning Kampincreasing pass number one at a time.
9718841862SRuslan ErmilovThis is needed when interaction with
9818841862SRuslan Ermilov.Nm
9918841862SRuslan Ermilovis required.
1000af7bca2SPoul-Henning Kamp.Pp
1010af7bca2SPoul-Henning KampIn preen mode, after pass 1 completes, all remaining file systems are checked,
1020af7bca2SPoul-Henning Kampin pass number order running one process per disk drive in parallel for each
1030af7bca2SPoul-Henning Kamppass number in increasing order.
1040af7bca2SPoul-Henning Kamp.Pp
1050af7bca2SPoul-Henning KampIn other words: In preen mode all pass 1 partitions are checked sequentially.
1060af7bca2SPoul-Henning KampNext all pass 2 partitions are checked in parallel, one process per disk drive.
1070af7bca2SPoul-Henning KampNext all pass 3 partitions are checked in parallel, one process per disk drive.
1080af7bca2SPoul-Henning Kampetc.
1090af7bca2SPoul-Henning Kamp.Pp
11028b66787SPoul-Henning KampThe disk drive containing each file system is inferred from the shortest prefix
1119a317438SAdrian Chaddof the device name that ends in a digit; the remaining characters are assumed
1120af7bca2SPoul-Henning Kampto be the partition and slice designators.
1139a317438SAdrian Chadd.Pp
114aedb7289STom RhodesIf the
115aedb7289STom Rhodes.Fl t
116aedb7289STom Rhodesor
117aedb7289STom Rhodes.Fl T
118aedb7289STom Rhodesflags are not specified,
119aedb7289STom Rhodes.Nm
120aedb7289STom Rhodeswill attempt to determine the file system type and call the
121aedb7289STom Rhodesappropriated file system check utility.
122aedb7289STom RhodesFailure to detect the file system type will cause
123aedb7289STom Rhodes.Nm
124aedb7289STom Rhodesto fail with a message that the partition has an unknown file system type.
125aedb7289STom Rhodes.Pp
1269a317438SAdrian ChaddThe options are as follows:
1279a317438SAdrian Chadd.Bl -tag -width indent
128111a5220SDavid E. O'Brien.It Fl C
129111a5220SDavid E. O'BrienCheck if the
130111a5220SDavid E. O'Brien.Dq clean
131111a5220SDavid E. O'Brienflag is set in the superblock and skip file system checks if file system was
132111a5220SDavid E. O'Brienproperly dismounted and marked clean.
133f2104fc0SMaxim Sobolev.It Fl c Ar fstab
134f2104fc0SMaxim SobolevSpecify the
135f2104fc0SMaxim Sobolev.Pa fstab
136f2104fc0SMaxim Sobolevfile to use.
1379a317438SAdrian Chadd.It Fl d
1389806e231SRuslan ErmilovDebugging mode.
1399806e231SRuslan ErmilovJust print the commands without executing them.
1409806e231SRuslan ErmilovAvailable
1419a317438SAdrian Chaddonly if
1429a317438SAdrian Chadd.Nm
1439a317438SAdrian Chaddis compiled to support it.
1449a317438SAdrian Chadd.It Fl f
1459a317438SAdrian ChaddForce checking of file systems, even when they are marked clean (for file systems
1469a317438SAdrian Chaddthat support this).
1479a317438SAdrian Chadd.It Fl n
1489a317438SAdrian ChaddCauses
1499a317438SAdrian Chadd.Nm
1509a317438SAdrian Chaddto assume no as the answer to all operator questions, except "CONTINUE?".
1519a317438SAdrian Chadd.It Fl p
1529a317438SAdrian ChaddEnter preen mode.
153a02a0079SKirk McKusickIn preen mode, only a restricted class of innocuous
154a02a0079SKirk McKusickfile system inconsistencies will be corrected.
155a02a0079SKirk McKusickIf unexpected inconsistencies caused by hardware or
15657bd0fc6SJens Schweikhardtsoftware failures are encountered, the check program
157a02a0079SKirk McKusickwill exit with a failure.
158a02a0079SKirk McKusickSee the manual pages for the individual check programs
159a02a0079SKirk McKusickfor a list of the sorts of failures that they correct
160a02a0079SKirk McKusickwhen running in preen mode.
161a02a0079SKirk McKusick.It Fl F
162a02a0079SKirk McKusickRun in foreground mode.
163a02a0079SKirk McKusickThe check program for each file system is invoked with the
164a02a0079SKirk McKusick.Fl F
165a02a0079SKirk McKusickflag to determine whether it wishes to run as part of
166a02a0079SKirk McKusickthe boot up sequence,
167a02a0079SKirk McKusickor if it is able to do its job in background after the
168a02a0079SKirk McKusicksystem is up and running.
169a02a0079SKirk McKusickA non-zero exit code indicates that it wants to run in foreground
170a02a0079SKirk McKusickand the check program is invoked.
171a02a0079SKirk McKusickA zero exit code indicates that it is able to run later in background
172a02a0079SKirk McKusickand just a deferred message is printed.
173a02a0079SKirk McKusick.It Fl B
174a02a0079SKirk McKusickRun in background mode.
175a02a0079SKirk McKusickThe check program for each file system is invoked with the
176a02a0079SKirk McKusick.Fl F
177a02a0079SKirk McKusickflag to determine whether it wishes to run as part of
178a02a0079SKirk McKusickthe boot up sequence,
179a02a0079SKirk McKusickor if it is able to do its job in background after the
180a02a0079SKirk McKusicksystem is up and running.
181a02a0079SKirk McKusickA non-zero exit code indicates that it wanted to run in foreground
182a02a0079SKirk McKusickwhich is assumed to have been done, so the file system is skipped.
183a02a0079SKirk McKusickA zero exit code indicates that it is able to run in background
184a02a0079SKirk McKusickso the check program is invoked with the
185a02a0079SKirk McKusick.Fl B
186a02a0079SKirk McKusickflag to indicate that a check on the active file system should be done.
187a02a0079SKirk McKusickWhen running in background mode,
188a02a0079SKirk McKusickonly one file system at a time will be checked.
18990104f54SKirk McKusickNote that background
19090104f54SKirk McKusick.Nm
191f6ac2391SJoel Dahlis limited to checking for only the most commonly occurring
19290104f54SKirk McKusickfile system abnormalities.
19390104f54SKirk McKusickUnder certain circumstances,
19490104f54SKirk McKusicksome errors can escape background
19590104f54SKirk McKusick.Nm .
19690104f54SKirk McKusickIt is recommended that you perform foreground
19790104f54SKirk McKusick.Nm
19890104f54SKirk McKusickon your systems periodically and whenever you encounter
19990104f54SKirk McKusickfile-system\-related panics.
2009a317438SAdrian Chadd.It Fl t Ar fstype
2019a317438SAdrian ChaddInvoke
2029a317438SAdrian Chadd.Nm
2039806e231SRuslan Ermilovonly for the comma separated list of file system types.
2049806e231SRuslan ErmilovIf the
2059a317438SAdrian Chaddlist starts with
2069a317438SAdrian Chadd.Dq no
2079a317438SAdrian Chaddthen invoke
2089a317438SAdrian Chadd.Nm
2099a317438SAdrian Chaddfor the file system types that are not specified in the list.
2109a317438SAdrian Chadd.It Fl v
2119a317438SAdrian ChaddPrint the commands before executing them.
2129a317438SAdrian Chadd.It Fl y
2139a317438SAdrian ChaddCauses
2149a317438SAdrian Chadd.Nm
2159a317438SAdrian Chaddto assume yes
2169a317438SAdrian Chaddas the answer to all operator questions.
217d0353b83SRuslan Ermilov.It Fl T Ar fstype : Ns Ar fsoptions
2189a317438SAdrian ChaddList of comma separated file system specific options for the specified
2199a317438SAdrian Chaddfile system type, in the same format as
2209a317438SAdrian Chadd.Xr mount 8 .
2219a317438SAdrian Chadd.El
2229a317438SAdrian Chadd.Sh FILES
2239a317438SAdrian Chadd.Bl -tag -width /etc/fstab -compact
2249a317438SAdrian Chadd.It Pa /etc/fstab
2259a317438SAdrian Chaddfile system table
2269a317438SAdrian Chadd.El
2279a317438SAdrian Chadd.Sh SEE ALSO
2289a317438SAdrian Chadd.Xr fstab 5 ,
229fa0379c1SRuslan Ermilov.Xr fsck_ffs 8 ,
230265c01dfSRuslan Ermilov.Xr fsck_msdosfs 8 ,
231fa0379c1SRuslan Ermilov.Xr mount 8
232*775f689cSSevan Janiyan.Sh HISTORY
233*775f689cSSevan JaniyanA
234*775f689cSSevan Janiyan.Nm
235*775f689cSSevan Janiyanutility appeared in
236*775f689cSSevan Janiyan.Bx 4.0 .
237*775f689cSSevan JaniyanIt was reimplemented as a filesystem independent wrapper in
238*775f689cSSevan Janiyan.Nx 1.3
239*775f689cSSevan Janiyanand first appeared in
240*775f689cSSevan Janiyan.Fx 5.0 .
241*775f689cSSevan JaniyanThe original filesystem specific utility became
242*775f689cSSevan Janiyan.Xr fsck_ffs 8
243*775f689cSSevan Janiyanat this point.
244