2

Suppose I create a number of directories on SSD, then issue a "sync" call.

The sync call will guarantee that any writes, even if they are stored in the write cache, will be flushed to disk by the time the sync call returns, right?

jj172
  • 123
  • 4
  • 3
    Only if the specific hardware is behaving according to the relevant specifications. It is my understanding that a lot of domestic-grade disk drives ignore any instructions to flush their cache. See also [this answer](https://serverfault.com/a/925597/94065). – Harry Johnston Apr 26 '19 at 03:35

1 Answers1

3

There is no real way to know that. Each drive may do different things and there is no one to keep the vendors accountable.

The enterprise drives will ensure that your data can be written to disk on power off with internal capacitors intended for this purpose. The consumer grade drives usually have no such guarantee and you are their mercy if their flush command implementation really does write the data to the media.

Your only way to know is to test the specific drives you intend to work with.

Baruch Even
  • 1,043
  • 6
  • 18