Let's say I have a disk with a lot of partitions formatted with many different file systems.

I very rarely write data to it but I very often read data from it.

Now I'd just want to know what I can do, at the FS level or at the OS level (read only...) to avoid data-loss in the very specific case of power-loss. No UPS.

As a bonus question, as my knowledge of FS is scarce, what makes a given file system more resilient to data corruption? I guess there are references, but I could not find one about file systems in general.

  • 2
    Read about journaling file systems. Even though the journal will ensure that the FS integrity is maintained, I don't see how you can prevent data corruption completely in case of sudden power loss while a file is being written to. Also see here for more.
    – Karan
    Jan 9, 2013 at 17:41
  • Yes, this is something I've heard about. But this is really standard nowadays : every recent FS that I can think of provides journaling. Let me just give you a bit of background: I have a disk formatted with FS foo. I was ONLY watching a film (no other IO). Power loss. Result: a directory containing 26 films was wiped out. fsck found inconsistencies but my films were nowhere to be found. This is what I call data corruption or, more rigorously, FS corruption. And this is what I want to avoid. BTW foo provides a journal.
    – user183734
    Jan 9, 2013 at 17:48
  • Where foo = ext4? I'll leave it to the FS experts to provide a detailed answer, since I don't know of any way you as an end user can improve upon a journaling FS' resilience to data corruption in case of a catastrophic event such as sudden power loss during I/O.
    – Karan
    Jan 9, 2013 at 17:53
  • Where foo is unknown since I just had an interesting discussion with another user about another question I've asked and had been closed almost immediately since it would have raised "endless and useless discussions".
    – user183734
    Jan 9, 2013 at 17:59
  • Yeah, I saw your What're the most useful attributes of a filesystem to avoid data loss? question just now. I don't know whether this question will remain open or be classified as a duplicate of that one.
    – Karan
    Jan 9, 2013 at 18:01

1 Answer 1


How can you tune your file system? Probably you can't.

If you just care about power loss, mount all the file systems as read only. Most problems on power loss are unfinished writes and they won't happen if nothing is written.

If you need more, what you can do is to use a file system that checks the data on read. The problem is: If you don't have any redundancy, if a error is detected, nothing can be done to get the data back. You just know that there is an error.

So what you would need is to store the data redundant so in case of corruption. There are file systems that allow to store multiple copies of the same file on the same drive, but that's really not advisable. So you should use more than one drive.

With more drives you could also use RAID, but with RAID if the data on multiple drives differs, there is no way to know which one is the correct one. Modern file systems calculate a hash code of every file (or parts of files) and compare them on reading. If the hash doesn't match, the file is read from another location where it is hopefully still correct and the wrong data is replaced. So this file systems repair themself.

File systems that support this are ZFS, BtrFS, ReFS and others. I only ever used ZFS.

You must log in to answer this question.