Update filesystems to match cached data (UNIX)
The sync utility forces the filesystem manager to
begin flushing all modified in-memory inodes and all previously unwritten
system buffers to disk. This ensures that all file modifications up to that
point are scheduled to be saved.
The sync utility usually returns before the operation is complete.
After executing sync, you must allow sufficient time for the driver
queues to drain before you may assume that the data is safely on disk. This
delay depends on the speed of your disk(s), the number of buffers that must be
drained, and how active your system is at the time.
It is unusual for the operation to take more than
four to five seconds with typical IDE drives and a
large (2 megabyte) cache, if a large portion of the cache needs to be flushed. With
faster disks (e.g. SCSI), it usually completes in under two
seconds. If significant amounts of data are being flushed to a floppy disk, it
could take many tens of seconds.
Synchronize the local filesystem: