XFS and loss of data when power goes down
Each time electricity goes down, my desktop (without UPS) loses some temporary information.
- Opera can lose settings, history, cache, or mail accounts (Thanks heavens I was wise to use IMAP). Partially or all together.
- a whole file (complete and save) in Geany appeared empty (and I didn't commit it to Git)
- rhythmbox lost all podcasts subscription data
I'm afraid there are other losses I just didn't see.
What's the reason? A memory files cache, a mem-disk? Or non-atomic file writes in xfs? I have Ubuntu 9.10 and XFS on both /
and /home
partitions.
Is ext4 safer in such circumstances? I've seen ext3 is faster. Is it as safe as *4?
Given that the apartment I rent is connected to a common bus and 1 safety switch for several apartments, and the neighbors - alone or together - overload it at least once every week, the lights go down often enough for this to be an issue.
Solution 1:
Answer Updated...
XFS is not a data journaling filesystem, such as ext3 and ext4, it is a meta-data journaling filesystem. The result is a trade-off that (usually) favors speed over reliability.
This article has a good discussion of the current state of XFS. When reading, keep in mind all filesystems are compromises between speed and reliability.
Given your lack of control of the situation, you are a good candidate for buying a small UPS.
Solution 2:
XFS is and always has been a journalling file system. It does not truncate files to a zero length and is the base file system for many enterprise storage appliances.
You do need correctly configured hardware (specifically to make sure volatile write caches are correctly handled in your storage with the barrier mount options).
If you see data loss on any file system, please open a bug report with either your vendor or the upstream developers of the specific file system so we can investigate and try to correct any issue.
Thanks!