Changes

Jump to: navigation, search

MISC-TN-017: Persistent storage and read-write file systems

1,295 bytes added, 13:53, 20 January 2021
Example: embedded Linux system equipped with a raw NAND flash memory and UBIFS file system
UBI partition expected remaining life in percentage can be calculated with a simple formula:<syntaxhighlight lang="text">
RL = ((MaxEC * nr_blocks) - sum(EC)) / (MaxEC* nr_blocks)) * 100</syntaxhighlight>Where :* <code>MaxEC</code> is the maximum erase count supported by raw NAND.* <code>nr_blocks</code> is the count of PEB that are contained on this partition
E.g. in case of a "standard" SLC NAND, which usually have 100k maximum erase count, this can be implemented as simple bash pipe between <code>ubidumpec</code> and <code>awk</code><syntaxhighlight lang="bash">
ubidumpec /dev/ubi0 | awk -v MAXEC=100000 '{ s+=$1; n=n+1} END {print s, n*MAXEC, (((n*MAXEC)-s)/(n*MAXEC))*100 }'
</syntaxhighlight>This command prints:
* number sum of blocks EC (in this <code>/dev/ubi0</code> partition)* total number of erase/program cycle allowed by this partition* expected lifetime left to be used (in percentage) Running on a (nearly) 1GiB partition on a brand new SLC NAND flash gives<syntaxhighlight lang="text">root@axel:~# ubinfo /dev/ubi0ubi0Volumes count: 3Logical eraseblock size: 126976 bytes, 124.0 KiBTotal amount of logical eraseblocks: 8112 (1030029312 bytes, 982.3 MiB)Amount of available logical eraseblocks: 0 (0 bytes)Maximum count of volumes 128Count of bad physical eraseblocks: 0Count of reserved physical eraseblocks: 160Current maximum erase counter value: 2Minimum input/output unit size: 2048 bytesCharacter device major/minor: 248:0Present volumes: 0, 1, 2 root@axel:~# ubidumpec /dev/ubi0 | awk -v MAXEC=100000 '{ s+=$1; n=n+1} END {print s, n*MAXEC, (((n*MAXEC)-s)/(n*MAXEC))*100 }'8161 811200000 99.999</syntaxhighlight>
*
As confirm of this data, the maximum EC of a given UBI partition can be read directly from <code>sysfs</code><syntaxhighlight lang="text">
root@axel:~# cat /sys/class/ubi/ubi0/max_ec
2
 
</syntaxhighlight>
737
edits

Navigation menu