← index #1587Issue #11449
Related · high · value 0.292
QUERY · ISSUE

stmhal: os.sync() [apparently] doesn't flush FatFS read buffers

openby pfalconopened 2015-11-05updated 2015-11-21
ports

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.

CANDIDATE · ISSUE

os.sync not present on all platforms, how to be sure of filesystem consistency?

closedby massimosalaopened 2023-05-09updated 2024-06-20
bug

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:

  1. Why is os.sync not implemented on this target?
  2. 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.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied