#MicroSD info

This page contents the results of some test we are doing to better understand what happen 
on microSDs in some trouble cases reported by some FOX Board G20 customers.

##List of test case

<div class="expandable" markdown="1" title="Continuous writing up to fill the /media/data partition with fixed lenght files and timer interrupt each 0.1 ms ">
@insert='test_2012_10_05.md'
</div> 

<div class="expandable" markdown="1" title="Continuous writing up to fill the /media/data partition with fixed lenght files ">
@insert='test_2012_09_13.md'
</div> 

<div class="expandable" markdown="1" title="Rought shutdown">
@insert='test_2011_06_24.md'
</div> 

<img src="./benchtest.jpg">

#Useful info

Make the red led on the FOX Board G20 (PC7) flash when the mmc card is being accessed:

<pre class="minicom">
echo mmc0 > /sys/class/leds/user_led/trigger 
</pre>

* [Flash memory card design](https://wiki.linaro.org/WorkingGroups/Kernel/Projects/FlashCardSurvey)
* [Flash storage remapping](https://wiki.linaro.org/WorkingGroups/Kernel/Specs/flash-storage-remapping)
* [Optimizing Linux with cheap flash drives](https://lwn.net/Articles/428584/)
* [SDCard Testing](http://wiki.laptop.org/go/SDCard_Testing)
* [FlashBench](http://git.linaro.org/gitweb?p=people/arnd/flashbench.git)

#Useful links 

##I/O stress test utilities:

* [Stress](http://weather.ou.edu/~apw/projects/stress/)
* [Stressapptest](http://code.google.com/p/stressapptest/)
* [IOzone Filesystem Benchmark](http://www.iozone.org)
* [IOzone Examples for Disk I/O Performance Measurement on Linux](http://www.thegeekstuff.com/2011/05/iozone-examples/)

IOzone, Stress and Stressapptest are available as Debian packages.

#Unordered notes

##Comandi provati da Antonio Galea

<pre class="minicom">
apt-get install stress
# aggiungere "contrib non-free" ai repo debian
apt-get install iozone3 stressapptest
# file da 5Mb con record di 32Kb, debug del sistema di I/O
iozone -a -s 5M -r 32 -+d
# test con 16 processi che scrivono file di 5Mb
stress -d 16 --hdd-bytes 5M
# test con 16 processi e file di 10M, con carico elevato su cpu ed I/O
stress -c 2 -i 4 -d 16 --hdd-bytes 10M
</pre>

##Opzioni per il mount di ext4:

* [Ext4 Kernel doc](http://www.kernel.org/doc/Documentation/filesystems/ext4.txt)

Per diminuire le possibilita' di problemi (a discapito della performance, naturalmente):

* data=journal, journaling anche dei dati, non solo  dei metadati
* commit=1, sync del journal ogni secondo (il default e' ogni 5)

##Possibili modifiche al rootfs

Possibili modifiche al root fs per mitigare i problemi di corruzione diminuendo le scritture:

* [Aufs](http://aufs.sourceforge.net)
* [Log to RAM](http://www.debian-administration.org/articles/661)
* [Read only rootfs](http://wiki.debian.org/ReadonlyRoot)
* [Ubuntu Aufs](https://help.ubuntu.com/community/aufsRootFileSystemOnUsbFlash)

