ubifs: handling dirty data (writing back) + power cuts
Rafał Miłecki
zajec5 at gmail.com
Mon Feb 28 05:36:19 PST 2022
On 25.02.2022 15:17, Rafał Miłecki wrote:
> My actual problem is related to ubifs behaviour for power cuts happening
> between 5 and 35 seconds after saving a file:
> date > /mount/ubifs/test.txt && sleep 15 && echo CUT POWER *NOW*
>
> On the next boot test.txt exists but it's EMPTY (file size 0).
>
> For newly created files above behaviour is not the worst one - however
> I'd expect such file to not exist at all.
>
> The biggest problem is when dealing with existing files. In such case
> power cut means loosing it completely. I don't get *old* content nor
> *new* content.
To make it clear what I meant by dealing with existing files:
[fist boot]
# echo foo > /mount/ubifs/test.txt
# sync
# cat /mount/ubifs/test.txt
foo
# busybox sed -i 's/foo/bar/' /mount/ubifs/test.txt && sleep 10 && echo CUT POWER NOW
CUT POWER NOW
[next boot]
# ls -l /mount/ubifs/test.txt
-rw------- 1 root root 0 Feb 28 02:26 /mount/ubifs/test.txt
More information about the openwrt-devel
mailing list