Difference between revisions of "CompactFlash"

From Koala
Jump to: navigation, search
m (7 revisions: importing from spammed wiki - part 1)
 
(2 intermediate revisions by 2 users not shown)
Line 24: Line 24:
  
 
JFFS2 is only applicable if you have flash that is directly addressable by the CPU.  
 
JFFS2 is only applicable if you have flash that is directly addressable by the CPU.  
 +
 +
=== SD/CF card wear out ===
 +
 +
Rootfs on SD or CF without some tweaks should wear out the SD pretty quickly. Some users on a forum had the same issue after 3 weeks using Debian: http://plugcomputer.org/plugforum/index.php?topic=1074.
 +
 +
When using SD/CF cards under Linux, it seems to be a good idea to use ext2 vs. ext3 because ext3 causes even more writes for the journal. You should also consider using the deadline elevator for SD cards, telling it to focus on reads while collecting write requests in the cache for some time. Try using the following script in /etc/rc.local to get this done when booting:
 +
 +
 +
<pre><nowiki>
 +
for i in /sys/block/mmcblk*/queue; do
 +
  echo deadline >$i/scheduler
 +
  echo 5000 >$i/iosched/write_expire
 +
  echo 500 >$i/iosched/read_expire
 +
  echo 1 >$i/iosched/fifo_batch
 +
  echo 4 >$i/iosched/writes_starved
 +
done
 +
</nowiki></pre>
 +
  
 
== Possible solution ==
 
== Possible solution ==
  
 
Mount your filesystem in readonly mode or better, adopt an embedded Linux distribution like '''KaeilOS''' http://www.kaeilos.com
 
Mount your filesystem in readonly mode or better, adopt an embedded Linux distribution like '''KaeilOS''' http://www.kaeilos.com

Latest revision as of 09:53, 26 September 2012

Limiti di utilizzo di una Compact Flash

Many people would like to install a full Linux distribution (like Debian or Ubuntu) on a Compact Flash and ask what is the best filesystem to use on the CF. Our suggestion is: don't do it

If you are aware about it and you want to try the best choice you can do is with the simplest filesystem: ext2

Be careful: The CF can be damaged when power goes down while writing. This has nothing to do with the file system. The CF might be damaged so badly that in needs factory reformatting before it's accessible again.

Even worse: The CF manufactures don't provide any specification how long it needs power after a write to ensure that the CF data will not be damaged. So even a hardware based solution is not possible. The CF card does wear handling internally, so there is no use in trying not to write too often to the same address (which can be ensured eg by JFFS2). You just need to switch off maintaining the last access date (and whatever read statistics).

(This was already discussed here several times and no solution was found.)

SD card with JFFS2 or YAFFS

SD-cards behave in the same way as CF cards, as they have internal wear leveling. http://en.wikipedia.org/wiki/Flash_memory#Memory_wear

Don't use an journaling file system on flashcards with internal controller (SD,MMC,CF), as they give your product a shorter lifetime because of accelerated wear out.

JFFS2 is only applicable if you have flash that is directly addressable by the CPU.

SD/CF card wear out

Rootfs on SD or CF without some tweaks should wear out the SD pretty quickly. Some users on a forum had the same issue after 3 weeks using Debian: http://plugcomputer.org/plugforum/index.php?topic=1074.

When using SD/CF cards under Linux, it seems to be a good idea to use ext2 vs. ext3 because ext3 causes even more writes for the journal. You should also consider using the deadline elevator for SD cards, telling it to focus on reads while collecting write requests in the cache for some time. Try using the following script in /etc/rc.local to get this done when booting:


for i in /sys/block/mmcblk*/queue; do
  echo deadline >$i/scheduler
  echo 5000 >$i/iosched/write_expire
  echo 500 >$i/iosched/read_expire
  echo 1 >$i/iosched/fifo_batch
  echo 4 >$i/iosched/writes_starved
done


Possible solution

Mount your filesystem in readonly mode or better, adopt an embedded Linux distribution like KaeilOS http://www.kaeilos.com