why is ext3 mounted without barrier enabled by default ?

Asked by lemonsqueeze on 2013-01-06

i made a rather unpleasant discovery after being hit by a power failure recently:

I'd been working on a git repository some time before that. Not only did i lose the previous commit, but the repository itself got corrupted to a point where i'd have lost quite a bit of work had i not made a backup on another computer.

Now losing the previous commit is fine. disk data is cached in memory so we're going to lose stuff on power failure no matter what. but the corruption ... i really thought ext3 journalling would have protected against that.

Now it turns out the ext3 section of mount(1) has some interesting bits:

"barrier=0 / barrier=1
This enables/disables barriers. barrier=0 disables it, barrier=1 enables it. Write barriers enforce proper on-disk ordering of journal commits, making volatile disk write caches safe to use, at some performance penalty. The ext3 filesystem does not enable write barriers by default. Be sure to enable barriers unless your disks are battery-backed one way or another. Otherwise you risk filesystem corruption in case of power failure."

I was horrified (as any other sane software engineer would be i expect).

Why would they do that ???
Performance it seems, according to the kernel mailing list:
  http://lkml.indiana.edu/hypermail/linux/kernel/0805.2/1470.html

Maybe for perf critical ups backed servers this could make some sense, but for desktop use it seems to me there's just no question: Make it safe by default, and let people take risks if they *really* want to.

Unfortunately unbuntu (lucid and precise) doesn't save the day, and ext3 is mounted without barrier=1 by default. Is there any compelling reason not to do so ?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu util-linux Edit question
Assignee:
No assignee Edit question
Solved by:
lemonsqueeze
Solved:
2013-01-07
Last query:
2013-01-07
Last reply:
2013-01-06
lemonsqueeze (lemonsqueeze) said : #1

Actually precise uses barrier=1 by default, but it doesn't show up in mount output (have to dig in /proc/mounts). not so for lucid however.

I suggest you report a bug, Lucid server has a long life yet :)

lemonsqueeze (lemonsqueeze) said : #3