Imported upstream version 1.5
[manpages-zh.git] / raw / man8 / sync.8
blob75cef9dce9a802760f484c29487f489de4ca42ec
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 "GNU fileutils 4.0"
7 .SH NAME
8 sync \- synchronize data on disk with memory
9 .SH SYNOPSYS
10 .B "sync [\-\-help] [\-\-version]"
11 .SH DESCRIPTION
12 .B sync
13 writes any data buffered in memory out to disk.  This can
14 include (but is not limited to) modified superblocks, modified inodes,
15 and delayed reads and writes.  This must be implemented by the kernel;
16 The
17 .B sync
18 program does nothing but exercise the
19 .BR sync (2)
20 system call.
21 .PP
22 The kernel keeps data in memory to avoid doing (relatively slow) disk
23 reads and writes.  This improves performance, but if the computer
24 crashes, data may be lost or the filesystem corrupted as a result.
25 .B sync
26 ensures that everything in memory is written to disk.
27 .PP
28 .B sync
29 should be called before the processor is halted in an unusual manner
30 (e.g., before causing a kernel panic when debugging new kernel code).
31 In general, the processor should be halted using the
32 .BR shutdown (8)
34 .BR reboot (8)
36 .BR halt (8)
37 commands, which will attempt to put the system in a quiescent state
38 before calling
39 .BR sync (2).
40 (Various implementations of these commands exist; consult your
41 documentation; on some systems one should not call
42 .BR reboot (8)
43 and
44 .BR halt (8)
45 directly.)
46 .SH "GNU STANDARD OPTIONS"
47 .TP
48 .B "\-\-help"
49 Print a usage message on standard output and exit successfully.
50 .TP
51 .B "\-\-version"
52 Print version information on standard output, then exit successfully.
53 .TP
54 .B "\-\-"
55 Terminate option list.
56 .SH ENVIRONMENT
57 The variables LANG, LC_ALL, LC_CTYPE, and LC_MESSAGES have the
58 usual meaning.
59 .SH "CONFORMING TO"
60 POSIX 1003.2
61 .SH NOTES
62 On Linux,
63 .B sync
64 is only guaranteed to schedule the dirty blocks for writing; it can
65 actually take a short time before all the blocks are finally written.
66 The
67 .BR reboot (8)
68 and
69 .BR halt (8)
70 commands take this into account by sleeping for a few seconds after
71 calling
72 .BR sync (2).
73 .PP
74 This page describes
75 .B sync
76 as found in the file\%utils-4.0 package;
77 other versions may differ slightly.
78 Mail corrections and additions to aeb@cwi.nl.
79 Report bugs in the program to fileutils-bugs@gnu.ai.mit.edu.
80 .SH "SEE ALSO"
81 .BR sync (2),
82 .BR halt (8),
83 .BR reboot (8),
84 .BR update (8)