QNX RTOS v4 Knowledge Base
QNX RTOS v4 Knowledge Base
Title |
Compact Flash Data Corruption |
Ref. No. |
QNX.000010472 |
Category(ies) |
Filesystem |
Issue |
We would like to safely be able to turn the power switch off at any time without data corruption. How can we protect the Compact Flash?
|
Solution |
To gain performance, some data items are cached (write-behind). If you intend to have unexpected power outages you must disable this (with a corresponding reduction in performance). Typically filesystem metadata is written immediately, but the user contents are delayed unless explicitly flushed (hence you see the contents corrupt, not the file size etc).
Note that with CF there are erase cycles, and unexpected power loss during one of those will leave a sector/cluster with CRC errors (and Fsys.eide makes no attempt to detect/repair this). To make all writes non-delayed, pass the "-d0" option to Fsys. To make all writes on a particular filesystem synchronous, pass "-s" to mount (or the "-m sync" to Fatfsys if you're using that). The degree to which these features work as advertised increases with Fsys versions.
When a system is not powered down properly, there will always be a chance of data corruption. Incorporating a UPS into your system(s) is the only sure way to protect your systems from data corruption in the event of a power failure.
|
|