← Back to Labs

fsync And The Power Cut

Follow a single write() from the application all the way to stable storage, then pull the cord and see what survives.

Where is the data right now?ApplicationbufferVOLATILE[DATA]Kernelpage cacheVOLATILE[DATA]Blocklayer queueVOLATILEemptyDriveDRAM cacheVOLATILEemptyNAND/ platterSTABLEemptyDurability statusNOT DURABLE (volatile layers only)Application write()Latency budget (typical NVMe)write(): ~1uswriteback: 10-30scache ack: ~10usfsync flush: 1-10msOnly the final flush to media gives a real power-cut guarantee.
Step 1 / 8Application write()

The app calls write(). The data is copied from the app's buffer into the kernel's page cache. That is all. A power cut now loses the data.

Arrow keys to walk the stack · R to reset

Tap dots to jump to any step

Read the full article →Take the quiz →