From Koala
Jump to: navigation, search

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.

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:

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

Possible solution

Mount your filesystem in readonly mode or better, adopt an embedded Linux distribution like KaeilOS