how does 'mv' command work in jffs2/NAND

Manu Rao MRao at AlienTechnology.com
Tue Dec 16 19:01:45 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 has a length of
zero. My conjecture was that this had to do with the write-buffering,
and when I add a sync after the move, I don't see the problem anymore.

My boss, whose a hardware guy, insists that if we have a FileA that is
being replaced with a FileB, we should always have access to either
FileA or FileB, and that agrees with how I thought JFFS2 worked. 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
PS: Please ignore previous posting without subject.



More information about the linux-mtd mailing list