Re: Re: Please help me to evaluate flash/ssd life using vmstat -d
On Fri, 2011-02-04 at 12:34 -0600, R. Ramesh wrote:
> I run a debian firewall on an atom PC running of a 16G flash drive. I
> am trying understand the amount of disk write performed in order to
> understand how long my flash is likely to last.
> Note that the kernel writes do not translate into equivalent size writes
> into the flash. This is because flash has to be always written in
> multiples of erase block units (or write allocation size or some such
> thing). So I like to know how to translate above writes into number of
> erase-block writes.
Assuming you have a standard SSD drive attached via SATA or the like,
then you can't make any association between writes issued by the kernel
and the actual NAND device writes inside the drive. This is all
abstracted by the SSD controller which will have a fancy flash
translation layer to do wear levelling and bad block management.
I do not have SSD. I have a USB flash drive - went cheap on this :-)
Regardless of the above, still every write by the kernel has to be
translated in to NAND writes. I have read in more than one place that
these writes will be in units of erase-block size regardless of the
kernel IO size. I am simply trying to map the X kernel writes in to Y
erase-block writes. Note that I do not map it specific erase-block, but
to some erase-block. So I only worry about the block counts not the
block addresses. That is why my calculations are based on total number
of erase-blocks writes available (= 16G/512k*10000 = 327680000) before
the device goes bad. So to me the life of flash is 327680000 erase-block
writes. Now how many hours is it? To answer this, I need to understand
what vmstat -d prints.
Obviously I want to know how many writes are done by the kernel in a
given hour (on the average).
Assuming that the flash controller is (very) smart to distribute the
writes 100% evenly, you calculate the life dividing one by the other.
Obviously, I do not know how to translate the output of vmstat -d to
actual disk IO seen by the flash controller. Does it see it as X IOs
from the "total" column or as Y IOs from the sectors column? Grossly
taking each IO as a erase-block write I can calculate the life.
Of course the above assumes that the controller is so smart that it
makes every one of the 327680000 writes available to kernel before it
declares flash is dead. I need this assumption to abstract the
underlying controller algorithm.