Journal Files
Journal files are a common solution to the problem of how to quickly achieve the goal of committing data to disc so one does not lose data - but doing so quickly keeping in mind that file I/O is more efficient in large chunks.
Data is committed frequently to the journal file before being saved into other locations - so this means that if power is lost, the system can replay the journal file to recover data.
Key concept with journal files is we don’t let them get very large - once the data has been confirmed written to the other locations the journal file should be deleted.
See https://en.wikipedia.org/wiki/Transaction_log in Wikipedia.