LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 09-08-2006, 08:21 PM   #1
idol007
LQ Newbie
 
Registered: Sep 2006
Posts: 9

Rep: Reputation: 0
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?

Thanks for any useful input!
 
Old 09-08-2006, 09:09 PM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
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.
 
Old 10-11-2006, 05:33 PM   #3
idol007
LQ Newbie
 
Registered: Sep 2006
Posts: 9

Original Poster
Rep: Reputation: 0
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?
 
Old 10-11-2006, 10:43 PM   #4
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
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.
 
Old 12-19-2007, 02:24 PM   #5
BartVG
LQ Newbie
 
Registered: Sep 2007
Location: Gent, Belgium
Distribution: Slackware
Posts: 14

Rep: Reputation: 0
Quote:
Originally Posted by blackhole54 View Post
...

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.
 
Old 12-19-2007, 05:11 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,991
Blog Entries: 54

Rep: Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744Reputation: 2744
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.
 
Old 12-19-2007, 10:02 PM   #7
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
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.
 
  


Reply

Tags
ext3, filesystem, journal


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding ext3 journal @ root stitchman Slackware 1 08-29-2006 08:32 AM
Ext3 journal corruption? Arkanoid Linux - Hardware 10 10-12-2005 05:02 AM
EXT3-fs: error loading journal canyon289 Fedora 2 06-23-2005 03:02 PM
Remove journal from ext3 ilikejam Linux - General 12 03-02-2004 12:53 AM
Turning off the ext3 journal? Phaethar Red Hat 2 02-04-2004 10:43 AM


All times are GMT -5. The time now is 02:55 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration