OSDN Git Service

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