umount and data is lost?
Amos Shapira
amos.shapira at gmail.com
Sat Nov 5 23:21:21 IST 2011
On 6 November 2011 08:12, Diego <elcuco at kde.org> wrote:
> Hi list,
>
> I am trying to debug this problem in a system I am developing:
>
> at some point I need to write a number to a file, and then reboot via an
> external device the machine. That device will cut of the power for a
> moment,
> and the machine will power on again (this is to overcome a fault we could
> not
> overcome otherwise). Before the reboot, I "umount" the proper partition and
> then "sync".
>
> For some reason, on one machine we see that the data is not updated and the
> original data is kept in the file. I konw empirically that if I add a
> "sleep(5)" after the umount, and before the "reboot" the data is written to
> the disk.
>
Disk write cache without battery backup is the first thing that comes to
mind.
Check your disk's specifications and how to control the cache.
> Any tips how to debug this?
> * the system is a TI 2.6.32 kernel (OMAP)
> * the data is saved using fopen()
> * disk is umounted using system("umount /data"), and then I call from C to
> sync();
>
Why not a direct umount(2) call?
--Amos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20111106/ee19dd6d/attachment.html>
More information about the Linux-il
mailing list