JFFS2 CRC Errors Under Linux – KBA219678

Version: **



Why do i get CRC errors with JFFS2 under Linux? 



Cyclic Redundancy Check (CRC) errors with JFFS2 do not necessarily indicate a problem. In some cases, such as after a power drop during an ongoing write operation, these are normal and will disappear after some time. To understand this, a deeper look at JFFS2 is required.

A JFFS2 flash file system is composed of a sequence of data nodes that describe the underlying directory structure as well as the data files in the directories. Whenever a directory or a file is updated, new nodes are written to flash. If the directory or file already exits, old nodes are obsoleted by the newly written nodes. A simple checksum (CRC) is used to guarantee the consistency of the individual nodes. If power drops while a new node is programmed into flash, then its CRC will be wrong after re-powering the system. JFFS2 detects this and prints a CRC error message in the Linux system log. The JFFS2 mount process simply skips the affected node and continues without using the data from the skipped node. This means that all new but incomplete information of the node is lost, reverting the directory or file to its prior state. This logic removes bad/incomplete nodes that can cause processing or corruption issues. After the next system start, you will see the directory or file as it was before the interrupted program operation. The partial node with the incorrect CRC is considered dirty space and is going to be cleaned up automatically by the JFFS2 garbage collector after some time. 

In some cases, however, a lot of CRC errors may appear without power drops (i.e., if the JFFS2 file system is always correctly unmounted before power OFF). In this case, the CRC errors may indicate an I/O problem with the flash. Even though symptoms of the I/O problem appear as JFFS2 errors, there is nothing wrong with JFFS2. To further investigate this, simple tests using “dd” to write and read large data sets to and from the raw MTD device (e.g., /dev/mtd0) are recommended. Any verification errors you see during these tests are from the I/O problem, not from any problem with JFFS2.