NAME
sync
—
flush kernel caches
SYNOPSIS
sync |
[-d |-f ]
[file]… |
DESCRIPTION
Instruct the kernel to commit cached writes to files to their backing storage. If none specified, flush all caches.
OPTIONS
-d
,--data
- Don't flush metadata.
-f
,--file-system
- Flush entire filesystem containing each file. Only availabe under Linux.
SEE ALSO
STANDARDS
Compatible with Version 4 AT&T UNIX; arguments are a GNU extension.
HISTORY
sync(II) appears in the second edition of the UNIX Programmer's Manual as
sync ........................ assure
synchronisation
Version 4 AT&T UNIX broadens the description to causing "all information in core memory that should be on disk to be written out", listing "modified super blocks" and i-nodes, and "delayed block I/O". as well as noting it to "be mandatory before a boot", with the new sync(VIII) and update(VIII) in SEE ALSO.
sync(VIII) ("update the super block") is described simply as
Version 5 AT&T UNIX elucidates the synchronisation/insurance relationship in sync(VIII) and expands update(VIII) BUGS:
Version 7 AT&T UNIX sync(2) notes in its BUGS section that
update(8) disappears from Programmer's Workbench (PWB/UNIX). Further, AT&T System III UNIX moves the Version 7 AT&T UNIX sync(2) BUGS line into the description.
4.1BSD moves sync(1M) back to sync(8), despite the executable remaining squarely in the global /bin.
The BSD sees a steady evolution of update(8), and, with 4.4BSD, shortening the BUGS to
sync
occuring simultaneously with a crash may cause
file system damage. See
fsck(8).This is not necessarily entirely unlike the user-space flushing
daemons
(bdflush(8)/bdflushd
/updated
/bdflush(2)), as found in Linux 1.1.3 through 2.5.12, though
with a different scope
(bdflush(2) is in some configurations an entire kernel-side
flushing daemon) and for a different reason (Linux being
single-threaded).