JFFS2 losing files on mount

Marco Braga
2009-01-21T09:29:11Z

Hi,

I am doing some power failure tests on an ARM7 based device using
JFFS2 on NAND flash and I am a bit disappointed by the early results.
At the moment I've done only some informal tests so I don't have a
detailed bug report or logs to provide. Information gathered on the
net gave me the impression that JFFS2 could withstand repeated power
failures without major damages. Losing last written data is not a
problem, but preserving filesystem consistency is.

The worst situation happened to me is a JFFS2 file system that keeps
loosing files after mount. This is what happened: After a lot of power
cycles, errors during mount are increasing (nothing really strange:
lost inodes, ECC errors, etc.), but infos on the internet say that
they must be considered "warnings". After last reboot, all the files
in the JFFS2 partition are lost on mount. Not a good situation...
I copy some more files in the fs, without any apparent problem. If I
read back them, they are ok. I sync the file system, check the files
again. Everything seems fine. Then I umount the partition, and mount
it back again. The same errors appear and the content of the file
system is lost again. All previous files are lost. This happened every
time I retried the same thing on that partition. At the end I had to
erase the partition and rebuild the JFFS2 file system again.

Disappearing file is not a good thing, but a filesystem that loses all
files every time it is mounted is even worse.

I'd like to hear your experiences. What do you think?

Regards,
Marco