SYNC(2) BSD System Calls Manual SYNC(2)NAME
sync -- synchronize disk block in-core status with that on disk
Standard C Library (libc, -lc)
The sync() function forces a write of dirty (modified) buffers in the block buffer cache out to disk. The kernel keeps this information in
core to reduce the number of disk I/O transfers required by the system. As information in the cache is lost after a system crash, kernel
thread ioflush ensures that dirty buffers are synced to disk eventually. By default, a dirty buffer is synced after 30 seconds, but some
filesystems exploit ioflush features to sync directory data and metadata faster (after 15 and 10 seconds, respectively).
The function fsync(2) may be used to synchronize individual file descriptor attributes.
Many modern disks contain write-back caches. In theory sync() flushes these. In practice there are many possible ways for this mechanism to
go astray. It is prudent (where possible) to allow a few seconds after syncing for everything to settle before e.g. turning off the power.
It may also be desirable to use dkctl(8) or scsictl(8) to disable the write-back cache entirely.
SEE ALSO fsync(2), dkctl(8), scsictl(8), sync(8)HISTORY
A sync() function call appeared in Version 6 AT&T UNIX.
Historically, sync() would schedule buffers for writing but not actually wait for the writes to finish. It was necessary to issue a second
or sometimes a third call to ensure that all buffers had in fact been written out. In NetBSD, sync() does not return until all buffers have
BSD March 25, 2009 BSD
Check Out this Related Man Page
SYNC(2) Linux Programmer's Manual SYNC(2)NAME
sync - commit buffer cache to disk
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
_BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
sync() first commits inodes to buffers, and then buffers to disk.
This function is always successful.
SVr4, 4.3BSD, POSIX.1-2001.
Since glibc 2.2.2 the Linux prototype is as listed above, following the various standards. In libc4, libc5, and glibc up to 2.2.1 it was
"int sync(void)", and sync() always returned 0.
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
SEE ALSO bdflush(2), fdatasync(2), fsync(2), sync(8), update(8)COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2010-09-20 SYNC(2)
8 More Discussions You Might Find Interesting
1. Post Here to Contact Site Administrators and Moderators
I have a directory called sync and the directory path is ftp/exports/sync. What I would like to do is place some documents in sync for external users to view and would like to have access restriction for the sync directory. i.e. login and password. How do I go about doing this in a Unix enviorment.... (3 Replies)
I am trying to observe system behavior on our RHEL 5.2 machines. I notice that, it appears to me, based on random iterations of
dd if=/dev/zero of=/var/tmp/bigfile bs=1024 count=20000
...that if the pdflush is flushing buffers at the time of my write, my write will take... (4 Replies)
I am writing a script to wipe my hard disk, in a relatively secure manner by over-writing the disk with 3 patterns. So, I run the dd/dcfldd command 3 times with a sync call in between each command call in the script.
dcfldd pattern=99 conv=notrunc of=/dev/sda
dcfldd... (7 Replies)
Anyone know how to go about skipping the initial disk sync of a newly created drbd resource?
I'm creating brand new 30gb partitions and would like to skip the entire initial sync, I've read this is possible but I cannot seem to find the instructions to do it.
Trey (2 Replies)
i've always been of the mind that having to write to disk is very sloppy and dirty. i personally hate this.
so i wonder, is there a way to have a shell script/program write to memory and access whatever it has in memory whenever it wants. pretty much treat memory like hard disk.
can... (2 Replies)
Please look in to the below issue and advise how to fix the issue. I tried syncvg but it gives me an error. Recently we have upgraded the service pack in this lpar.
pmut8# lsvg -l rootvg | grep -i stale
paging00 ... (3 Replies)
Guys can anyone tell how can we do faster disk cloning
Below i found in google
1. dd if=/dev/sda of=/dev/sdb bs=4096 conv=noerror,sync
So adding "conv=noerror,sync " makes it faster looks against not adding it
2. Enable write cache activated (hdparm -W1 /dev/sda) then run dd ..
... (2 Replies)