Estimating flash life by reading EC (Erase Counters)

Mats Kärrman Mats.Karrman at tritech.se
Tue Apr 22 00:13:14 PDT 2014


On Monday, April 21, 2014 10:48 PM, Richard Weinberger wrote:
> On Mon, Apr 21, 2014 at 9:41 PM, David Yat Sin <jd.yatsin at gmail.com> wrote:
>> Hi,
>> My goal is to be able to estimate the flash drive life in a production
>> environment, so if there is a better/easier way of achieving this,
>> please let me know.
>>
>> I have a small embedded device using NAND than runs UBIFS for the user
>> partition. Our application constantly writes to log files, the log
>> files are appended and gzip'ed, so it is hard to determine how much
>> data is actually written to disk.
>>
>> I am hoping to do this by:
>>
>> 1. Read the EC (Erase Count) headers for each page on the partition
>> 2. Let my system run for several days/weeks/months
>> 3. Read the EC headers again
>> 4. Then extrapolate drive life expectancy by comparing number of erase
>> counts with the NAND endurance.
>>
>> Is there a utility that I could use to read the Erase Counters on a
>> UBIFS partition?
>
>IIRC ubinfo can tell you the value of the highest EC.

Same value can be found using:

cat /sys/class/ubi/ubi0/max_ec

As you probably know, both max and mean value can be found in the kernel message log after a reboot, e.g.:

UBI: max/mean erase counter: 10/7

BR // Mats



More information about the linux-mtd mailing list