0

I'm using C# & the compact framework on an embedded device to log data to a compact flash card. Because data integrity is of upper most importance, I'm wondering how to write the data to the flash disk. Will files get lost/damaged if power is lost during a write/flush or while the file is opened? What's the best way to do this?

By the way, the card uses FAT32 as file system if that's important.

greetings, Korexio

  • it will depend to some extent on the actual hardware.... – Mitch Wheat Aug 03 '09 at 12:48
  • So which algorithm would you prefer? 1.) open - write - close for each data packet or 2.) open - write - flush - write - flush - close Or is it irrelevant because the files will get damaged either way (worst case)? How can I find out how my hardware will handle the case of power loss while a file is written? –  Aug 03 '09 at 14:00

1 Answers1

0

If performance is not an issue, I personally would prefer to use the first method which is OPEN-WRITE-CLOSE. FAT32 is really vulnerable to data damage during write operation.

Adrian
  • 524
  • 7
  • 18