OSDN Git Service

(split) LDP: Improve Makefile
[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 filesystem 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
64 .BR LANG ,
65 .BR LC_ALL ,
66 .BR LC_CTYPE ,
67 and
68 .B LC_MESSAGES
69 have the usual meaning.
70 .SH CONFORMING TO
71 POSIX.2.
72 .SH NOTES
73 On Linux,
74 .B sync
75 is guaranteed only to schedule the dirty blocks for writing; it can
76 actually take a short time before all the blocks are finally written.
77 The
78 .BR reboot (8)
79 and
80 .BR halt (8)
81 commands take this into account by sleeping for a few seconds after
82 calling
83 .BR sync (2).
84 .PP
85 This page describes
86 .B sync
87 as found in the file\%utils-4.0 package;
88 other versions may differ slightly.
89 .SH SEE ALSO
90 .BR sync (2),
91 .BR halt (8),
92 .BR reboot (8),
93 .BR update (8)