More on filesystems
I had a problems with ReiserFS losing data when power failure occurs.
Finally, I got to learn the details why it might happen:
XFS only does metadata only journalling. ext3, ext4, and reiser3 can do full data journaling. They will also do metadata journaling with ordered writes, and, of course, just plain metadata journaling.
metadata only: If you lose power, the filesystem structure is guaranteed to be valid and does not require an fsck. Actual data blocks may contain garbage.
Metadata with ordered writes: If you lose power, the filesystem structure is guaranteed to be valid and does not require an fsck. The data blocks may or may not contain the very *latest* data. They But they will not be garbage.
Ext3 defaults to ordered. Not sure about reiser3.
So XFS (and JFS) can leave garbage in the datablocks after an upplanned shutdown. But it gets worse. Due to a design decision, on remount, XFS actually nulls out any blocks that were supposed to be written that didn’t actually get written. i.e. if you pull the plug during a write, you are pretty much guaranteed to suffer data loss. If random chance does not leave garbage in a block, the filesystem will thoughtfully zap your data intentionally. This is done for security reasons.
Obviously, ReiserFS 3 does not default to ordered writes, and that’s why I got garbage (parts of different files mixed up). JFS and XFS seem even more dangerous, so I guess I’ll stick with Ext3 from now on.Tweet to @mbabuskov Tweet Milan Babuškov, 2008-03-11