Please help me to evaluate flash/ssd life using vmstat -d
All,
 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. I have two vmstat -d 
information on the flash
   2011-01-31 00:35
   disk- ------------reads------------ ------------writes----------- 
-----IO------
          total merged sectors      ms  total merged sectors      ms    
cur    sec
   sda    10624   4770  352041   16848   2532    464   70880  
546908      0     36
   sda1   10621   4767  351993   16844   2532    464   70880  
546908      0     36
   2011-02-03 16:01
   disk- ------------reads------------ ------------writes----------- 
-----IO------
          total merged sectors      ms  total merged sectors      ms    
cur    sec
   sda    10736   4827  357265   17084   9649   1621  206984 
1057928      0     76
   sda1   10733   4824  357217   17080   9649   1621  206984 
1057928      0     76
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. I could simply use number of sectors as the number 
of erase blocks and get a very conservative estimate. This way I get 
136104 erase blocks in 88 hours. Assuming erase block is 512K and flash 
can deal with 10K writes per block before it dies, I calculate 
(16G*10000)/(136104*512K)*88 hours of life. This is 211866 hours or 24 
years. Plenty for me.
But, I really do not like being this conservative. So, I like to know if 
the number of writes under the column titled "total" refers to the 
number of kernel writes in which each write is a single disk IO for 
contiguous group of sectors. If so, I can assume that each such write 
will cause at most two erase-block writes on the flash giving me a life 
of (16G*10000)/((9649-2512)*2*512K) * 88 hours. This is 2020165 hours or 
230 years. While I do not need this much life out of the flash, I like 
to know which one is closer.
I have not done any optimization for the flash like aligned partitioning 
and use of tmpfs. However, I have used noatime mount option which 
reduced the number of writes by an order of magnitude or more.
Ramesh
Reply to: