stmhal: os.sync() [apparently] doesn't flush FatFS read buffers
My time to ask dumb questions. I created a new file on pyboard's internal flash over USB mass-storage . Expectedly, it didn't show up. I issued sync on Linux side, it didn't show up. I unmounted filesystem, and it still didn't show up. I issues os.sync() on pyboard, and it still didn't show up. I had to reboot pyboard to get hold of it. I'd say, unmounting mass-storage and os.sync() should be 100% enough.
os.sync not present on all platforms, how to be sure of filesystem consistency?
Current target: esp8266
On the official docs:
https://docs.micropython.org/en/latest/library/os.html
os.sync()
Sync all filesystems.
It seems to me that there are no references in the esp8266 pages regarding its absence:
https://docs.micropython.org/en/latest/esp8266/quickref.html
I have a long experience on linux and servers, so I know the possible pitfalls about syncing the file-systems and sudden power failures.
However... two questions:
- Why is os.sync not implemented on this target?
- Are there other solutions ?
As a workaround: after writing to the files, I call time.sleep(5) before reset().
It seems to work... but it's a bad trick, not reliable.