Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flush without sync

From what I've read, flush pushes data into the OS buffers and sync makes sure that data goes down to the storage media. So, if you want to be sure that data is actually written to disk, you need to do a flush followed by a sync. So, are there any cases where you want to call flush but not sync?

like image 577
Eduardo Avatar asked Apr 22 '26 21:04

Eduardo


1 Answers

You only want to fflush if you're using stdio's FILE *. This writes a user space buffer to the kernel.

The other answers seem to be missing fdatasync. This is the system call you want to flush a specific file descriptor to disk.

like image 129
Matt Joiner Avatar answered Apr 25 '26 22:04

Matt Joiner