1FSCK(8)                      System Administration                     FSCK(8)
2
3
4

NAME

6       fsck - check and repair a Linux filesystem
7

SYNOPSIS

9       fsck [-lsAVRTMNP] [-r [fd]] [-C [fd]] [-t fstype] [filesystem...] [--]
10       [fs-specific-options]
11

DESCRIPTION

13       fsck is used to check and optionally repair one or more Linux
14       filesystems. filesystem can be a device name (e.g., /dev/hdc1,
15       /dev/sdb2), a mount point (e.g., /, /usr, /home), or an filesystem
16       label or UUID specifier (e.g.,
17       UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). Normally, the
18       fsck program will try to handle filesystems on different physical disk
19       drives in parallel to reduce the total amount of time needed to check
20       all of them.
21
22       If no filesystems are specified on the command line, and the -A option
23       is not specified, fsck will default to checking filesystems in
24       /etc/fstab serially. This is equivalent to the -As options.
25
26       The exit status returned by fsck is the sum of the following
27       conditions:
28
29       0
30           No errors
31
32       1
33           Filesystem errors corrected
34
35       2
36           System should be rebooted
37
38       4
39           Filesystem errors left uncorrected
40
41       8
42           Operational error
43
44       16
45           Usage or syntax error
46
47       32
48           Checking canceled by user request
49
50       128
51           Shared-library error
52
53       The exit status returned when multiple filesystems are checked is the
54       bit-wise OR of the exit statuses for each filesystem that is checked.
55
56       In actuality, fsck is simply a front-end for the various filesystem
57       checkers (fsck.fstype) available under Linux. The filesystem-specific
58       checker is searched for in the PATH environment variable. If the PATH
59       is undefined then fallback to /sbin.
60
61       Please see the filesystem-specific checker manual pages for further
62       details.
63

OPTIONS

65       -l
66           Create an exclusive flock(2) lock file (/run/fsck/<diskname>.lock)
67           for whole-disk device. This option can be used with one device only
68           (this means that -A and -l are mutually exclusive). This option is
69           recommended when more fsck instances are executed in the same time.
70           The option is ignored when used for multiple devices or for
71           non-rotating disks. fsck does not lock underlying devices when
72           executed to check stacked devices (e.g. MD or DM) - this feature is
73           not implemented yet.
74
75       -r [fd]
76           Report certain statistics for each fsck when it completes. These
77           statistics include the exit status, the maximum run set size (in
78           kilobytes), the elapsed all-clock time and the user and system CPU
79           time used by the fsck run. For example:
80
81           /dev/sda1: status 0, rss 92828, real 4.002804, user 2.677592, sys
82           0.86186
83
84           GUI front-ends may specify a file descriptor fd, in which case the
85           progress bar information will be sent to that file descriptor in a
86           machine parsable format. For example:
87
88           /dev/sda1 0 92828 4.002804 2.677592 0.86186
89
90       -s
91           Serialize fsck operations. This is a good idea if you are checking
92           multiple filesystems and the checkers are in an interactive mode.
93           (Note: e2fsck(8) runs in an interactive mode by default. To make
94           e2fsck(8) run in a non-interactive mode, you must either specify
95           the -p or -a option, if you wish for errors to be corrected
96           automatically, or the -n option if you do not.)
97
98       -t fslist
99           Specifies the type(s) of filesystem to be checked. When the -A flag
100           is specified, only filesystems that match fslist are checked. The
101           fslist parameter is a comma-separated list of filesystems and
102           options specifiers. All of the filesystems in this comma-separated
103           list may be prefixed by a negation operator 'no' or '!', which
104           requests that only those filesystems not listed in fslist will be
105           checked. If none of the filesystems in fslist is prefixed by a
106           negation operator, then only those listed filesystems will be
107           checked.
108
109           Options specifiers may be included in the comma-separated fslist.
110           They must have the format opts=fs-option. If an options specifier
111           is present, then only filesystems which contain fs-option in their
112           mount options field of /etc/fstab will be checked. If the options
113           specifier is prefixed by a negation operator, then only those
114           filesystems that do not have fs-option in their mount options field
115           of /etc/fstab will be checked.
116
117           For example, if opts=ro appears in fslist, then only filesystems
118           listed in /etc/fstab with the ro option will be checked.
119
120           For compatibility with Mandrake distributions whose boot scripts
121           depend upon an unauthorized UI change to the fsck program, if a
122           filesystem type of loop is found in fslist, it is treated as if
123           opts=loop were specified as an argument to the -t option.
124
125           Normally, the filesystem type is deduced by searching for filesys
126           in the /etc/fstab file and using the corresponding entry. If the
127           type cannot be deduced, and there is only a single filesystem given
128           as an argument to the -t option, fsck will use the specified
129           filesystem type. If this type is not available, then the default
130           filesystem type (currently ext2) is used.
131
132       -A
133           Walk through the /etc/fstab file and try to check all filesystems
134           in one run. This option is typically used from the /etc/rc system
135           initialization file, instead of multiple commands for checking a
136           single filesystem.
137
138           The root filesystem will be checked first unless the -P option is
139           specified (see below). After that, filesystems will be checked in
140           the order specified by the fs_passno (the sixth) field in the
141           /etc/fstab file. Filesystems with a fs_passno value of 0 are
142           skipped and are not checked at all. Filesystems with a fs_passno
143           value of greater than zero will be checked in order, with
144           filesystems with the lowest fs_passno number being checked first.
145           If there are multiple filesystems with the same pass number, fsck
146           will attempt to check them in parallel, although it will avoid
147           running multiple filesystem checks on the same physical disk.
148
149           fsck does not check stacked devices (RAIDs, dm-crypt, ...) in
150           parallel with any other device. See below for
151           FSCK_FORCE_ALL_PARALLEL setting. The /sys filesystem is used to
152           determine dependencies between devices.
153
154           Hence, a very common configuration in /etc/fstab files is to set
155           the root filesystem to have a fs_passno value of 1 and to set all
156           other filesystems to have a fs_passno value of 2. This will allow
157           fsck to automatically run filesystem checkers in parallel if it is
158           advantageous to do so. System administrators might choose not to
159           use this configuration if they need to avoid multiple filesystem
160           checks running in parallel for some reason - for example, if the
161           machine in question is short on memory so that excessive paging is
162           a concern.
163
164           fsck normally does not check whether the device actually exists
165           before calling a filesystem specific checker. Therefore
166           non-existing devices may cause the system to enter filesystem
167           repair mode during boot if the filesystem specific checker returns
168           a fatal error. The /etc/fstab mount option nofail may be used to
169           have fsck skip non-existing devices. fsck also skips non-existing
170           devices that have the special filesystem type auto.
171
172       -C [fd]
173           Display completion/progress bars for those filesystem checkers
174           (currently only for ext[234]) which support them. fsck will manage
175           the filesystem checkers so that only one of them will display a
176           progress bar at a time. GUI front-ends may specify a file
177           descriptor fd, in which case the progress bar information will be
178           sent to that file descriptor.
179
180       -M
181           Do not check mounted filesystems and return an exit status of 0 for
182           mounted filesystems.
183
184       -N
185           Don’t execute, just show what would be done.
186
187       -P
188           When the -A flag is set, check the root filesystem in parallel with
189           the other filesystems. This is not the safest thing in the world to
190           do, since if the root filesystem is in doubt things like the
191           e2fsck(8) executable might be corrupted! This option is mainly
192           provided for those sysadmins who don’t want to repartition the root
193           filesystem to be small and compact (which is really the right
194           solution).
195
196       -R
197           When checking all filesystems with the -A flag, skip the root
198           filesystem. (This is useful in case the root filesystem has already
199           been mounted read-write.)
200
201       -T
202           Don’t show the title on startup.
203
204       -V
205           Produce verbose output, including all filesystem-specific commands
206           that are executed.
207
208       -?, --help
209           Display help text and exit.
210
211       --version
212           Display version information and exit.
213

FILESYSTEM SPECIFIC OPTIONS

215       Options which are not understood by fsck are passed to the
216       filesystem-specific checker!
217
218       These options must not take arguments, as there is no way for fsck to
219       be able to properly guess which options take arguments and which don’t.
220
221       Options and arguments which follow the -- are treated as
222       filesystem-specific options to be passed to the filesystem-specific
223       checker.
224
225       Please note that fsck is not designed to pass arbitrarily complicated
226       options to filesystem-specific checkers. If you’re doing something
227       complicated, please just execute the filesystem-specific checker
228       directly. If you pass fsck some horribly complicated options and
229       arguments, and it doesn’t do what you expect, don’t bother reporting it
230       as a bug. You’re almost certainly doing something that you shouldn’t be
231       doing with fsck. Options to different filesystem-specific fsck’s are
232       not standardized.
233

ENVIRONMENT

235       The fsck program’s behavior is affected by the following environment
236       variables:
237
238       FSCK_FORCE_ALL_PARALLEL
239           If this environment variable is set, fsck will attempt to check all
240           of the specified filesystems in parallel, regardless of whether the
241           filesystems appear to be on the same device. (This is useful for
242           RAID systems or high-end storage systems such as those sold by
243           companies such as IBM or EMC.) Note that the fs_passno value is
244           still used.
245
246       FSCK_MAX_INST
247           This environment variable will limit the maximum number of
248           filesystem checkers that can be running at one time. This allows
249           configurations which have a large number of disks to avoid fsck
250           starting too many filesystem checkers at once, which might overload
251           CPU and memory resources available on the system. If this value is
252           zero, then an unlimited number of processes can be spawned. This is
253           currently the default, but future versions of fsck may attempt to
254           automatically determine how many filesystem checks can be run based
255           on gathering accounting data from the operating system.
256
257       PATH
258           The PATH environment variable is used to find filesystem checkers.
259
260       FSTAB_FILE
261           This environment variable allows the system administrator to
262           override the standard location of the /etc/fstab file. It is also
263           useful for developers who are testing fsck.
264
265       LIBBLKID_DEBUG=all
266           enables libblkid debug output.
267
268       LIBMOUNT_DEBUG=all
269           enables libmount debug output.
270

FILES

272       /etc/fstab
273

AUTHORS

275       Theodore Ts’o <tytso@mit.edu>>, Karel Zak <kzak@redhat.com>
276

SEE ALSO

278       fstab(5), mkfs(8), fsck.ext2(8) or fsck.ext3(8) or e2fsck(8),
279       fsck.cramfs(8), fsck.jfs(8), fsck.nfs(8), fsck.minix(8), fsck.msdos(8),
280       fsck.vfat(8), fsck.xfs(8), reiserfsck(8)
281

REPORTING BUGS

283       For bug reports, use the issue tracker at
284       https://github.com/karelzak/util-linux/issues.
285

AVAILABILITY

287       The fsck command is part of the util-linux package which can be
288       downloaded from Linux Kernel Archive
289       <https://www.kernel.org/pub/linux/utils/util-linux/>.
290
291
292
293util-linux 2.37.2                 2021-07-20                           FSCK(8)
Impressum