Linux – How to format an SD card with a more robust Linux-usable filesystem with a specific cluster size for better write performace

ext3fat32filesystemslinuxsd card

Goal: microSD card formatted…

  • for best write performance
  • for use only with embedded Linux
  • for better reliability (random power failures may occur)
  • using an 64kB cluster size

I'm using an 8GB microSD card for data storage inside an embedded Linux/ARM device. The SD card is not removable. I've been using ext3 instead of the pre-installed FAT32 because it seems to better handle random power failures during writes. However, I kept noticing that my write performance is always best with the pre-installed FAT32 from Kingston. If I reformat the card with FAT32, the performance still suffers. After browsing wikipedia, I stumbled upon the following comment saying that some cards are optimized for specific cluster sizes. In my case, the Kingston comes pre-formatted for an 64kB cluster size.

Risks of reformatting

Reformatting an SD card with a different file system, or even with the same one, may make the
card slower, or shorten its lifespan. Some cards use wear leveling, in which frequently
modified blocks are mapped to different portions of memory at different times, and some
wear-leveling algorithms are designed for the access patterns typical of the file allocation
table on a FAT16 or FAT32 device.[60] In addition, the preformatted file system may use a
cluster size that matches the erase region of the physical memory on the card; reformatting
may change the cluster size and make writes less efficient.

Best Answer

Most SD cards (as well as USB drives) out there are optimised for use with FAT32. Using them with any other FS will cause your performance to suffer.

More info at LWN.

Related Question