Hardware / Linux : optimize SdCard (nand flash) speed and lifetime

sd-card-recovery

I recently created a new NAS server using a sheevaplug (article to come…) and a 8Gb Sdcard for the system partition.

Maybe you know that partitioning and formatting sdcard should be done carefully to get best speed and lifetime. This require to respect the both erasure block and segment size : this is exactly what I made and what is this article about.

I used the “flashbench tool” from : https://github.com/bradfa/flashbench.

Usage

./flashbench -a /dev/mmcblk0  --blocksize=1024

Note that I sometime need top launch it several times to get consistent values (eg: non negative time). Based on the flashbench author’s explanation, I could find:

  • erasure block : biggest value for which the time become near the double of the previous one. In my case it was 4Mb
  • segment size (block size) : smallest value for which the time become significantly higher than the previous one. For me : 4k

Then, simply calculate all the needed informations to partition with fdisk and format with ext4. I made  an  M$ Excel sheet to define parameters for every SDCard I use (file is attached to this post)… Note that I commented out the file for easier usage… ;)

flash memory settings calculator

Small benchmarks

For Bigfiles :

sync; rm bigfile; sync; time ( dd if=/dev/zero of=bigfile bs=16k count=10000; sync) ; rm bigfile

Before optimization I got : 18.2 and after I had 21.9. Ok, that’s not so much, but look further for small files…

For small files:

sync; rm -rf smallfiles_*; sync; time ( for i in `seq 1 100`; do dd if=/dev/zero of=smallfiles_$i bs=16k count=10; sync; done; ) ; rm -rf smallfiles_*

Before optimization, I got 148 Mb/s and after : 184 Mb/s !

Questions or comments?

Join the discussion on Discord, ask a question or share your experience.

Discuss on Discord
  1. ChatGPT Image Jan 30, 2026, 07_13_27 PMXMG Pro 16 m25 under Linux: Maximum GPU Power and Gaming Performance
  2. 20250128_224935Cloud at home with minimum toil - PXE / Proxmox / Saltstack / k3s
  3. featuredRaspberry pi powered wall mounted tablet