Reason for ubi filesystem corruption

こ雲淡風輕ζ 提交于 2021-01-27 23:31:59

问题


I have used ubi filesystem and mtd subsystem to work on the top of NAND flash. It was working fine.

But now I'm finding the following errors:

UBI error: ubi_io_read: error -74 while reading 516096 bytes from PEB 2701:8192, read 516096 bytes

end_request: I/O error, dev mtdblock5, sector 49160

what is the reason for those errors which I have mentioned above? How to recover from these error?


回答1:


Both shows I/O errors which is related to corruption or bad block on your NAND Flash, try using another flash and use it. You can also try erasing flash and trying it again.

Thanks & Regards,
Alok Thaker




回答2:


Error -74 is EBADMSG. Looking at ubi.h we can see,

  • UBI_IO_FF: the read region of flash contains only 0xFFs
  • UBI_IO_FF_BITFLIPS: the same as %UBI_IO_FF, but also also there was a data integrity error reported by the MTD driver (uncorrectable ECC error in case of NAND)
  • UBI_IO_BAD_HDR: the EC or VID header is corrupted (bad magic or CRC)
  • UBI_IO_BAD_HDR_EBADMSG: the same as %UBI_IO_BAD_HDR, but also there was a data integrity error reported by the MTD driver (uncorrectable ECC error in case of NAND)
  • UBI_IO_BITFLIPS: bit-flips were detected and corrected

Each UBI block is a flash erase block (typical 128K) and these blocks have two UBI headers which are a pages size (typical 2k). When this page was read, there was an error. Which was not recoverable via the error correcting codes or ECC.

If you are using UBI on top of UbiFs, these blocks should be scheduled to be tortured. This involves erasing and re-writing the erase block. Flash can go stale if it is read many times. The bits can flip and require that the data be re-written. It may turn out that the UBI header just needs to be re-programmed and the flash will be fine.

If not, all NAND mtd drivers have a bad block table. In the case the data is really not recoverable, the erase block will be marked bad in this table and Ubi should no longer use this sector.

If the error persists then this is a possible issue. However, it is somewhat expected with normal use of NAND flash. Typical cycles are 1,000 to 100,000 for NAND flash. After a certain amount of wear it is possible that the flash can be totally unusable. This depends on the flash type, the file system (and wear leveling), and the applications on the system.

A mis-configured flash driver can cause these errors. Improper ECC code for the flash can cause pre-mature errors (flash provides space for 4bit ECC, but driver only implements 1bit for instance). It can also be caused by a bad application that constantly fsync() the disk every 1ms-100ms; this type of behavior will wear the flash in a few years even with all of the other components being optimal. Ubi should have some of the best wear leveling available. If you constantly re-flash an image, you can discount the ubi wear leveling and cause this kind of issue.



来源:https://stackoverflow.com/questions/19559468/reason-for-ubi-filesystem-corruption

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!