Which Filesystem is Best for CompactFlash? 100
HungWeiLo asks: "We're currently using a Debian-based distribution for an embedded device where we're placing our primary kernel and filesystem on a 1GB CompactFlash card. The kernel will be placed in a read-only partition, while the other partition will be used for logging actions in the system and hosting a flatfile database. The concern here is the need to journalize the data (ext2 corrupts pretty badly since we power it on and off), and the need to minimize thrashing of the CompactFlash (we're using industrial-strength, million-write-cycle+ versions, but that can quickly get us into trouble if the filesystem constantly writes to the flash). Does anyone have any experience using filesystems in this situation? Which one should I look into for this type of application? Ext2? Ext3? Reiser? JFFS2? Help!"
A little large for JFFS2, but that is being fixed (Score:4, Interesting)
So if you can wait a bit, then JFFS2 is probably the right answer.
Re:Odd, ext2 works well for me (Score:4, Interesting)
While we update a couple files a few times a month, we're not writing a database to the cf over and over.
Still, we like the CF based solution-- if we have a hard ware failure, it's quick to swap out, and if the CF fails, we have archives of the file systems made automatically weekly so it's just a matter of untarring to a disk, re lilo'ing, and install.
Unwriteprotecting a CF card? (Score:2, Interesting)
Re:Doesn't CF already do this for you? (Score:3, Interesting)
It sounds like the OP requires journalling - so I'd suggest just choosing any journalling FS that you're comfortable with (and don't worry about whether/not it re-writes sectors a lot, as the CF card will take care of that for you).
Re:A solution in search of a problem. (Score:0, Interesting)
do you ever need to delete a file? (Score:1, Interesting)
there was a slashdot story about such a filesystem a while ago:
http://linux.slashdot.org/article.pl?sid=05/10/04
and a quick googling turned up a paper on the idea:
http://www.hpl.hp.com/personal/Alistair_Veitch/pa
-- kieran hervold
Damnsmalllinux agrees with you. (Score:1, Interesting)
If you're using dsl on a compact flash, you're advised to do a frugal install. DSL reads from the cf on boot but then runs completely in memory. The flash is almost never written and only read once per boot. The result is that it should live forever.
As you note, a journaling file system will trash your cf reasonably fast. As for Reiser, he's been charged with murder and the future of the file system is somewhat in doubt. http://en.wikipedia.org/wiki/Hans_Reiser [wikipedia.org]
Ramdisk (Score:2, Interesting)
Obviously, any important changes should be written, but any FS should work for that, since you probably only will need to write on database change, and/or OS shutdown.
Re:Beware journaling on flash. (Score:2, Interesting)
Wear leveling will have the effect of keeping the writes evenly distributed across the flash. What it won't do is save you from reaching your max-write counts. While many flashes are good for 1000+ writes per block, writing a journal entry for each change is going to dramatically increase the speed you reach that number.
Further, I'd point out that you shouldn't be writing to the CF much except during the setup phase. The reason you want a journal is to recover from a failure before the disk is fully written to and synced; if you never write to the disk, what is a journal saving you from?
I personally have great experience with EXT2 on CF, so it's what I recommend.
Re:Unwriteprotecting a CF card? (Score:1, Interesting)
Anyway, had a similar problem with a SD card for a Canon camera. I inserted it into a Sony laptop, and the camera wouldn't recognize the card from that point on. As far as I was able to determine, Canon uses a non-standard format for their cards. I think they set a reserved bit (or register) on the card. It was a pain-in-the-ass, but there are free utils to help.
Here are some links that I found useful.
http://www.engatiki.org/2005/04/28/4 [engatiki.org]
http://www.engatiki.org/flashrecover [engatiki.org]
http://acmedigitalphotography.com/blog/?p=105 [acmedigita...graphy.com]
http://wwww.mckeay.net/secure/2004/10/using_dd_to
Good Luck.
ext3 in full journaling mode (Score:2, Interesting)
Re:A solution in search of a problem. (Score:3, Interesting)
You'd still have to mount it in synchronous mode so the kernel doesn't do any write caching. External journals only go so far. Journals guarantee filesystem consistency, but not data consistency. So you could still have a journal that says that a transaction was written to disk but that was actually in-flight in the buffer cache. At least flash parts don't do write reordering, so it's not as bad as it could be, but journaling to SRAM is still only half the problem.