how ext3 works

Christian Kujau lists at
Wed Dec 19 11:53:34 UTC 2007

On Tue, December 18, 2007 22:11, Bart wrote:
> *Imagine the following situation: you opened a file in vi(m), you are
> editing, but haven't yet saved your work. The system crashes: what will be
>  the result?

If you haven't saved yet, nothing will happen. But since vi(m) will create
a temporary file (.file.swp or something), this file could've made it the
disk already.

> Will the metadata be modified (assume both atime and noatime)? Will
> the data itself be corrupted?

The file itsself should not be corrupt. If it were, it'd have been
replayed from the journal during bootup (fsck) to provide a non-corrupt

> simply be lost)? *What happens when the system crashes during a write to
> the journal? Can the journal be corrupted?

It shouldn't be corrupted. If it were, fsck should be able to fix that,
otherwise I'd consider it as a bug.

> If a crash happens between step 1 and 2, we are in the situation as
> described above (first situation): not yet written If a crash happens
> between step 2 and 3, isn't this the same as writeback?

AFAIK, writes to the journal have to be atomic: either the journal is
updated, or (when it crashes during this operation) it isn't. With
data=ordered, the journal is updated after the the data made it to the
With data=journal, the journal is updated first.

BOFH excuse #442:

Trojan horse ran out of hay

More information about the Ext3-users mailing list