EMMC with unblanced block erase count
We developed some embedded Linux products which write data log 24h*7 to 8GB eMMC chips. When reading the block erase counts of every block inside the eMMC chips by sending the CMD56 command. We found the erase counts distributed not balance. For example, from block number 50-83, it is about 6000 times each block. Other blocks are about 500 times for each block.
.
According to my knowledge, the eMMC has FTL(Flash Translation Layer) and Wear Levelling function are inside its own firmware. So, the erase counts should be somehow equal to an average number no matter how many are the partition numbers and how large is each file system. Am I right here? Now we have 3 partitions: P1:250MB(rootfs), P2:250MB(backup rootfs), P3:6.7GB(data). If my understanding is wrong. How can we improve the eMMC write levelling(increase eMMC's lifetime)? Thanks.
Writes may well be redistributed across the entire device but there are caveats.
- Blocks that are TRIM'ed by your operating system are actively considered "free" and available to be rewritten. Those blocks will simply be erased during time when the device is idle and returned to the pool of blocks available for use.
- Assuming TRIM is enabled, blocks that are written are unlikely to be actively read and rewritten elsewhere. If you have a lot of very rarely written data, such as your operating system partitions, then those blocks are likely to have far lower writes.
- If TRIM is disabled then the device will have to figure out least recently used blocks, read the data, write it elsewhere, then erase the block. This will have a significant performance penalty compared to a known empty block.
With TRIM enabled I would still expect to see some areas which show lower writes.
It is possible that your filesystem has TRIM enabled for newly deleted data but is not reporting the full filesystem empty blocks for the device, resulting in a small area being excessively written as data gets written, deleted, the blocks reliably TRIM'ed and then reused.
Apparently
sudo fstrim -v /
might help. Replace /
with your mount point for the data partition. If it comes back with a significant area TRIM'ed then it might be a benefit to run occasionally. I believe Windows TRIMs empty space on a weekly or monthly basis.
Command from Ask Ubuntu