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