Windows Mobile 中文件处理的鲁棒性,防止断电(数据恢复)
我正在为 windows mobile 6 编写 ac# .net CF 应用程序,它执行一些文件处理。我想知道是否有任何内置方法可以使文件处理在电源故障时具有鲁棒性。 例如,如果在写入文件时发生断电,则文件内容应该完好无损(可能会丢失断电时正在写入的数据,但不会丢失文件中已经存在的数据)。 下次通电时,文件内容应与断电前一样存在。
提前致谢。
I am writing a c# .net CF application for windows mobile 6, which does some file handling. I wanted to know if there is any built-in way to make the file handling robust against power failure.
For instance, if there is a power failure while writing the file, the file contents should be intact without corruption(maybe there is loss of the data being written at the time of power loss, but not already existing data in the file).
The next time the power is up, the file contents should be present as before the power failure.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据我多年来使用大量工业 Windows Mobile/Windows CE 设备(Symbol/Motorola、Toshiba、Intermec 等)的经验,您无法保证本地存储上的数据完整性。发生电源故障事件后,数据通常会部分损坏,或更常见的是完全消失。这实际上并不是 Windows Mobile 的错 - 这只是闪存存储子系统的构建方式所致。它们在干净电源开/关时是“非易失性”的,但正在进行的写入时的电源故障通常是致命的。当有人过度耗尽电池电量时,我们当前的 Symbol/Moto WM6 设备就会变砖,每隔几周就需要重新刷新。
如果您有一个大部分可用的网络,我建议尽可能使用特定于设备的网络存储(例如文件共享、网络服务等)卸载或扩充您的本地存储。
底线:这些设备上的非易失性存储很方便,不应该被信任为重要的长期存储。
In my experience with numerous industrial Windows Mobile/Windows CE devices over the years (Symbol/Motorola, Toshiba, Intermec, etc), you can't guarantee much of anything around data integrity on the local storage. After a power failure event, the data will often be partially corrupted or, more frequently, completely gone. This isn't really the fault of Windows Mobile- it's just the way the flash storage subsystems are built. They're "non-volatile" on clean power on/off, but power fail on in-progress writes is usually fatal. Our current Symbol/Moto WM6 devices get bricked and need reflashing every few weeks when someone drains the battery too far.
If you have a mostly-available network, I'd suggest offloading or augmenting your local storage with device-specific network storage where possible (eg fileshare, webservice, etc).
Bottom line: non-volatile storage on these devices is a convenience and shouldn't be trusted with important long-term storage.