Re: about ubifs

Artem Bityutskiy
2009-06-05T16:26:35Z

Hi,

On Fri, 2009-06-05 at 20:13 +0800, tommy wrote:
> Artem,
> What i do is just open an existing file in a UBIFS formated UBI volume
> on a Nand Flash,
>
> add a few lines to it ,close the file ,then without unmounting the
> filesystem and reboot the filesystem.

> When my board reboots and i looked at that file ,it's zero length and
> has no contents.I suspect it's because
>
> UBIFS does less frequent syncs .it just lost content of the file because
> there's no sync before the reboot!
>
> How can i solve this ?

I've realized that the best way to answer your question is to
write a FAQ entry. There is a short answer for your question -
use fsync(). And there is a long answer, which you will find here:

http://www.linux-mtd.infradead.org/faq/ubifs.html#L_empty_file
and the above link also refers this one:
http://www.linux-mtd.infradead.org/doc/ubifs.html#L_sync_exceptions
which I've also created for you.

Enjoy!

--
Best regards,
Artem Bityutskiy (Битюцкий Артём)