summaryrefslogtreecommitdiff
path: root/sag-0.6.1-www/Invisible/sag-0.6/node69.html
blob: 8ef46b284584ab469e0e40c17a138eb3b25df67a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<!--Converted with LaTeX2HTML 96.1-h (September 30, 1996) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds -->
<HTML>
<HEAD>
<TITLE>More about shutdowns</TITLE>
<META NAME="description" CONTENT="More about shutdowns">
<META NAME="keywords" CONTENT="sag">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<LINK REL=STYLESHEET HREF="sag.css">
</HEAD>
<BODY LANG="EN" >
 <A NAME="tex2html1182" HREF="node70.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="./next_motif.gif"></A> <A NAME="tex2html1180" HREF="node66.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="./up_motif.gif"></A> <A NAME="tex2html1174" HREF="node68.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="./previous_motif.gif"></A> <A NAME="tex2html1184" HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="./contents_motif.gif"></A> <A NAME="tex2html1185" HREF="node114.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="./index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME="tex2html1183" HREF="node70.html">Rebooting</A>
<B>Up:</B> <A NAME="tex2html1181" HREF="node66.html">Boots And Shutdowns</A>
<B> Previous:</B> <A NAME="tex2html1175" HREF="node68.html">The boot process in </A>
<BR> <P>
<H1><A NAME="SECTION00730000000000000000">More about shutdowns</A></H1>
<P>
	It is important to follow the correct procedures when you shut
	down a Linux system.  If you fail do so, your filesystems probably
	will become trashed and the files probably will become scrambled.
	This is because Linux has a disk cache that won't write things
	to disk at once, but only at intervals.  This greatly improves
	performance but also means that if you just turn off the power
	at a whim the cache may hold a lot of data and that what is on
	the disk may not be a fully working filesystem (because only
	some things have been written to the disk).
<A NAME="2036">&#160;</A>
<A NAME="2037">&#160;</A>
<A NAME="2038">&#160;</A>
<A NAME="2039">&#160;</A>
<P>
	Another reason against just flipping the power switch is that
	in a multi-tasking system there can be lots of things going on
	in the background, and shutting the power can be quite
	disastrous.  By using the proper shutdown sequence, you ensure
	that all background processes can save their data.
<A NAME="2040">&#160;</A>
<P>
	The command for properly shutting down a Linux system is
	<tt>shutdown</tt><A NAME="2143">&#160;</A>.  It is usually used in one of two ways.
<A NAME="2042">&#160;</A>
<P>
	If you are running a system where you are the only user, the
	usual way of using <tt>shutdown</tt><A NAME="2145">&#160;</A> is to quit all running programs,
	log out on all virtual consoles, log in as <tt>root</tt> on one
	of them (or stay logged in as <tt>root</tt> if you already are,
	but you should change to the root directory, to avoid problems
	with unmounting), then give the command
	<tt>shutdown&nbsp;-h&nbsp;now</tt><A NAME="2047">&#160;</A>
	(substitute <tt>now</tt> with a plus sign and a number in minutes
	if you want a delay, though you usually don't on a single user
	system).
<P>
	Alternatively, if your system has many users, use the command
	<tt>shutdown&nbsp;-h&nbsp;<i>+time message</i></tt>, where <i>time</i> 
	is the
	time in minutes until the system is halted, and <i>message</i>
	is a short explanation of why the system is shutting down.
<BLOCKQUOTE> <TT>
# shutdown -h +10 'We will install a new disk.  System should <BR> 
&gt; be back on-line in three hours.' <BR> 
#
</TT></BLOCKQUOTE>
	This will warn everybody that the system will shut
	down in ten minutes, and that they'd better get lost or lose
	data.  The warning is printed to
	every terminal on which someone is logged in, including all
	<tt>xterm</tt><A NAME="2147">&#160;</A>s:
<BLOCKQUOTE> <TT>
Broadcast message from root (ttyp0) Wed Aug  2 01:03:25 1995... <BR> 
 <BR> 
We will install a new disk.  System should <BR> 
be back on-line in three hours. <BR> 
The system is going DOWN for system halt in 10 minutes !!
</TT></BLOCKQUOTE>
	The warning is automatically repeated a few times before the
	boot, with shorter and shorter intervals as the time runs out.
<A NAME="2057">&#160;</A>
<P>
	When the real shutting down starts after any
	delays, all filesystems (except the root one) are unmounted,
	user processes (if anybody is still logged in) are killed,
	daemons are shut down, all filesystem are unmounted,
	and generally everything settles down.
	When that is done, <tt>init</tt><A NAME="2149">&#160;</A> prints out a message that
	you can power down the machine.  Then, <EM>and only then</EM>,
	should you move your fingers towards the power switch.
<A NAME="2060">&#160;</A>
<P>
	Sometimes, although rarely on any good system, it is
	impossible to shut down properly.  For instance, if the kernel
	panics and crashes and burns and generally misbehaves, it
	might be completely impossible to give any new commands, hence
	shutting down properly is somewhat difficult, and just about
	everything you can do is hope that nothing has been too
	severely damaged and turn off the power.  If the troubles are a
	bit less severe (say, somebody hit your keyboard with
	an axe), and the kernel and the <tt>update</tt><A NAME="2151">&#160;</A> program still run
	normally, it is probably a good idea to wait a couple of
	minutes to give <tt>update</tt><A NAME="2153">&#160;</A> a chance to flush the buffer
	cache, and only cut the power after that.
<A NAME="2063">&#160;</A>
<A NAME="2064">&#160;</A>
<A NAME="2065">&#160;</A>
<A NAME="2108">&#160;</A>
<A NAME="2067">&#160;</A>
<A NAME="2068">&#160;</A>
<A NAME="2109">&#160;</A>
<P>
	Some people like to shut down using the command
	<tt>sync</tt><A NAME="2155">&#160;</A><A NAME="tex2html31" HREF="footnode.html#2110"><IMG  ALIGN=BOTTOM ALT="gif" SRC="./foot_motif.gif"></A>
	three times, waiting for the disk I/O to stop, then turn off
	the power.  If there are no running programs, this is about
	equivalent to using <tt>shutdown</tt><A NAME="2159">&#160;</A>.  However, it does not
	unmount any filesystems and this can lead to problems with the
	ext2fs ``clean filesystem'' flag.  The triple-sync method is
	<em>not recommended</em>.
<A NAME="2074">&#160;</A>
<P>
	(In case you're wondering: the reason for <em>three</em> syncs is
	that in the early days of UNIX, when the commands were
	typed separately, that usually gave sufficient time for most
	disk I/O to be finished.)
<P>
<HR><A NAME="tex2html1182" HREF="node70.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="./next_motif.gif"></A> <A NAME="tex2html1180" HREF="node66.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="./up_motif.gif"></A> <A NAME="tex2html1174" HREF="node68.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="./previous_motif.gif"></A> <A NAME="tex2html1184" HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="./contents_motif.gif"></A> <A NAME="tex2html1185" HREF="node114.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="./index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME="tex2html1183" HREF="node70.html">Rebooting</A>
<B>Up:</B> <A NAME="tex2html1181" HREF="node66.html">Boots And Shutdowns</A>
<B> Previous:</B> <A NAME="tex2html1175" HREF="node68.html">The boot process in </A>
<P><ADDRESS>
<I>Lars Wirzenius <BR>
Sat Nov 15 02:32:11 EET 1997</I>
</ADDRESS>
</BODY>
</HTML>