Re: [SLUG] Protecting linux against loss of power

From: Ian C. Blenke (ian@blenke.com)
Date: Tue May 16 2006 - 17:15:31 EDT


Most journalling filesystems only journal the metadata changes
(filesystem information about the file),
not the actual file data as it is written.

In the old days, you could try mounting ext2 with sync mount.

I suggest disabling drive caching and giving ext3 data journalling a try.

Disabling drive caching _may_ be as simple as "hdparm -W 0 /dev/hda"
You can see the current state of WriteCache with "hdparm -i -v /dev/hda"
It depends on your manufacturer/model, among other things. I have little
experience with this.

To "fix" ext3 to do data journalling, add "data=journal" to your ext3
mount options in /etc/fstab
The default ext3 mode of operation is "data=writeback".

The following is from /usr/src/linux/Documentation/filesystems/ext3.txt:

data=journal All data are committed into the journal prior
                        to being written into the main file system.

data=ordered (*) All data are forced directly out to the main file
                        system prior to its metadata being committed to
                        the journal.

data=writeback Data ordering is not preserved, data may be
                        written into the main file system after its
                        metadata has been committed to the journal.

* writeback mode
In data=writeback mode, ext3 does not journal data at all. This mode
provides a similar level of journaling as 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
perform 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 outperform all others mode.

Hope this helps.

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:03:38 EDT