xref: /openbsd-src/sbin/fsck/fsck.8 (revision 893695cea05286a86be12c6215f6501df588dceb)
1*893695ceSjsg.\"	$OpenBSD: fsck.8,v 1.35 2023/01/04 13:00:11 jsg Exp $
287304b87Stholo.\"	$NetBSD: fsck.8,v 1.14 1996/10/03 20:08:29 christos Exp $
387304b87Stholo.\"
487304b87Stholo.\" Copyright (c) 1996 Christos Zoulas.  All rights reserved.
587304b87Stholo.\"
687304b87Stholo.\" Redistribution and use in source and binary forms, with or without
787304b87Stholo.\" modification, are permitted provided that the following conditions
887304b87Stholo.\" are met:
987304b87Stholo.\" 1. Redistributions of source code must retain the above copyright
1087304b87Stholo.\"    notice, this list of conditions and the following disclaimer.
1187304b87Stholo.\" 2. Redistributions in binary form must reproduce the above copyright
1287304b87Stholo.\"    notice, this list of conditions and the following disclaimer in the
1387304b87Stholo.\"    documentation and/or other materials provided with the distribution.
1487304b87Stholo.\"
1587304b87Stholo.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1687304b87Stholo.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1787304b87Stholo.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1887304b87Stholo.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1987304b87Stholo.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2087304b87Stholo.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2187304b87Stholo.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2287304b87Stholo.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2387304b87Stholo.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2487304b87Stholo.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2587304b87Stholo.\"
26*893695ceSjsg.Dd $Mdocdate: January 4 2023 $
2787304b87Stholo.Dt FSCK 8
28481127b4Sdownsj.Os
2987304b87Stholo.Sh NAME
3087304b87Stholo.Nm fsck
3187304b87Stholo.Nd file system consistency check and interactive repair
3287304b87Stholo.Sh SYNOPSIS
337349792aSaaron.Nm fsck
34e1bf7036Sjmc.Bk -words
350e3c8cccSjmc.Op Fl dfNnpvy
3687e5b1dbSmillert.Op Fl b Ar block#
3787304b87Stholo.Op Fl l Ar maxparallel
38139a4000Sjaredy.Op Fl T Ar fstype : Ns Ar fsoptions
3987304b87Stholo.Op Fl t Ar fstype
40139a4000Sjaredy.Op Ar special | node ...
41e1bf7036Sjmc.Ek
4287304b87Stholo.Sh DESCRIPTION
4387304b87StholoThe
4458aefd4bSaaron.Nm
45139a4000Sjaredycommand invokes file-system-specific programs to check the
4692623de0Sderaadtspecial devices listed in the
4787304b87Stholo.Xr fstab 5
483f397614Sjmcfile or on the command line for consistency.
49139a4000Sjaredy.Pp
50139a4000SjaredyIt is normally used in the script
51139a4000Sjaredy.Xr rc 8
52139a4000Sjaredyduring automatic reboot.
53139a4000SjaredyIf no file systems are specified,
54139a4000Sjaredy.Nm
55139a4000Sjaredyreads the file
56139a4000Sjaredy.Xr fstab 5
57139a4000Sjaredyto determine which file systems to check and in what order.
58139a4000SjaredyOnly partitions in fstab that are mounted
59139a4000Sjaredy.Dq rw
60139a4000Sjaredyor
61139a4000Sjaredy.Dq ro
62139a4000Sjaredyand that have non-zero pass numbers are checked.
63139a4000SjaredyFile systems with pass number 1 (normally just the root file system) are
64139a4000Sjaredychecked one at a time.
65139a4000SjaredyWhen pass 1 completes, all remaining file systems are checked, with one
66139a4000Sjaredyprocess spawned per disk drive.
67139a4000SjaredyThe disk drive containing each file system is inferred from the longest
68139a4000Sjaredyprefix of the device name that ends in a digit; the remaining characters
69139a4000Sjaredyare assumed to be the partition designator.
70139a4000SjaredyBy default, file systems which are already mounted read/write are not
71139a4000Sjaredychecked.
72139a4000Sjaredy.Pp
7387304b87StholoThe options are as follows:
74f1ba3473Saaron.Bl -tag -width Ds
7587e5b1dbSmillert.It Fl b Ar block#
7687e5b1dbSmillertCauses
7787e5b1dbSmillert.Nm
7887e5b1dbSmillertto use the specified block as the location of the superblock.
7987e5b1dbSmillertBlock 32 is usually an alternate super block.
8087e5b1dbSmillertThis option is only valid for filesystems that support backup superblocks
8187e5b1dbSmillert(ffs and ext2fs).
8287304b87Stholo.It Fl d
839615e1d4SaaronDebugging mode.
849615e1d4SaaronJust print the commands without executing them.
859615e1d4SaaronAvailable only if
8687304b87Stholo.Nm
8787304b87Stholois compiled to support it.
8887304b87Stholo.It Fl f
8987304b87StholoForce checking of file systems, even when they are marked clean (for file systems
9087304b87Stholothat support this).
9187304b87Stholo.It Fl l Ar maxparallel
925eaf1a72SaaronLimit the number of parallel checks to
935eaf1a72Saaron.Ar maxparallel .
945eaf1a72SaaronBy default, the limit is the number of
959615e1d4Saarondisks, running one process per disk.
969615e1d4SaaronIf a smaller limit is given,
975eaf1a72Saaronthe disks are checked round-robin, one file system at a time.
982babb8b2Sclaudio.It Fl N
992babb8b2SclaudioWhen using
1002babb8b2Sclaudio.Xr fstab 5 ,
1012babb8b2Sclaudioonly check filesystems that have the
1022babb8b2Sclaudio.Dq net
1030e3c8cccSjmcmount option set.
1040e3c8cccSjmcBy default file systems with this option are ignored.
10587304b87Stholo.It Fl n
106139a4000SjaredyAssume a
1075eaf1a72Saaron.Dq no
108139a4000Sjaredyresponse to all questions asked by
109139a4000Sjaredy.Nm
110139a4000Sjaredyexcept for
111139a4000Sjaredy.Dq CONTINUE? ,
112139a4000Sjaredywhich is assumed to be affirmative.
113139a4000SjaredyFile systems will not be opened for writing.
114139a4000SjaredyThis is the default for file systems to be checked that are
115139a4000Sjaredyconcurrently mounted writable.
11687304b87Stholo.It Fl p
117f65eb942SjmcEnter preen mode:
118f65eb942Sjmc.Nm
119f65eb942Sjmcwill check all file systems listed in
120f65eb942Sjmc.Xr fstab 5
121f65eb942Sjmcaccording to their pass number,
122f65eb942Sjmcor any special devices listed on the command line,
123f65eb942Sjmcand will make minor repairs without
124f65eb942Sjmchuman intervention.
125f65eb942SjmcAny major problems will cause
126f65eb942Sjmc.Nm
127f65eb942Sjmcto exit with a non-zero exit code,
128f65eb942Sjmcso as to alert any invoking program or script
129f65eb942Sjmcthat human intervention is required.
13068de2f41Sjmc.It Fl T Ar fstype : Ns Ar fsoptions
131e1bf7036SjmcList of comma separated file system specific options for the specified
132e1bf7036Sjmcfile system type, in the same format as
133e1bf7036Sjmc.Xr mount 8 .
13487304b87Stholo.It Fl t Ar fstype
135e1bf7036SjmcInvoke
136e1bf7036Sjmc.Nm
137139a4000Sjaredyonly for the comma separated list of file system types.
1389615e1d4SaaronIf the list starts with
1395eaf1a72Saaron.Dq no ,
140e1bf7036Sjmcinvoke
141e1bf7036Sjmc.Nm
142e1bf7036Sjmconly in the file system types that are
1435eaf1a72Saaron.Em not
1445eaf1a72Saaronspecified in
14519e9b900Sderaadtthe list.
14687304b87Stholo.It Fl v
14787304b87StholoPrint the commands before executing them.
14887304b87Stholo.It Fl y
1495eaf1a72SaaronCause
15087304b87Stholo.Nm
1515eaf1a72Saaronto assume
1525eaf1a72Saaron.Dq yes
15387304b87Stholoas the answer to all operator questions.
15492698011Saaron.El
1552c38a91fSpedro.Pp
1562c38a91fSpedroIf neither of the
1572c38a91fSpedro.Fl y
1582c38a91fSpedroor
1592c38a91fSpedro.Fl n
1602c38a91fSpedrooptions are specified, the user may force
1612c38a91fSpedro.Nm
1622c38a91fSpedroto assume an answer of
1632c38a91fSpedro.Dq yes
1642c38a91fSpedroto all the remaining questions by replying to a question with a value of
1652c38a91fSpedro.Dq F .
16687304b87Stholo.Sh FILES
16787304b87Stholo.Bl -tag -width /etc/fstab -compact
16887304b87Stholo.It Pa /etc/fstab
16987304b87Stholofile system table
17087304b87Stholo.El
17187304b87Stholo.Sh SEE ALSO
172139a4000Sjaredy.Xr fs 5 ,
17387304b87Stholo.Xr fstab 5 ,
174392a06e7Saaron.Xr fsck_ext2fs 8 ,
1753f397614Sjmc.Xr fsck_ffs 8 ,
17687304b87Stholo.Xr fsck_msdos 8 ,
177616e0c90Shugh.Xr fsdb 8 ,
178cfd956ddSjmc.Xr growfs 8 ,
179139a4000Sjaredy.Xr mount 8 ,
180139a4000Sjaredy.Xr newfs 8 ,
1810a2a6ad9Sjmc.Xr rc 8 ,
1820a2a6ad9Sjmc.Xr scan_ffs 8
183