ext3 filesystem and data consistency after a crash

500 views
Skip to first unread message

Joao Cardoso

unread,
Feb 12, 2013, 11:23:11 AM2/12/13
to
This is a rather old subject, but only now I noticed that Alt-F
creates and mounts ext3 filesystems using the default "writeback" data mode.

This is the default and faster mode for ext3, but can lead to
data loss upon system crash, e.g., after a power loss.

If you are using the ext3 filesystems and you want to use the
safer "ordered" data mode:

-In Disk->Filesystems, for each filesystem of type "ext3":
 -Edit the "Mount Options" entry field, such that it contains
  "defaults,data=ordered" (without the quotes)
 -In "FS Operations" select "Set Mnt Options"
-In System->Settings:
 -Hit the "SaveSettings" button

You don't need to reboot, and you only need to do this once
for each (new) ext3 filesystem.

Alternatively you can store the mount option permanently in
the filesystem itself using, as the "root" user, the command

   tune2fs -o journal_data_ordered /dev/<device name>


An excerpt from the linux kernel documentation for
the ext3 filesystem:

Data Mode
---------
There are 3 different data modes:

* writeback mode
In data=writeback mode, ext3 does not journal data at all.  This mode provides
a similar level of journaling as that of XFS, JFS, and ReiserFS in its default
mode - metadata journaling.  A crash+recovery can cause incorrect data to
appear in files which were written shortly before the crash.  This mode will
typically provide the best ext3 performance.

* ordered mode
In data=ordered mode, ext3 only officially journals metadata, but it logically
groups metadata and data blocks into a single unit called a transaction.  When
it's time to write the new metadata out to disk, the associated data blocks
are written first.  In general, this mode performs slightly slower than
writeback but significantly faster than journal mode.

* journal mode
data=journal mode provides full data and metadata journaling.  All new data is
written to the journal first, and then to its final location.
In the event of a crash, the journal can be replayed, bringing both data and
metadata into a consistent state.  This mode is the slowest except when data
needs to be read from and written to disk at the same time where it
outperforms all other modes.

Joao Cardoso

unread,
Apr 28, 2012, 3:28:59 PM4/28/12
to al...@googlegroups.com


On Saturday, April 28, 2012 7:27:38 PM UTC+1, Joao Cardoso wrote:
This is a rather old subject, but only now I noticed that Alt-F creates and mounts ext3 filesystems using the default "writeback" data mode.

This is the default and faster mode for ext3, but can lead to data loss upon system crash, e.g., after a power loss

I forget to say that, (of course) in the RC3 release ext3 converted or formated filesystems will use by default data=ordered stored in the filesystem, so none the above procedures is needed.
However, existing filesystem will behave as usual, so you still need to use one of the methods, if you want to.
Reply all
Reply to author
Forward
0 new messages