1.\" $NetBSD: fsck.8,v 1.38 2011/04/28 12:16:10 wiz 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.\" 14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24.\" 25.Dd February 17, 2010 26.Dt FSCK 8 27.Os 28.Sh NAME 29.Nm fsck 30.Nd file system consistency check and interactive repair 31.Sh SYNOPSIS 32.Nm 33.Op Fl dfnPpqvy 34.Op Fl l Ar maxparallel 35.Op Fl T Ar fstype:fsoptions 36.Op Fl t Ar fstype 37.Op Fl x Ar mountpoint 38.Op special | node ... 39.Sh DESCRIPTION 40The 41.Nm 42command invokes file system-specific programs to check 43the special devices listed in the 44.Xr fstab 5 45file or in the command line for consistency. 46.Pp 47It is normally used in the script 48.Pa /etc/rc 49during automatic reboot. 50If no file systems are specified, and 51.Dq preen 52mode is enabled ( 53.Fl p 54option) 55.Nm 56reads the table 57.Pa /etc/fstab 58to determine which file systems to check, in what order. 59Only partitions in fstab that are mounted ``rw,'' ``rq'' or ``ro'' 60and that have non-zero pass number are checked. 61File systems with pass number 1 (normally just the root file system) 62are checked one at a time. 63When pass 1 completes, all remaining file systems are checked, 64running one process per disk drive. 65By default, file systems which are already mounted read-write are not checked. 66The disk drive containing each file system is inferred from the longest prefix 67of the device name that ends in a digit; the remaining characters are assumed 68to be the partition designator. 69.Pp 70The options are as follows: 71.Bl -tag -width indent 72.It Fl d 73Debugging mode. 74Just print the commands without executing them. 75.It Fl f 76Force checking of file systems, even when they are marked clean (for file 77systems that support this), or when they are mounted read-write. 78.It Fl l Ar maxparallel 79Limit the number of parallel checks to the number specified in 80the following argument. 81By default, the limit is the number of disks, running one process per disk. 82If a smaller limit is given, the disks are checked round-robin, 83one file system at a time. 84.It Fl n 85Causes 86.Nm 87to assume no as the answer to all operator questions, except "CONTINUE?". 88.It Fl P 89Display a progress meter for each file system check. 90This option also disables parallel checking. 91Note that progress meters are not supported by all file system types. 92.It Fl p 93Enter preen mode. 94In preen mode, 95.Nm 96will check all file systems listed in 97.Pa /etc/fstab 98according to their pass number, and will make minor repairs without 99human intervention. 100.It Fl q 101Quiet mode, do not output any messages for clean filesystems. 102.It Fl T Ar fstype:fsoptions 103List of comma separated file system specific options for the specified 104file system type, in the same format as 105.Xr mount 8 . 106.It Fl t Ar fstype 107Invoke 108.Nm 109only for the comma separated list of file system types. 110If the list starts with 111.Dq no 112then invoke 113.Nm 114for the file system types that are not specified in the list. 115.It Fl v 116Print the commands before executing them. 117.It Fl x Ar mountpoint 118Exclude the filesystem which has a 119.Ar mountpoint 120the same as in 121.Pa /etc/fstab . 122Used only in 123.Dq preen 124mode. 125.It Fl y 126Causes 127.Nm 128to assume yes 129as the answer to all operator questions. 130.El 131.Sh FILES 132.Bl -tag -width /etc/fstab -compact 133.It Pa /etc/fstab 134file system table 135.El 136.Sh EXIT STATUS 137.Nm 138exits with 139.Dv 0 140on success. 141Any major problems will cause 142.Nm 143to exit with the following non-zero 144.Xr exit 3 145codes, so as to alert any invoking program or script that human 146intervention is required. 147.Bl -tag -width XXXX 148.It Dv 1 149Usage problem. 150.It Dv 2 151Unresolved errors while checking the filesystem. 152Re-running 153.Nm 154on the filesystem(s) is required. 155.It Dv 4 156The root filesystem was changed in the process of checking, and updating the 157mount was unsuccessful. 158A reboot (without sync) is required. 159.It Dv 8 160The filesystem check has failed, and a subsequent check is required 161that will require human intervention. 162.It Dv 12 163.Nm 164exited because of the result of a signal (usually 165.Dv SIGINT 166or 167.Dv SIGQUIT 168from the terminal). 169.El 170.Sh SEE ALSO 171.Xr fstab 5 , 172.Xr fsck_ext2fs 8 , 173.Xr fsck_ffs 8 , 174.Xr fsck_lfs 8 , 175.Xr fsck_msdos 8 , 176.Xr mount 8 177