← 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 calls 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 calls write()

write() only copies the bytes from the app into kernel-managed RAM. At this point the data is visible to the OS, but not durable.

Arrow keys to walk the stack · R to reset

Tap dots to jump to any step

Read the full article →Take the quiz →