comparison Linux & administration
ext4 journal modes and crash windows
Compare the same ext4 crash point in ordered, writeback and journal modes. What does a metadata commit tell you about the file data, and what still depends on a successful sync?
What it means
An ext4 journal commit does not, by itself, mean the newest file contents will survive a crash. In ordered mode, ext4 journals metadata and writes the relevant file data before committing that metadata. In writeback mode, it journals metadata without requiring that order. In journal mode, both the data and the metadata are part of the journal transaction.
Consider a report that grows by one paragraph. The new text is file data. The information that describes the file, including where its contents belong, is metadata. Replaying a committed metadata change can restore consistent filesystem bookkeeping. Whether that commit also tells you something about the paragraph depends on the mode.
Try it
Simulation: Compare one transaction on reliable storage. The commit marker is the point at which the metadata transaction is committed. The example does not inspect or change a filesystem.
ext4 journal modes and crash windows
Compare metadata journaling, data ordering and crash recovery assumptions
Ordered mode stipulates relevant data write before metadata commit.
Stipulated commit boundary
- Metadatacommitted
- Journal modeordered
- Separate durable-data observationNot evaluated / established
Data conclusion
- Data evidenceordered before commit
The modeled journal mode only constrains the stated crash-window observation. It is not a recovery test or a universal application durability guarantee.
Evaluated inputs
- Required scenario evidence
- provided
- Metadata commit evidence
- committed
- Journal mode
- ordered
Not evaluated: Data persistence evidence
One relevant transaction, reliable storage and mode contract assumed, not a filesystem recovery simulator; no mount commands or exact data recovery.
About this model
The controls set only a local, bounded scenario. The computed branch is not a verdict about a live system. Inputs listed as not evaluated did not participate in this branch after validation.
Reset restores the original inputs. It does not change the open or closed state of help or FAQ answers.
- Start with Journal mode set to
ordered, Metadata commit evidence tocommitted, Data persistence evidence todurable, and Required scenario evidence toprovided. The result isordered before commit. The mode and the commit establish that order; the separatedurableselection is not used. - Change only Journal mode to
writeback. The result is nowdurable, but for a different reason: the example supplies independent evidence that the data persisted. The metadata commit did not establish it. - Keep
writebackand change Data persistence evidence tounproved. The metadata commit stays in place, but the data result changes tounproved. That means you cannot conclude that the paragraph survived. It does not mean the paragraph was lost.
Reset returns all four choices to the starting example. Without the controls, you can follow the same comparison above: first change the mode, then change the evidence while holding the crash point fixed.
Reading the commit marker
Suppose the crash is just after the same metadata commit in all three modes. Set aside any independent evidence about the paragraph. What does the commit itself tell you?
| ext4 mode | What is in the journal transaction? | What follows for the paragraph? |
|---|---|---|
ordered | Metadata | The relevant data write preceded the commit. The paragraph need not be in the journal. |
writeback | Metadata | The commit does not establish whether the relevant data write preceded it. |
journal | Metadata and relevant file data | The paragraph is included in the committed journal transaction. |
The distinction between ordered and journal is where to look for the assurance: in the order of two events, or in the contents of one transaction. Neither conclusion extends to later edits that were not part of this transaction.
Now put the crash on the other side of the marker. With Metadata commit evidence set to uncommitted, there is no committed metadata change to reason from. The simulation does not use the mode in that case; it reports only the separate data evidence. That is different from setting Required scenario evidence to missing: then the simulation cannot establish the scenario at all and gives no data or metadata result.
With committed metadata and the writeback mode, changing the separate data observation from durable to unproved changes the reported evidence without changing the commit flag. In ordered mode the data-order premise follows the stipulated journal boundary instead. The independent durable-data selector is not a second measurement in that branch. Keep a journal ordering statement separate from a conclusion about a particular recovered file.
In practice
When evaluating a claim such as “the report was saved,” first identify what must survive: the changed bytes of an existing file, or also a new name in its containing directory. On Linux, a successful file fsync flushes the file's modified data and associated metadata, subject to the storage device honoring the request. It does not necessarily persist the directory entry. A successful ordinary write is not evidence of a successful sync; the application needs to check the result of the synchronization operation relevant to its requirement.
Use the journal mode to answer a question about a particular commit, not to predict the exact text of a recovered file. If all you know is that metadata was recoverable, the useful next evidence is which transaction contained the change, what synchronization completed, and what the storage device was assumed to honor. Without that link to the application's write, consistent metadata is not proof of the newest contents.
Frequently asked questions
Editorial questions based on the listed sources and explicitly labeled local examples.
Is journaling a backup?
No. Ext4 journaling supports recovery of journaled changes within its documented mode; it is not an independent recoverable copy of all file data. The example assumes one transaction and does not model loss of the device.
Does ordered mode journal all file data?
No. Ordered mode places a data-ordering requirement around the associated metadata commit; it is not the mode that journals all file data. The example is not an application-specific recovery test.
Does writeback order data before metadata?
No. ext4 data=writeback does not impose ordered mode's ordinary data-before-metadata rule. Metadata journaling alone does not establish persistence or ordering of every recent file-data write.
Does fsync still matter?
Yes. A journal's recovery properties and the application's durability requirement are different. An application must use the appropriate synchronization operation and check its result; a successful ordinary write alone is not proof of persistence.
Sources & model boundaries
Primary references used for this explanation. The interactive example is an educational model, not a live check.
- Linux ext4 journal
Journal modes. ext4 journal modes differ in data ordering. Metadata journaling alone does not establish persistence of all recent file data.
Checked .
- fsync(2)
DESCRIPTION. Successful file fsync flushes data and associated metadata, but does not necessarily persist the containing directory entry.
Checked .