public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* Question about fsck for ext4
@ 2025-04-29 13:25 John Zakrzewski
  2025-04-29 14:46 ` Darrick J. Wong
  2025-04-29 16:31 ` Theodore Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: John Zakrzewski @ 2025-04-29 13:25 UTC (permalink / raw)
  To: linux-ext4@vger.kernel.org

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!

John Zakrzewski
Software Engineer
Azure Core
jozakrzewski@microsoft.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about fsck for ext4
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2025-04-29 14:46 UTC (permalink / raw)
  To: John Zakrzewski; +Cc: linux-ext4@vger.kernel.org

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!

Running fsck on any journalled filesystem shouldn't be necessary if
they've stopped the practice of snapshotting unfrozen filesystems.

But these days, maybe you /want/ to run fsck in dryrun mode to detect
maliciously corrupt filesystem images before mounting them?

--D

> John Zakrzewski
> Software Engineer
> Azure Core
> jozakrzewski@microsoft.com
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about fsck for ext4
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2025-04-29 16:31 UTC (permalink / raw)
  To: John Zakrzewski; +Cc: linux-ext4@vger.kernel.org

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-29 16:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox