]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man8/sync.8
fedfd99aa9e05a5129931931feee3593c36a01c2
[thirdparty/man-pages.git] / man8 / sync.8
1 .\" Reboot/halt and Linux information extracted from Rick Faith's original
2 .\" sync(8) manpage, dating back to the Linux 0.99 days. The Linux-specific
3 .\" information is attributed to Linus Torvalds
4 .\" Copyright 1992, 1993 Rickard E. Faith (faith@cs.unc.edu)
5 .\" May be distributed under the GNU General Public License
6 .TH SYNC 8 1998-11-01 "GNU" "Linux Programmer's Manual"
7 .SH NAME
8 sync \- synchronize data on disk with memory
9 .SH SYNOPSIS
10 .B "sync [\-\-help] [\-\-version]"
11 .SH DESCRIPTION
12 .B sync
13 writes any data buffered in memory out to disk.
14 This can include (but is not limited to) modified superblocks,
15 modified inodes, and delayed reads and writes.
16 This must be implemented by the kernel;
17 The
18 .B sync
19 program does nothing but exercise the
20 .BR sync (2)
21 system call.
22 .PP
23 The kernel keeps data in memory to avoid doing (relatively slow) disk
24 reads and writes.
25 This improves performance, but if the computer
26 crashes, data may be lost or the file system corrupted as a result.
27 .B sync
28 ensures that everything in memory is written to disk.
29 .PP
30 .B sync
31 should be called before the processor is halted in an unusual manner
32 (e.g., before causing a kernel panic when debugging new kernel code).
33 In general, the processor should be halted using the
34 .BR shutdown (8)
35 or
36 .BR reboot (8)
37 or
38 .BR halt (8)
39 commands, which will attempt to put the system in a quiescent state
40 before calling
41 .BR sync (2).
42 (Various implementations of these commands exist; consult your
43 documentation; on some systems one should not call
44 .BR reboot (8)
45 and
46 .BR halt (8)
47 directly.)
48 .SH "OPTIONS"
49 .TP
50 .B "\-\-help"
51 Print a usage message on standard output and exit successfully.
52 .TP
53 .B "\-\-version"
54 Print version information on standard output, then exit successfully.
55 .TP
56 .B "\-\-"
57 Terminate option list.
58 .SH ENVIRONMENT
59 The variables \fBLANG\fP, \fBLC_ALL\fP, \fBLC_CTYPE\fP,
60 and \fBLC_MESSAGES\fP have the usual meaning.
61 .SH "CONFORMING TO"
62 POSIX.2
63 .SH NOTES
64 On Linux,
65 .B sync
66 is only guaranteed to schedule the dirty blocks for writing; it can
67 actually take a short time before all the blocks are finally written.
68 The
69 .BR reboot (8)
70 and
71 .BR halt (8)
72 commands take this into account by sleeping for a few seconds after
73 calling
74 .BR sync (2).
75 .PP
76 This page describes
77 .B sync
78 as found in the file\%utils-4.0 package;
79 other versions may differ slightly.
80 .SH "SEE ALSO"
81 .BR sync (2),
82 .BR halt (8),
83 .BR reboot (8),
84 .BR update (8)