From: "Theodore Ts'o" <tytso@mit.edu>
To: John Zakrzewski <jozakrzewski@microsoft.com>
Cc: "linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>
Subject: Re: Question about fsck for ext4
Date: Tue, 29 Apr 2025 12:31:48 -0400 [thread overview]
Message-ID: <20250429163148.GA3354408@mit.edu> (raw)
In-Reply-To: <DS1PR21MB4166208B2E5F4D23F547E349DF802@DS1PR21MB4166.namprd21.prod.outlook.com>
On Tue, Apr 29, 2025 at 01:25:35PM +0000, John Zakrzewski wrote:
> Hi! We are using the k8 utils opensource
> project(https://github.com/kubernetes/utils) and looking for your
> thoughts on an issue where fsck is being run on every remount and if
> this is necessary for journaling filesystems. Eric Sandeen's
> comments
> here(https://github.com/kubernetes/utils/pull/132#issuecomment-605492335)
> indicate it is not but wanted to verify with you that his statements
> apply to ext4 as well. Ultimately I am looking for reassurance to
> relax the need for fsck on mounts for ext4. I look forward to
> hearing your thoughts and please don't hesitate to ask clarifying
> questions. Thank you!
Normally, when you run fsck.ext4 on a file system with journalling
enabled, all fsck.ext4 will do is replay the journal. This is fast,
and the advantage of doing this by fsck as opposed to replaying the
journal at mount time is if you have multiple spindles (HDD's),
/sbin/fsck will run multiple /sbin/fsck.ext4 in parallel, while
/sbin/mount -a will run the mounts sequentially, leading to the
journals being replayed sequentially.
XFS doesn't have the capability of replaying the journal in userspace,
so this is an advantage of ext4 --- although XFS uses logical
journalling so usually the time to replay the journal is smaller than
ext4's physical journalling, so the disadvantage of replaying the
journal sequentially versus in parallel is not that big of a deal for
XFS.
The other advantage of running fsck on the file system is if the
kernel discovers a file system inconsistency, it will set a flag
indicating that fsck should do a full check. If you skip running fsck
at boot, then this automatic correction happen. Of course, this
shouldn't be an issue if you are 100% certain that there are no
hardware faults, and no kernel bugs. :-)
However, if the file system is not marked as having inconsistencies,
then the time to replay the journal is in general only a few seconds
if you are using a HDD, and less than a second if you are using a SSD.
And if the journal has already been replayed, running fsck -p on a
file system is super fast (well under a second), so long as the file
system is error-free.
So I'm not sure it's worth it for you to "relax the need for running
fsck", because the time to run fsck is quite short.
Now, if you are seeing that the fsck time is non-trivial, you should
investigate why that is the case. Because that is definitely not
normal.
- Ted
prev parent reply other threads:[~2025-04-29 16:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-29 13:25 Question about fsck for ext4 John Zakrzewski
2025-04-29 14:46 ` Darrick J. Wong
2025-04-29 16:31 ` Theodore Ts'o [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250429163148.GA3354408@mit.edu \
--to=tytso@mit.edu \
--cc=jozakrzewski@microsoft.com \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox