Maximum Capacity for microSD Card used with Arduino+SD module: 2GB or 32GB?

card5:
Is there maybe some article about how to optimally write to a card using Arduino and a microSD card module?

Both SD and SdFat already do that, and in fact is the reason why they take a good chunk of RAM. By it's function is called a "disk cache" (often wrongly called a buffer), an space in RAM used to record pending changes to a disk sector, in order to waste less time and minimize wear by saving ("flushing") big changes at once instead of small consecutive ones.

So, writting a single byte should not update immediately the physical medium, unless:

  • The library has to work with another sector (every 512 bytes).
  • flush() is called afterwards.
  • The file is closed afterwards.

One downside of this is when those changes reside only in cache and for whatever reason the system powers-off or resets; the new data will be essentially lost.
Thus, with any mass-storage medium there's always that trade-off between reliability and performance.