[Soekris] flash wear with FreeBSD fifolog
ticso at cicely7.cicely.de
Sat Aug 9 10:53:23 UTC 2008
On Fri, Aug 08, 2008 at 09:41:40PM +0000, Poul-Henning Kamp wrote:
> In message <200808082020.m78KKtAP009832 at lava.sentex.ca>, Mike Tancsa writes:
> >I am working on our next rev of nanobsd and was looking to
> >incorporate FreeBSD's fifolog program for more persistent logging. It
> >seems to take care not to write out to flash too often so as to
> >reduce wear. With modern day flashes, (I am using SanDisks), what
> >can I expect in terms of lifetime ? Also, if I create a partition
> >just for the logs, and lets say I wear out part of the flash, will
> >there be any impact to my OS partition which is read only ?
> Very pointed and relevant questions, which flash vendors absolutely
> refuse to give us the data to answer.
Some additional data about NAND-flash chips, which are typically
used in most flash based media.
NAND-chips contain many data blocks, which are only writeable as
a whole unit.
Todays blocksizes are typically 4-8k, so if you write a logical
512 sector the media physically has to do a read-modify-write.
Each block is slightly bigger than 2^n to allow a CRC.
The flash chips are divided into blocks that are 100% error free and
can survive higher write cycles, while the rest is possibly not error
free and wear out faster.
Flash media vendors don't tell much about their algorithms, but
all of them rotate the data in the bad blocks and store the allocation
in the good blocks, which are possibly not rotated.
The details how they use the blocks are vendor specific.
The problem are the allocation information as each allocation block
has the allocation data for many k of logical data.
You can easily get a CRC read error for a logical block far away from
the block which was written during power fail.
So a rw partition can harm a ro partition - at least for power failures,
which I've seen quite often in practice with all vendors I'd used.
Warner had forcibly wear out a CF many years ago and the result was
that the media turned into a complete ro.
He redid the test with a more recent media and stopped it after many
weeks of continues writing.
I don't think wearing out a media is a real risk today, but power
loss in the wrong moment is still a problem and with growing Flash
block sizes the risk is growing.
Unfortunately you can't locate your ro and rw partitions reliable in a
way that they don't collide using shared allocation blocks, because
vendors don't even tell you about this problem, not to speak about
the layout pattern they use.
The only media type where you now everything are SmartMedia, because
they were smart enough to not include additional logic - they just
put a NAND-flash chip into a card and left everything, including the
wear rotation, to the reader.
B.Walter <bernd at bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.
More information about the Soekris-tech