xref: /openbsd-src/sbin/fsck/fsck.8 (revision 893695cea05286a86be12c6215f6501df588dceb)
1.\"	$OpenBSD: fsck.8,v 1.35 2023/01/04 13:00:11 jsg Exp $
2.\"	$NetBSD: fsck.8,v 1.14 1996/10/03 20:08:29 christos Exp $
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.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25.\"
26.Dd $Mdocdate: January 4 2023 $
27.Dt FSCK 8
28.Os
29.Sh NAME
30.Nm fsck
31.Nd file system consistency check and interactive repair
32.Sh SYNOPSIS
33.Nm fsck
34.Bk -words
35.Op Fl dfNnpvy
36.Op Fl b Ar block#
37.Op Fl l Ar maxparallel
38.Op Fl T Ar fstype : Ns Ar fsoptions
39.Op Fl t Ar fstype
40.Op Ar special | node ...
41.Ek
42.Sh DESCRIPTION
43The
44.Nm
45command invokes file-system-specific programs to check the
46special devices listed in the
47.Xr fstab 5
48file or on the command line for consistency.
49.Pp
50It is normally used in the script
51.Xr rc 8
52during automatic reboot.
53If no file systems are specified,
54.Nm
55reads the file
56.Xr fstab 5
57to determine which file systems to check and in what order.
58Only partitions in fstab that are mounted
59.Dq rw
60or
61.Dq ro
62and that have non-zero pass numbers are checked.
63File systems with pass number 1 (normally just the root file system) are
64checked one at a time.
65When pass 1 completes, all remaining file systems are checked, with one
66process spawned per disk drive.
67The disk drive containing each file system is inferred from the longest
68prefix of the device name that ends in a digit; the remaining characters
69are assumed to be the partition designator.
70By default, file systems which are already mounted read/write are not
71checked.
72.Pp
73The options are as follows:
74.Bl -tag -width Ds
75.It Fl b Ar block#
76Causes
77.Nm
78to use the specified block as the location of the superblock.
79Block 32 is usually an alternate super block.
80This option is only valid for filesystems that support backup superblocks
81(ffs and ext2fs).
82.It Fl d
83Debugging mode.
84Just print the commands without executing them.
85Available only if
86.Nm
87is compiled to support it.
88.It Fl f
89Force checking of file systems, even when they are marked clean (for file systems
90that support this).
91.It Fl l Ar maxparallel
92Limit the number of parallel checks to
93.Ar maxparallel .
94By default, the limit is the number of
95disks, running one process per disk.
96If a smaller limit is given,
97the disks are checked round-robin, one file system at a time.
98.It Fl N
99When using
100.Xr fstab 5 ,
101only check filesystems that have the
102.Dq net
103mount option set.
104By default file systems with this option are ignored.
105.It Fl n
106Assume a
107.Dq no
108response to all questions asked by
109.Nm
110except for
111.Dq CONTINUE? ,
112which is assumed to be affirmative.
113File systems will not be opened for writing.
114This is the default for file systems to be checked that are
115concurrently mounted writable.
116.It Fl p
117Enter preen mode:
118.Nm
119will check all file systems listed in
120.Xr fstab 5
121according to their pass number,
122or any special devices listed on the command line,
123and will make minor repairs without
124human intervention.
125Any major problems will cause
126.Nm
127to exit with a non-zero exit code,
128so as to alert any invoking program or script
129that human intervention is required.
130.It Fl T Ar fstype : Ns Ar fsoptions
131List of comma separated file system specific options for the specified
132file system type, in the same format as
133.Xr mount 8 .
134.It Fl t Ar fstype
135Invoke
136.Nm
137only for the comma separated list of file system types.
138If the list starts with
139.Dq no ,
140invoke
141.Nm
142only in the file system types that are
143.Em not
144specified in
145the list.
146.It Fl v
147Print the commands before executing them.
148.It Fl y
149Cause
150.Nm
151to assume
152.Dq yes
153as the answer to all operator questions.
154.El
155.Pp
156If neither of the
157.Fl y
158or
159.Fl n
160options are specified, the user may force
161.Nm
162to assume an answer of
163.Dq yes
164to all the remaining questions by replying to a question with a value of
165.Dq F .
166.Sh FILES
167.Bl -tag -width /etc/fstab -compact
168.It Pa /etc/fstab
169file system table
170.El
171.Sh SEE ALSO
172.Xr fs 5 ,
173.Xr fstab 5 ,
174.Xr fsck_ext2fs 8 ,
175.Xr fsck_ffs 8 ,
176.Xr fsck_msdos 8 ,
177.Xr fsdb 8 ,
178.Xr growfs 8 ,
179.Xr mount 8 ,
180.Xr newfs 8 ,
181.Xr rc 8 ,
182.Xr scan_ffs 8
183