lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 18 Mar 2013 11:00:22 -0500
From:	Eric Sandeen <sandeen@...hat.com>
To:	Subranshu Patel <spatel.ml@...il.com>
CC:	linux-ext4@...r.kernel.org
Subject: Re: Recovery and Journalling

On 3/17/13 7:07 AM, Subranshu Patel wrote:
> This question is related to recovery (fsck and xfs_repair) and journalling.
> 
> I powered off (improper shut down) the system when the IO was
> undergoing on mounted EXT4 filesystem.
> 
> After that I powered on my machine and then used fsck on the unmounted
> filesystem. fsck recovered it.
> 
> There are 2 things which I want to confirm:
> 1. Firstly fsck replays the journal for any unfinished inconsistent writes.

e2fsck replays the journal to produce a consistent set of metadata on the fs

> 2. Secondly it checks/repairs the other filesystem corruption.

Not by default

> Correct my understanding if wrong.
> 
> Consider the above scenario for XFS as well. In XFS, i need to mount
> the filesystem, and this automatically replays the journal. After this
> I again unmount the filesystem and run xfs_repair.

There should be no need to run xfs_repair.

> But in EXT4, i have to run fsck mandatorily before mounting my
> filesystem. 

It's not required.

> Please confirm my understanding.

Basic things first:

In general, journaling is metadata only (leaving aside for now ext3/4's "data=journal" option).

Metadata journaling ensures that if your system crashes or loses power, the contents of the filesystem + the contents of the log can be reassembled to produce a consistent set of metadata for the filesystem.  Note that this does NOT imply no data loss; it only guarantees consistency.

After an unclean shutdown (crash or power loss), the journal is replayed in some manner, to regain consistency.

In ext3 & ext4, boot-time fsck can replay the journal in userspace, and performs no other consistency checks if the filesystem wasn't marked as having encountered a runtime error.  When the filesystem mounts, it finds that the journal is clean (thanks to the prior e2fsck).  If e2fsck is *not* run before mount, then the journal is replayed in the kernel at mount time.

XFS has no userspace journal replay.  It happens only in the kernel at mount time.

There should be no need for an actual fsck (e2fsck/xfs_repair) run on a journaling filesystem after a crash; the whole point of the journal (and associated runtime overhead) is to guarantee consistency post-crash.

The only fundamental administrative difference here is that ext3/4 can have journals replayed either by e2fsck or by the kernel during mount; xfs's journal is only replayed by the kernel at mount time.

-Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ