fsync and scripts
Posted Apr 8, 2009 13:33 UTC (Wed) by
vaurora (guest, #38407)
In reply to:
fsync and scripts by mjg59
Parent article:
Linux Storage and Filesystem workshop, day 1
Actually, sync() is POSIX, but you are correct that the definition does not specify that the data on disk by the time it returns, just that it's been scheduled to be written out However, if you restrict your scripts to Linux and other sane operating systems, you will get the expected behavior modulo disk caching. From the sync(2) man page:
According to the standard specification (e.g., POSIX.1-2001), sync() schedules the writes,
but may return before the actual writing is done. However, since version 1.3.20 Linux
does actually wait. (This still does not guarantee data integrity: modern disks have
large caches.)
UFS on Solaris is the only case I know of that actually takes advantage of this hole and returns before the data hits disk. The last I heard, ZFS did the sane thing and waited.
(
Log in to post comments)