Memory cache losing sync with disk

Solution 1:

If the md5sum of a file changes, there are several possible explanations, in order of likelyhood:

  • The file was written to.
  • Your RAM is defective (or another motherboard component, but RAM is by far the most failure-prone).
  • Your storage is defective. (Unlikely because defective storage usually leads to unreadable file, not corrupted data.)
  • A kernel bug, perhaps in the filesystem code. (Highly unlikely with ext4.)

Note that “inconsistency between disk and cache” is a symptom, not a cause. It's not even a symptom you observed: what you observed was a difference between memory at time T and memory at time T'.

If you're sure the file wasn't being modified, then defective RAM is the most likely explanation. Memory tests don't always detect bad RAM, unfortunately. If you can get two different copies of the file, compare them (cmp -l file1 file2); if the differences are aligned (e.g. the differences are always on the 42nd bit of a 16-byte sequence) or consist of displaced blocks (the sign of corruption occurring to a pointer variable), all signs point to defective RAM.