summaryrefslogtreecommitdiff
path: root/sag-0.6.1-www/Invisible/sag-0.6/node47.html
blob: 5fce3684181027dd19d1c81fa38d374eea6fbb68 (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
<!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>Checking filesystem integrity with fsck</TITLE>
<META NAME="description" CONTENT="Checking filesystem integrity with fsck">
<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="tex2html909" HREF="node48.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="./next_motif.gif"></A> <A NAME="tex2html907" HREF="node41.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="./up_motif.gif"></A> <A NAME="tex2html901" HREF="node46.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="./previous_motif.gif"></A> <A NAME="tex2html911" HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="./contents_motif.gif"></A> <A NAME="tex2html912" HREF="node114.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="./index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME="tex2html910" HREF="node48.html">Checking for disk errors </A>
<B>Up:</B> <A NAME="tex2html908" HREF="node41.html">Filesystems</A>
<B> Previous:</B> <A NAME="tex2html902" HREF="node46.html">Mounting and unmounting</A>
<BR> <P>
<A NAME="1685">&#160;</A><H2><A NAME="SECTION00586000000000000000">Checking filesystem integrity with <tt>fsck</tt></A></H2>
<P>
	Filesystems are complex creatures, and as such, they tend to be
	somewhat error-prone.  A filesystem's correctness and validity
	can be checked using the <tt>fsck</tt><A NAME="1687">&#160;</A> command.  It can be
	instructed to repair any minor problems it finds, and to
	alert the user if there any unrepairable problems.  Fortunately,
	the code to implement filesystems is debugged quite
	effectively, so there are seldom any problems at all, and they
	are usually caused by power failures, failing hardware, or
	operator errors; for example, by not shutting down the system
	properly.
<P>
	Most systems are setup to run <tt>fsck</tt><A NAME="1689">&#160;</A> automatically at
	boot time, so that any errors are detected (and hopefully
	corrected) before the system is used.  Use of a corrupted
	filesystem tends to make things worse: if the data structures
	are messed up, using the filesystem will probably mess them
	up even more, resulting in more data loss.  However,
	<tt>fsck</tt><A NAME="1691">&#160;</A> can take a while to run on big filesystems, and
	since errors almost never occur if the system has been shut
	down properly, a couple of tricks are used to avoid doing the
	checks in such cases.  The first is that if the file <tt>/etc/fastboot</tt><A NAME="1693">&#160;</A>
	exists, no checks are made.  The second is that the ext2 filesystem
	has a special marker in its superblock that tells whether
	the filesystem was unmounted properly after the previous mount.
	This allows <tt>e2fsck</tt><A NAME="1695">&#160;</A> (the version of <tt>fsck</tt><A NAME="1697">&#160;</A> for
	the ext2 filesystem) to avoid checking the filesystem if
	the flag indicates that the unmount was done (the assumption
	being that a proper unmount indicates no problems).  Whether
	the <tt>/etc/fastboot</tt><A NAME="1699">&#160;</A> trick works on your system depends on
	your startup scripts, but the ext2 trick works every time
	you use <tt>e2fsck</tt><A NAME="1701">&#160;</A>--it has to be explicitly bypassed with
	an option to <tt>e2fsck</tt><A NAME="1703">&#160;</A> to be avoided.  (See the <em>e2fsck</em><A NAME="1705">&#160;</A>
	man page for details on how.)
<P>
	The automatic checking only works for the filesystems that are
	mounted automatically at boot time.  Use <tt>fsck</tt><A NAME="1707">&#160;</A> manually
	to check other filesystems, e.g., floppies.
<P>
	If <tt>fsck</tt><A NAME="1709">&#160;</A> finds unrepairable problems, you need either
	in-depth knowlege of how filesystems work in general,
	and the type of the corrupt filesystem in particular, or
	good backups.  The latter is easy (although sometimes tedious)
	to arrange, the former can sometimes be arranged via a friend,
	the Linux newsgroups and mailing lists,
	or some other source of support, if you don't have the
	know-how yourself.  I'd like to tell you more
	about it, but my lack of education and experience in this regard
	hinders me.  The <tt>debugfs</tt><A NAME="1711">&#160;</A> program by Theodore T'so
	should be useful.
<P>
	<tt>fsck</tt><A NAME="1713">&#160;</A> must only be run on unmounted filesystems, never on
	mounted filesystems (with the exception of the read-only root
	during startup).  This is because it accesses the raw
	disk, and can therefore modify the filesystem without the
	operating system realizing it.  There <em>will</em> be trouble,
	if the operating system is confused.
<P>
<HR><A NAME="tex2html909" HREF="node48.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="./next_motif.gif"></A> <A NAME="tex2html907" HREF="node41.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="./up_motif.gif"></A> <A NAME="tex2html901" HREF="node46.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="./previous_motif.gif"></A> <A NAME="tex2html911" HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="./contents_motif.gif"></A> <A NAME="tex2html912" HREF="node114.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="./index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME="tex2html910" HREF="node48.html">Checking for disk errors </A>
<B>Up:</B> <A NAME="tex2html908" HREF="node41.html">Filesystems</A>
<B> Previous:</B> <A NAME="tex2html902" HREF="node46.html">Mounting and unmounting</A>
<P><ADDRESS>
<I>Lars Wirzenius <BR>
Sat Nov 15 02:32:11 EET 1997</I>
</ADDRESS>
</BODY>
</HTML>