fat16lib vs SD standard library

SdFat does not sync automatically. The cost of sync is very high and it is best to do it on a 512 byte boundary.

If you call sync in the middle of a block the current data block is written to the SD, the directory block is read, updated, and written. The data block must be reread during the next write. A sync costs 2048 bytes of IO in this case. You save 1024 bytes of I/O if you sync on a 512 byte boundary.

Sadly there is no simple option but to use sync when the user can just cut power. We don't do it on a PC, Linux, or Mac.

There is a way in SdFat to write at very high speed without sync but it is very complex. You can create a very large contiguous file and erase it with special calls. You then do raw writes to the file to avoid file system overhead. This is how I record audio in the WaveRP library Google Code Archive - Long-term storage for Google Code Project Hosting.. After the file is recorded I find the last recorded block of the file using a binary search and truncate the file to the correct size using the truncate() function.

This way I can recover the file if the user cuts power.