[ntp:questions] Writing the drift file
david at ex.djwhome.demon.invalid
Sun Mar 8 12:21:22 UTC 2015
On 08/03/15 11:01, Mike Cook wrote:
> Current practice appears to be to open and write each new value to a temporary file then unlink the old and rename the temporary file.
> This means that a whole new file structure including new blocks is created each time and the old one freed up. So even in the worst case where the same blocks are allocated on alternated file updates, the effective life of the device is doubled.
I believe that all but the crudest flash devices use copy on write at
the physical level, as part of their wear balancing strategy. Updating
directories as well a the file will increase the wear!
This is complicated because the unit of writes is typically much larger
than allocation unit, so one may sometimes find that, with write
caching, there are less physical writes than implied by the complexity
of the update.
More information about the questions