Do I have to umount JFFS2?
Hi all,
we're using JFFS2 as rootfs for embedded devices.
Quoted 1 line
From time to time we have to reboot shortly after writing to this fs,
e.g. a firware update is basically copying the new fw to the jffs2 partition and call "reboot".
Now I wonder if it is needed to umount this partition explicitly before rebooting? Or mount it read only first by having
::shutdown:/bin/umount -a -r
in /etc/inittab. Or call "sync"?
Or is the unmounting done by the kernel before actually rebooting? So the system only reboots when all writing to flash is finished?
(I've lately seen corrupt root fs and want to find out if these reboots could cause the trouble...)
Thanks a million!
Signature · 1 line
Steven
Quoted 2 lines · ext Steven Scholz
Now I wonder if it is needed to umount this partition explicitly before rebooting? Or mount it read only first by having
JFFS2 is synhronous except for the write buffer (used with Nand chips). Doing sync is enough and flushes the write buffer.
Jarkko Lavinen
Quoted 8 lines · Jarkko Lavinen
Quoted 2 lines · ext Steven Scholz
Now I wonder if it is needed to umount this partition explicitly before rebooting? Or mount it read only first by having
JFFS2 is synhronous except for the write buffer (used with Nand chips). Doing sync is enough and flushes the write buffer.
Is "sync()" done by the kernel before reboot? Or do I have to call "sync"?
--
Steven
Quoted 10 lines · Steven Scholz
Quoted 6 lines · Jarkko Lavinen
Quoted 2 lines · ext Steven Scholz
Now I wonder if it is needed to umount this partition explicitly before rebooting? Or mount it read only first by having
JFFS2 is synhronous except for the write buffer (used with Nand chips). Doing sync is enough and flushes the write buffer.
Is "
sync()" done by the kernel before reboot? Or do I have to call "sync"?
Hi Steven,
afaik,
and this this is inline with my experience, you have call sync before reboot.
Since I write only complete files to jffs2, I reduced the timer, which flushes the write buffer automatically from 3 seconds to 500 ms. In that case, I normally get no errors even in case of a hard reset.
Otherwise I get some "found empty flash at" and some CRC errors. The filesystem as whole should remain in a stable state in any case (that's the main reason apart from wear levelling for jffs2, I think)
Best regards
Peter
Signature · 3 lines
Peter Menzebach Menzebach und Wolff IT-Consulting GbR Phone +49 751 355 387 1
Hi Steven, Peter,
I would like to put in some problems we are also facing. I had reported it sometime back here also.
On our system, we are observing that files on flash (jffs2 intel cfi nand) are getting corrupted, after a number of resets and say 3 months of usage)
Anyone seen anything like this ? any clues on how one can look into this.
Regards,
Alfred
Quoted 38 lines · Peter Menzebach
Quoted 11 lines · Steven Scholz
Quoted 7 lines · Jarkko Lavinen
Quoted 2 lines · ext Steven Scholz
Now I wonder if it is needed to umount this partition explicitly before rebooting? Or mount it read only first by having
JFFS2 is synhronous except for the write buffer (used with Nand chips). Doing sync is enough and flushes the write buffer.
Is "
sync()" done by the kernel before reboot? Or do I have to call "sync"?Hi Steven,
afaik,
and this this is inline with my experience, you have call sync before reboot.
Since I write only complete files to jffs2, I reduced the timer, which flushes the write buffer automatically from 3 seconds to 500 ms. In that case, I normally get no errors even in case of a hard reset.Otherwise I get some "found empty flash at" and some CRC errors. The filesystem as whole should remain in a stable state in any case (that's the main reason apart from wear levelling for jffs2, I think)
Best regards
Peter--
Peter Menzebach
Menzebach und Wolff IT-Consulting GbR
Phone +49 751 355 387 1______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 10 lines · alfred hitch
Hi Steven, Peter,
I would like to put in some problems we are also facing. I had reported it sometime back here also.
On our system, we are observing that files on flash (jffs2 intel cfi nand) are getting corrupted, after a number of resets and say 3 months of usage)
Anyone seen anything like this ? any clues on how one can look into this.
Hi Alfred,
I have had no non recoverable error here up to now, but I am not representative, since I do not need many permanent writes: I have all permanently changeable informations like configuration files in one rw partition, and all temporary information like log, lock, pidfiles... in the ramdisk. My rootfs stays ro. In my case, I can simply erase the "config-partition", and the board definitely is clean.
I have 2 ideas to your problems:
1. Single files can be still corrupted, when you write them and press reset.
2. Your jffs2 version is from a let's say "not so good time"
What I do not understand (from one of your previous posts): You said, a command file was damaged. Was this file written at generation time of the fs, and then not written any more?
Best regards
Peter
Signature · 3 lines
Peter Menzebach Menzebach und Wolff IT-Consulting GbR Phone +49 751 355 387 1
Hi Peter,
We happened to have our system in rw mode (dont ask me why,I will be embarassed).
Now, we have made it ro.
Files in question happened to be "sh" or libc.so. etc.. basically one which appeared to be in memory at that time before kernel oops or sudden resets etc. So, to answer your question, yes they were from start there. After making ro as ofnow we havent seen any corruptions. But, my head has been looking for a reason as to why would it be executables be ever written back to flash ??
Well jffs2 version we are using happened to be from snapgear 3.0 from net. so I am kinda biased and hoping we arent with a such a broken one.
(How to update to latest btw ? 2.4 backwards compatible ?)
Didnt get this comment of ur's :
1. Single files can be still corrupted, when you write them and press reset.
Regards,
Alfred
Quoted 36 lines · Peter Menzebach
Quoted 10 lines · alfred hitch
Hi Steven, Peter,
I would like to put in some problems we are also facing. I had reported it sometime back here also.
On our system, we are observing that files on flash (jffs2 intel cfi nand) are getting corrupted, after a number of resets and say 3 months of usage)
Anyone seen anything like this ? any clues on how one can look into this.
Hi Alfred,
I have had no non recoverable error here up to now, but I am not representative, since I do not need many permanent writes: I have all permanently changeable informations like configuration files in one rw partition, and all temporary information like log, lock, pidfiles... in the ramdisk. My rootfs stays ro. In my case, I can simply erase the "config-partition", and the board definitely is clean.I have 2 ideas to your problems:
1. Single files can be still corrupted, when you write them and press reset.
2. Your jffs2 version is from a let's say "not so good time"What I do not understand (from one of your previous posts): You said, a command file was damaged. Was this file written at generation time of the fs, and then not written any more?
Best regards
Peter--
Peter Menzebach
Menzebach und Wolff IT-Consulting GbR
Phone +49 751 355 387 1
Quoted 12 lines · alfred hitch
Hi Peter,
We happened to have our system in rw mode (dont ask me why,I will be embarassed).
Now, we have made it ro.
Files in question happened to be "sh" or libc.so. etc.. basically one which appeared to be in memory at that time before kernel oops or sudden resets etc. So, to answer your question, yes they were from start there. After making ro as ofnow we havent seen any corruptions. But, my head has been looking for a reason as to why would it be executables be ever written back to flash ??
I do not know exactly. But a question to the others: Does the wear leveling affect only free blocks, or does it reorganize seldom written used blocks too?
Quoted 8 lines
Well jffs2 version we are using happened to be from snapgear 3.0 from net. so I am kinda biased and hoping we arent with a such a broken one.
(How to update to latest btw ? 2.4 backwards compatible ?)Didnt get this comment of ur's :
1. Single files can be still corrupted, when you write them and press reset.
When you press reset, when a file is written, you get a partly written block. So you get a file, which is not written completely. This corruption is detected by jffs2 and issues warnings. The filesystem as whole stays intact, but the file as such doesn't have the contents you might expect.
Best regards
Peter
Signature · 3 lines
Peter Menzebach Menzebach und Wolff IT-Consulting GbR Phone +49 751 355 387 1
Peter,
Quoted 9 lines
Quoted 4 lines
Didnt get this comment of ur's :
1. Single files can be still corrupted, when you write them and press reset.When you press reset, when a file is written, you get a partly written block. So you get a file, which is not written completely. This corruption is detected by jffs2 and issues warnings. The filesystem as whole stays intact, but the file as such doesn't have the contents you might expect.
Since you're talking about "pressing reset" I have to ask again.
When we do a firmware update of our devices we do something like
cp /tmp/large_file /opt/imc/application
reboot
where /tmp is a ramdisk and / a jffs2 rw rootfs.
So we're not pressing reset but doing a reboot. And I wanted to know if linux does only reboot _after_ all data is correctly written to flash?
Would it make sense to do
cp /tmp/large_file /opt/imc/application
sync
reboot
???
What's the point of having a line
::shutdown:/bin/umount -a -r
in /etc/inittab?
I have
/dev/mtdblock0 on / type jffs2 (rw,noatime) /proc on /proc type proc (rw,nodiratime) devpts on /dev/pts type devpts (rw)
sysfs on /sys type sysfs (rw)/dev/shm on /var type tmpfs (rw) /sys/kernel/debug on /var/tmp/debug type debugfs (rw)
So the only real fs is jffs2. Does it help to unmount it before reboot?
--
Steven
Quoted 47 lines · Steven Scholz
Peter,
Quoted 9 lines
Quoted 4 lines
Didnt get this comment of ur's :
1. Single files can be still corrupted, when you write them and press reset.When you press reset, when a file is written, you get a partly written block. So you get a file, which is not written completely. This corruption is detected by jffs2 and issues warnings. The filesystem as whole stays intact, but the file as such doesn't have the contents you might expect.
Since you're talking about "pressing reset" I have to ask again.
When we do a firmware update of our devices we do something like
cp
/tmp/large_file/opt/imc/application
rebootwhere /tmp is a ramdisk and / a jffs2 rw rootfs.
So we're not pressing reset but doing a reboot. And I wanted to know if linux does only reboot _after_ all data is correctly written to flash?
Would it make sense to do
cp
/tmp/large_file/opt/imc/application
sync
reboot???
What's the point of having a line
::shutdown:/bin/umount -a -r
in
/etc/inittab?I have
/dev/mtdblock0on / type jffs2 (rw,noatime) /proc on /proc type proc (rw,nodiratime) devpts on/dev/ptstype devpts (rw)
sysfs on /sys type sysfs (rw)/dev/shmon /var type tmpfs (rw)/sys/kernel/debugon/var/tmp/debugtype debugfs (rw)
Quoted 6 lines
So the only real fs is jffs2. Does it help to unmount it before reboot?
--
Steven
Hi Steven,
I have not verified this in code, but afaik there is no automatic unmount of the filesystems at remount.
So you should either call sync or unmount the filesystem (which calls implicit a sync)
Best regards
Peter
Signature · 3 lines
Peter Menzebach Menzebach und Wolff IT-Consulting GbR Phone +49 751 355 387 1