Data Corruption Problems in Flash on Power Cycle

We are having problems with corrupted script and application files in
FLASH memory seemingly due to power transitions and wonder if anyone has
any tips. We are using Advanced Digital Logic’s PC104 MSM-P5SEV-266 CPU
with 128 Mbyte RAM and a CompactFlash IDE adapter module mapped as a
secondary master drive. We partition and install QNX4.0 into a 128
Mbyte CompactFlash like a normal hard drive, then add our script and
application files. It is mostly our script and application files that
get corrupted on uncontrolled power transitions. The operating system
seems to be spared from corruption. Careful shutdown sequences seems to
reduce or eliminate the problem. We would like to safely be able to
turn the power switch off at any time without data corruption. The
Flash is our only drive. How can we protect the Flash?

Previously, Joe Mator wrote in qdn.public.qnx4:

We are having problems with corrupted script and application files in
FLASH memory seemingly due to power transitions and wonder if anyone has
any tips. We are using Advanced Digital Logic’s PC104 MSM-P5SEV-266 CPU
with 128 Mbyte RAM and a CompactFlash IDE adapter module mapped as a
secondary master drive. We partition and install QNX4.0 into a 128
Mbyte CompactFlash like a normal hard drive, then add our script and
application files. It is mostly our script and application files that
get corrupted on uncontrolled power transitions. The operating system
seems to be spared from corruption. Careful shutdown sequences seems to
reduce or eliminate the problem. We would like to safely be able to
turn the power switch off at any time without data corruption. The
Flash is our only drive. How can we protect the Flash?

Check out the following link:

http://qdn.qnx.com/support/bok/solution.qnx?9561


Basically, you want to do the following:

Run Fsys with “-d 0” to force data to be written immediately.
Run chkfsys on reboot to fix damage to the file system.
Use fflush() and fsync() to force data to the disk.

  • Pete