LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   ext3 journal (https://www.linuxquestions.org/questions/linux-kernel-70/ext3-journal-481738/)

idol007 09-08-2006 08:21 PM

ext3 journal
 
Hi all,

I need help to understand how ext3 "ordered" mode works. I've read that this mode journals only metadata, but writes the data to disk before the metadata is written. Does this mean that if the system crashes (i.e., power failure) before the data is written to disk, it is still possible to get filesystem inconsistency because only the metadata exists in the journal on the subsequent boot? Or is ext3 smart enough to know not to replay that transaction from the journal? Or have I totally misunderstood how ordered mode works? :confused:

Thanks for any useful input!

blackhole54 09-08-2006 09:09 PM

If the system crashes during or before the data (not metadata) is written, it is as if nothing was ever written, because the metadata will never be copied from the journal, so the data will have nothing pointing to it. If the crash happens while the metadata is being copied from the journal, then the actual data is already on the disk, and when the system reboots it simply has to finish writing the journaled metadata to the disk. So you always end up with either all or nothing. Never a partial.

There are some good, detailed explanations (including all of the record keeping so it knows where it was when the crash occured) of this on the web, but I don't have a link handy.

idol007 10-11-2006 05:33 PM

Thanks!

But another question that may not be specific to ext3... When a file is opened for writing, will the future changes be written on the same disk blocks, or will the filesystem allocate new disk blocks?

blackhole54 10-11-2006 10:43 PM

Quote:

Originally Posted by idol007
But another question that may not be specific to ext3... When a file is opened for writing, will the future changes be written on the same disk blocks, or will the filesystem allocate new disk blocks?

I wish I knew the answer to that! My guess is it does depend on the filesystem (although ext2 and ext3 probably do it the same way) and it may depend upon the circumstances. For ext2/ext3 the answer may, in part, be tied up with their strategy to minimize fragmentation.

Perhaps somebody with more understanding will post the answer. :)

BartVG 12-19-2007 02:24 PM

Quote:

Originally Posted by blackhole54 (Post 2415317)
...

There are some good, detailed explanations (including all of the record keeping so it knows where it was when the crash occured) of this on the web, but I don't have a link handy.

That's very unfortunate, because I can't find those good, detailed explanations.

unSpawn 12-19-2007 05:11 PM

I just read this GCFA Taking advantage of Ext3 journaling (etc, etc). It explains internals and his examples use journal=ordered. Maybe interesting maybe not.

blackhole54 12-19-2007 10:02 PM

Sorry about not having those links handy. IIRC, when I posted that, I had within the previous several weeks seen a couple such articles. In addition to what unspawn posted, this paper presented at the Ottawa Linux Symposium, 20 July, 2000, might (or might not) be of interest. I have only just quickly skimmed it. There is also this IBM Developer Works article, but it looks pretty terse in its explanation.


All times are GMT -5. The time now is 06:52 AM.