Sdcard file system corruption with Nerves

Hi everyone!. I’m having a problem with the rpi 4 and the sdcard. If I am working on newly created files and there is a power outage, when it comes back, the metadata that I created no longer contains those files. So I want to know if there is any way to make a manual backup of the metadata structure or to update it faster than the current one. Or has anyone had a similar problem and how to solve it. Thanks!

You might want to try adding the :sync mode to your File.write/3 call

https://hexdocs.pm/elixir/File.html#t:mode/0

1 Like

This will help me, but if it is a recording process, for example with Gstreamer, how do I make sure that after the process finishes it syncs the metadata?

ok, I already looked for the filesink properties and it has o-sync for Open the file with O_SYNC for enabling synchronous IO

1 Like