Data loss on unclean powercycle with JFFS2/NAND

Manu Rao MRao at AlienTechnology.com
Wed Dec 17 19:48:25 EST 2008


We have an embedded system with ARM9, running linux 2.6.22 and jffs2 on
Samsung nand.
As part of our bootup process, we modify the /etc/inittab so that the
getty login screen is replaced with our application.

  if sed "/^#*T0/cT0:23:respawn:/sbin/getty -L -n -l /our_app/app ttyS0"
/etc/inittab > /etc/inittab_tmp; then
	mv /etc/inittab_tmp /etc/inittab

We have recently discovered units where the inittab suddenly becomes a
zero-length file. My conjecture was that this had to do with the
write-buffering, and when I add a sync after the move, it helps
somewhat.

The way I understood jffs2, if we have a FileA that is being replaced
with a FileB, we should always have access to either FileA or FileB. But
without any doubt, inittab is getting zeroed out.

How does a move in the Filesystem occur? How can the size become zero?

Any pointers appreciated.

Thanks
Manu Rao
San Jose, CA



More information about the linux-mtd mailing list