Files
oldlinux-files/docs/Install-Guide/install-guide-2.2.2/node186.html
2024-02-19 00:23:35 -05:00

84 lines
4.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
<!Converted with LaTeX2HTML 95.1 (Fri Jan 20 1995) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
<HEAD>
<TITLE>4.8.2 Checking filesystems</TITLE>
</HEAD>
<BODY>
<meta name="description" value="4.8.2 Checking filesystems">
<meta name="keywords" value="gs">
<meta name="resource-type" value="document">
<meta name="distribution" value="global">
<P>
<BR> <HR><A NAME=tex2html4130 HREF="node187.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html4128 HREF="node184.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html4124 HREF="node185.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html4132 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html4133 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html4131 HREF="node187.html">4.9 Using a swap </A>
<B>Up:</B> <A NAME=tex2html4129 HREF="node184.html">4.8 Managing Filesystems</A>
<B> Previous:</B> <A NAME=tex2html4125 HREF="node185.html">4.8.1 Mounting filesystems</A>
<BR> <HR> <P>
<H2><A NAME=SECTION00682000000000000000>4.8.2 Checking filesystems</A></H2>
<P>
<A NAME=4947>&#160;</A>
It is usually a good idea to check your filesystems for damage or
corrupt files every now and then. Some systems automatically check their
filesystems at boot time (with the appropriate commands in <tt>/etc/rc</tt>).
<P>
<A NAME=4984>&#160;</A>
The command used to check a filesystem depends on the type of the
filesystem in question. For ext2fs filesystems (the most commonly used
type), this command is <tt>e2fsck</tt>. For example, the command
<P><TT> # <em>e2fsck -av /dev/hda2</em>
<P></TT>
will check the ext2fs filesystem on <tt>/dev/hda2</tt> and automatically
correct any errors.
<P>
<A NAME=4985>&#160;</A>
<A NAME=4956>&#160;</A>
<A NAME=4957>&#160;</A>
It is usually a good idea to unmount a filesystem before checking
it. For example, the command
<P><TT> # <em>umount /dev/hda2</em>
<P></TT>
will unmount the filesystem on <tt>/dev/hda2</tt>, after which you
can check it. The one exception is that you cannot unmount the root
filesystem. In order to check the root filesystem when it's
unmounted, you should use a maintenance boot/root diskette (see
Section <A HREF="node192.html#secmaintdiskette">4.11.1</A>). You also cannot unmount a filesystem
if any of the files in it are ``busy''---that is, being used by
a running process. For example, you cannot unmount a filesystem if
any user's current working directory is on that filesystem. You will
receive a ``<tt>Device busy</tt>'' error if you attempt to unmount a
filesystem which is in use.
<P>
<A NAME=4986>&#160;</A>
<A NAME=4987>&#160;</A>
<A NAME=4988>&#160;</A>
Other filesystem types use different forms of the <tt>e2fsck</tt> command,
such as <tt>efsck</tt> and <tt>xfsck</tt>. On some systems, you can simply use
the command <tt>fsck</tt>, which will determine the filesystem type
and execute the appropriate command.
<P>
<IMG ALIGN=BOTTOM ALT="(WARN)" SRC="bdt.gif">It is important that you reboot your system immediately
after checking a mounted filesystem if any corrections were made to that
filesystem. (However, in general, you shouldn't check filesystems while they
are mounted.) For example, if <tt>e2fsck</tt> reports that it corrected
any errors with the filesystem, you should immediately <tt>shutdown -r</tt>
in order to reboot the system. This is to allow the system to
re-sync its information about the filesystem when <tt>e2fsck</tt>
modifies it.
<P>
The <tt>/proc</tt> filesystem never needs to be checked in
this manner. <tt>/proc</tt> is a memory filesystem, managed directly
by the kernel.
<A NAME=4976>&#160;</A>
<P>
<BR> <HR><A NAME=tex2html4130 HREF="node187.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html4128 HREF="node184.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html4124 HREF="node185.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html4132 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html4133 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html4131 HREF="node187.html">4.9 Using a swap </A>
<B>Up:</B> <A NAME=tex2html4129 HREF="node184.html">4.8 Managing Filesystems</A>
<B> Previous:</B> <A NAME=tex2html4125 HREF="node185.html">4.8.1 Mounting filesystems</A>
<BR> <HR> <P>
<BR> <HR>
<P><ADDRESS>
<I>Matt Welsh <BR>
mdw@sunsite.unc.edu</I>
</ADDRESS>
</BODY>