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. 116Just print the commands without executing them. 117Available 118only if 119.Nm 120is compiled to support it. 121.It Fl f 122Force checking of file systems, even when they are marked clean (for file systems 123that support this). 124.It Fl n 125Causes 126.Nm 127to assume no as the answer to all operator questions, except "CONTINUE?". 128.It Fl p 129Enter preen mode. 130In preen mode, only a restricted class of innocuous 131file system inconsistencies will be corrected. 132If unexpected inconsistencies caused by hardware or 133software failures are encountered, the check program 134will exit with a failure. 135See the manual pages for the individual check programs 136for a list of the sorts of failures that they correct 137when running in preen mode. 138.It Fl F 139Run in foreground mode. 140The check program for each file system is invoked with the 141.Fl F 142flag to determine whether it wishes to run as part of 143the boot up sequence, 144or if it is able to do its job in background after the 145system is up and running. 146A non-zero exit code indicates that it wants to run in foreground 147and the check program is invoked. 148A zero exit code indicates that it is able to run later in background 149and just a deferred message is printed. 150.It Fl B 151Run in background mode. 152The check program for each file system is invoked with the 153.Fl F 154flag to determine whether it wishes to run as part of 155the boot up sequence, 156or if it is able to do its job in background after the 157system is up and running. 158A non-zero exit code indicates that it wanted to run in foreground 159which is assumed to have been done, so the file system is skipped. 160A zero exit code indicates that it is able to run in background 161so the check program is invoked with the 162.Fl B 163flag to indicate that a check on the active file system should be done. 164When running in background mode, 165only one file system at a time will be checked. 166.It Fl t Ar fstype 167Invoke 168.Nm 169only for the comma separated list of file system types. 170If the 171list starts with 172.Dq no 173then invoke 174.Nm 175for the file system types that are not specified in the list. 176.It Fl v 177Print the commands before executing them. 178.It Fl y 179Causes 180.Nm 181to assume yes 182as the answer to all operator questions. 183.It Fl T Ar fstype : Ns Ar fsoptions 184List of comma separated file system specific options for the specified 185file system type, in the same format as 186.Xr mount 8 . 187.El 188.Sh FILES 189.Bl -tag -width /etc/fstab -compact 190.It Pa /etc/fstab 191file system table 192.El 193.Sh SEE ALSO 194.Xr fstab 5 , 195.Xr fsck_ffs 8 , 196.Xr fsck_msdosfs 8 , 197.Xr mount 8 198