Question

Eg when the power supply is cut or someone presses the power button for 5 seconds? How big of a risk am I taking to my data? Is it a 1% chance of corrupting data? I know most mac these days have a Journal-ed File system, so I am guess the risk is very small? Is this an accurate assumption?

Assuming the Mac is writing data, whats the risk of data corruptions?

Assuming the Mac is idling, whats the risk of data corruptions?

Was it helpful?

Solution

The journaled file system practically eliminates the chances that the filesystem itself will be in an inconsistent state after the next reboot. But "consistent" is not the same as "correct".

Before journaling, the filesystem structures themselves could become damaged which could lead to more corruption occurring after the next boot. So journaling limits the damage to whatever files were being written at the time of the crash.

If a file was being written at the time of a crash, the odds of its contents being incorrect are about 100%. Exactly what manner of incorrectness would depend on exactly how it was being written at the time.

If data was simply being appended, then the last few blocks will probably be truncated off when the journal is replayed. But if bits of data were being modified throughout the file (such as in a database store), its likely to be in a very inconsistent state. Applications which write files in that way sometimes have their own consistency checks for that purpose.

But most files in a typical OS X system get written sequentially. In fact, many programs write a temporary file and don't move it in to replace the old version until the new version has been committed to disk. This ensures that even a forced shutdown in the middle of writing a file only loses the new version, but preserves the old one.

Bottom line: something bad will happen to any data being written at the time of a crash, but how bad depends on the application.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top