1<?xml version="1.0"?>
2<!--*-nxml-*-->
3<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
4  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6<refentry id="systemd-fsck@.service">
7
8  <refentryinfo>
9    <title>systemd-fsck@.service</title>
10    <productname>systemd</productname>
11  </refentryinfo>
12
13  <refmeta>
14    <refentrytitle>systemd-fsck@.service</refentrytitle>
15    <manvolnum>8</manvolnum>
16  </refmeta>
17
18  <refnamediv>
19    <refname>systemd-fsck@.service</refname>
20    <refname>systemd-fsck-root.service</refname>
21    <refname>systemd-fsck</refname>
22    <refpurpose>File system checker logic</refpurpose>
23  </refnamediv>
24
25  <refsynopsisdiv>
26    <para><filename>systemd-fsck@.service</filename></para>
27    <para><filename>systemd-fsck-root.service</filename></para>
28    <para><filename>/usr/lib/systemd/systemd-fsck</filename></para>
29  </refsynopsisdiv>
30
31  <refsect1>
32    <title>Description</title>
33
34    <para><filename>systemd-fsck@.service</filename> and
35    <filename>systemd-fsck-root.service</filename> are services
36    responsible for file system checks. They are instantiated for each
37    device that is configured for file system checking.
38    <filename>systemd-fsck-root.service</filename> is responsible for
39    file system checks on the root file system, but only if the
40    root filesystem was not checked in the initramfs.
41    <filename>systemd-fsck@.service</filename> is used for all other
42    file systems and for the root file system in the initramfs.</para>
43
44    <para>These services are started at boot if
45    <option>passno</option> in <filename>/etc/fstab</filename> for the
46    file system is set to a value greater than zero. The file system
47    check for root is performed before the other file systems. Other
48    file systems may be checked in parallel, except when they are on
49    the same rotating disk.</para>
50
51    <para><filename>systemd-fsck</filename> does not know any details
52    about specific filesystems, and simply executes file system
53    checkers specific to each filesystem type
54    (<filename>/sbin/fsck.<replaceable>type</replaceable></filename>). These checkers will decide if
55    the filesystem should actually be checked based on the time since
56    last check, number of mounts, unclean unmount, etc.</para>
57
58    <para><filename>systemd-fsck-root.service</filename> will activate
59    <filename>reboot.target</filename> if <filename>/sbin/fsck</filename>
60    returns the "System should reboot" condition, or
61    <filename>emergency.target</filename> if <filename>/sbin/fsck</filename>
62    returns the "Filesystem errors left uncorrected" condition.</para>
63
64    <para><filename>systemd-fsck@.service</filename> will fail if
65    <filename>/sbin/fsck</filename> returns with either "System should reboot"
66    or "Filesystem errors left uncorrected" conditions. For filesystems
67    listed in <filename>/etc/fstab</filename> without <literal>nofail</literal>
68    or <literal>noauto</literal> options, <literal>local-fs.target</literal>
69    will then activate <filename>emergency.target</filename>.</para>
70  </refsect1>
71
72  <refsect1>
73    <title>Kernel Command Line</title>
74
75    <para><filename>systemd-fsck</filename> understands these kernel
76    command line parameters:</para>
77
78    <variablelist class='kernel-commandline-options'>
79      <varlistentry>
80        <term><varname>fsck.mode=</varname></term>
81
82        <listitem><para>One of <literal>auto</literal>,
83        <literal>force</literal>, <literal>skip</literal>. Controls
84        the mode of operation. The default is <literal>auto</literal>,
85        and ensures that file system checks are done when the file
86        system checker deems them necessary. <literal>force</literal>
87        unconditionally results in full file system checks.
88        <literal>skip</literal> skips any file system
89        checks.</para></listitem>
90      </varlistentry>
91
92      <varlistentry>
93        <term><varname>fsck.repair=</varname></term>
94
95        <listitem><para>One of <literal>preen</literal>,
96        <literal>yes</literal>, <literal>no</literal>. Controls the
97        mode of operation. The default is <literal>preen</literal>,
98        and will automatically repair problems that can be safely
99        fixed. <literal>yes</literal> will answer yes to all
100        questions by fsck and <literal>no</literal> will answer no to
101        all questions. </para></listitem>
102      </varlistentry>
103    </variablelist>
104  </refsect1>
105
106  <refsect1>
107    <title>See Also</title>
108    <para>
109      <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
110      <citerefentry project='man-pages'><refentrytitle>fsck</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
111      <citerefentry><refentrytitle>systemd-quotacheck.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
112      <citerefentry project='man-pages'><refentrytitle>fsck.btrfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
113      <citerefentry project='man-pages'><refentrytitle>fsck.cramfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
114      <citerefentry project='man-pages'><refentrytitle>fsck.ext4</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
115      <citerefentry project='man-pages'><refentrytitle>fsck.fat</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
116      <citerefentry project='man-pages'><refentrytitle>fsck.hfsplus</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
117      <citerefentry project='man-pages'><refentrytitle>fsck.minix</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
118      <citerefentry project='man-pages'><refentrytitle>fsck.ntfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
119      <citerefentry project='man-pages'><refentrytitle>fsck.xfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
120    </para>
121  </refsect1>
122
123</refentry>
124