old-www/LDP/LG/issue76/tag/6.html

417 lines
15 KiB
HTML

<!--startcut ======================================================= -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<META NAME="generator" CONTENT="lgazmail v1.4F.n">
<TITLE>The Answer Gang 76: ext3 filesystemcheck?</TITLE>
</HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000"
LINK="#3366FF" VLINK="#A000A0">
<!--endcut ========================================================= -->
<P> <hr>
<!--startcut ======================================================= -->
<CENTER>
<!-- *** BEGIN navbar *** -->
<!-- *** END navbar *** -->
</CENTER>
</p>
<!--endcut ========================================================= -->
<!--startcut ======================================================= -->
<P> <hr>
<!-- begin tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::-->
<p align="center">
<table width="100%" border="0"><tr>
<td align="right" valign="center"
><IMG ALT="" SRC="../../gx/navbar/left.jpg"
WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="middle" border="0"
><A HREF="..//"
><IMG SRC="../../gx/navbar/toc.jpg" align="middle"
ALT="[ Table Of Contents ]" border="0"></A
><A HREF="../lg_answer.html"
><IMG SRC="../../gx/dennis/answertoc.jpg" align="middle"
ALT="[ Answer Guy Current Index ]" border="0"></A></td>
<td align="center" valign="center"><A HREF="../lg_answer.html#greeting"><img align="middle"
src="../../gx/dennis/smily.gif" alt="greetings" border="0"></A> &nbsp;
<A HREF="../tag/bios.html">Meet&nbsp;the&nbsp;Gang</A> &nbsp;
<A HREF="1.html">1</A> &nbsp;
<A HREF="2.html">2</A> &nbsp;
<A HREF="3.html">3</A> &nbsp;
<A HREF="4.html">4</A> &nbsp;
<A HREF="5.html">5</A> &nbsp;
<A HREF="6.html">6</A> &nbsp;
<A HREF="7.html">7</A> &nbsp;
<A HREF="8.html">8</A> &nbsp;
<A HREF="9.html">9</A> &nbsp;
<A HREF="10.html">10</A> &nbsp;
<A HREF="11.html">11</A> &nbsp;
<A HREF="12.html">12</A>
</td>
<td align="left" valign="center"><A HREF="../../tag/kb.html"
><IMG SRC="../../gx/dennis/answerpast.jpg" align="middle"
ALT="[ Index of Past Answers ]" border="0"></A
><IMG ALT="" SRC="../../gx/navbar/right.jpg" align="middle"
WIDTH="14" HEIGHT="45" BORDER="0"></td></tr></table>
</p>
<!-- end tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::::-->
<!--endcut ========================================================= -->
<P> <hr> <P>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<center>
<H1><A NAME="answer">
<img src="../../gx/dennis/qbubble.gif" alt="(?)"
border="0" align="middle">
<font color="#B03060">The Answer Gang</font>
<img src="../../gx/dennis/bbubble.gif" alt="(!)"
border="0" align="middle">
</A></H1>
<BR>
<H4>By Jim Dennis, Ben Okopnik, Dan Wilder, Breen, Chris, and...
(<a href="bios.html">meet the Gang</a>) ...
the Editors of Linux Gazette...
and You!
<br>Send questions (or interesting answers) to
The Answer Gang
for possible publication
(but read the <a href="ask-the-gang.html">guidelines</a> first)
</H4>
</center>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<p><hr><p>
<!-- begin 6 -->
<H3 align="left"><img src="../../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>ext3 filesystemcheck?</H3>
<p><strong>From Karl-Heinz Herrmann
</strong></p>
<p></strong></p>
<!-- sig -->
<p align="right"><strong>Answered By Johan H, Ben Okopnik, Jay R. Ashworth, John Karns
</strong></p>
<P><STRONG>
<IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H.]
</STRONG></P>
<P><STRONG>
Hi,
</STRONG></P>
<P><STRONG>
since the advertising of ext3 here on the list lately I changed as well. So
I got myself the new e2fsprogs-1.25.tar.gz and the new package including
mount which knows about ext3.
</STRONG></P>
<P><STRONG>
tunefs my ext2 partitions to have a journal, changes fstab entries and on
reboot ext3 messages. nice.
</STRONG></P>
<blockquote><font color="#000066"><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather] Here's a note on making the conversion - though I'll warn that you no
longer need to chase down the patches, as they're pretty well merged
these days. And ask your current copy of tune2fs about the command options:
<A HREF="http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html"
>http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html</A>
</font></blockquote>
<P><STRONG>
<IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H.]
Now today it told me that after 20 remounts it is going to check my
filesystem and it was running e2fsck (1.25 Sep 2001) on the partition.
It found some minor i-node problems, corrected automatically and
after that the normal ext3 messages during the mount stage came up and
everything seemd fine.
</STRONG></P>
<P><STRONG>
So:
</STRONG></P>
<P><STRONG><BLOCKQuote>
Is this normal behaviour of ext3? Should I switch off the fschk in the
<TT>/etc/init.d/boot</TT> for the ext3 partitons? The system is a <A HREF="http://www.suse.com/">SuSE</A> 7.1 which does
not know about ext3 yet. reiserfs is explicitly handled in the boot script
as reiser is installed and configured by SuSE.
</BLOCKQuote></STRONG></P>
<P><STRONG>
And I'm wondering what happens if the system is not shutdown cleanly. I'm
not too keen on trying right now....
</STRONG></P>
<P><STRONG>
Thanks for hints,
</STRONG></P>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Johan]
The fsck parameters are kept in the filesystem itself.
</blockQuote>
<blockquote><pre>## This will disable forced fsck after a certain number of mounts.
tune2fs -c 0 /dev/${partition.}
</pre></blockquote>
<blockQuote>
in my case
</blockQuote>
<blockquote><pre> tune2fs -c 0 /dev/hda1
## This will disable forced fsck after a certain period
tune2fs -i 0 /dev/${partition.}
</pre></blockquote>
<blockQuote>
in my case
</blockQuote>
<blockquote><pre> tune2fs -i 0 /dev/hda1
</pre></blockquote>
<blockQuote>
`$ man tune2fs' for details.
</blockQuote>
<blockQuote>
Kind regards
Johan H
</blockQuote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
&lt;Wince&gt; That's probably not a good idea. I would set it to some reasonably
high number, but <EM>never</EM> running 'fsck' would give me the hives. Mine is
set to 100, something I consider a reasonable "cleanliness vs. annoyance"
value.
</blockQuote>
<P><STRONG>
<IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H.]
thanks to both for the fast reply,
</STRONG></P>
<P><STRONG>
So even with ext3 journaling it's advisable to run fsck occasionally? And
running a reasonably new fsck.ext3 (which actually runs e2fsck 1.25) is ok?
Will not damage anything -- also not in case of an unclean shutdown?
In case of an unclean shutdown it should just replay the journal and not
actually run a full fsck, right?
</STRONG></P>
<P><STRONG>
Then I would set the various partitons on the one HD to some largish 2 digit
prime numbers and let an occasional fsck run on them.
</STRONG></P>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Johan]
</blockQuote>
<blockquote><pre>$ uptime on 3 machines.
5:44pm up 28 days, 6:28, 3 users, load average: 0.00, 0.00, 0.00
5:50pm up 23 days, 5:09, 2 users, load average: 0.00, 0.00, 0.00
5:46pm up 32 days, 3:52, 1 user, load average: 0.02, 0.07, 0.03
</pre></blockquote>
<blockQuote>
Uptime on my servers are huge. With autofsck set to one hundred mounts,
you will run fsck maybe once every 8 years? Yes it is good to run fsck
occasionally, I prefer not running it while it is booting. I have
enough trouble on my hands when a 100Gb SCSI machine falls over. It
takes nearly 20 mins to fsck that beast.
</blockQuote>
<P><STRONG>
<IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H.]
nice uptimes, yes. The typical uptime of my Laptop is about twice rebooted
per day -- once at home and once at work....
</STRONG></P>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jay]
Doesn't your laptop's suspend cooperate? My laptop typically only gets
rebooted when I blow standby time, or on those occasions that it's
intermittent bites me.
</blockQuote>
<P><STRONG>
<IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H.]
not really. <EM>IF</EM> I stop X <EM>AND</EM> unload the NVidia driver it will suspend and
<EM>may</EM> come back up. Most of the time not and I got tired of the fscks after
failed tries. And S2D is not configured (yet). But not worth doing anyway
-- repartitioning or at least resizing would be necessary due too a RAM
upgrade recently and if I've to drop down to text-login I anyway can't
preserve whatever I was working on on the screen.
</STRONG></P>
<P><STRONG>
The reboot <EM>without</EM> any fscks is fast enough for me. I think I'll setup
fsck to start after time intervalls instead of remounts... that should be
more calculable.
</STRONG></P>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Johan]
The only difference between ext2 and ext3 is the journal. You can mount
an ext3 fs as ext2. So yes, it is good to run fsck at regular
intervals. I prefer to schedule mine, others prefer the mount count to
do it. Choose what suits you best.
</blockQuote>
<P><STRONG>
<IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [John]
OK, but in order to make adjustments, doesn't fsck need to be run the fs
when mounted as read-only? And IIRC, running it on the fs when mounted rw
can screw things up, no?
</STRONG></P>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Johan]
Absolutely right, the safe way is,
</blockQuote>
<blockquote><pre>## single user mode
init 1;
## remount / in read only mode.
mount -o remount,ro /
e2fsck /dev/hda1
## remount / in readwrite mode
mount -o remount,rw /
## back to where you came from
init 3
</pre></blockquote>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jay]
Make sure not to do <TT>/dev/hda</TT> itself -- it's <EM>the entire drive</EM>. The thing
you're fsck'ing has to be a partition of the ext3 variety.
</blockQuote>
<P><STRONG>
<IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H.]
That is setup by SuSE quite ok -- initially <TT>/</TT> is mounted ro, checked, then
all others are checked with special treatment for reiserfs, all other
partitions are still unmounted at the point.
</STRONG></P>
<P><STRONG>
Then <TT>/</TT> will be remounted for rw and all other get mounted and system
runlevel changes to the specified one (2 in my case, which is multi-user,
network but textloging).
</STRONG></P>
<P><STRONG>
I was just wondering if I'm supposed to run fsck on ext3 at all -- but that
is cleared up by now.
</STRONG></P>
<P><STRONG>
just running a fsck from time to time is maybe more convenient. I would like
to avoid random longish boottimes -- it's always when you wait for the Lap
to came up fast with somebody next to you.
</STRONG></P>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Johan]
When things go bang in the server room, it should just replay the
journal. This has two advantages, faster mounting after machine crashes
and guaranteed integrity of the fs structure(Not the data btw).
</blockQuote>
<P><STRONG>
<IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H.]
data not yet written are lost -- certainly. but their space should be
correctly allocated and meta data should be intact as you said.
</STRONG></P>
<blockQuote>
<IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jay]
Yep, just like an fsck, journals only preserve FS structure, not
necessarily data -- an important point to make, since journal fans seem
to want to <EM>suggest</EM> that they can preserve data.
</blockQuote>
<blockquote><font color="#000066"><IMG SRC="../../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather] Here is an article describing in some detail what ext3 <EM>does</EM> -- the author
digs on the other journaling filesystems a bit, and seems to know a bit
about how Reiser ticks too. Apparently ext3 is better than most at preserving
data in files that already existed, at least:
<A HREF="http://www-106.ibm.com/developerworks/linux/library/l-fs7"
>http://www-106.ibm.com/developerworks/linux/library/l-fs7</A>
</font></blockquote>
<!-- end 6 -->
<P> <hr> </p>
<!-- *** BEGIN copyright *** -->
<H5 align="center">This page edited and maintained by the Editors
of <I>Linux Gazette</I>
<a href="http://www.linuxgazette.com/copying.html"
>Copyright &copy;</a> 2002
<BR>Published in issue 76 of <I>Linux Gazette</I> March 2002</H5>
<H6 ALIGN="center">HTML script maintained by
<A HREF="mailto:star@starshine.org">Heather Stern</a> of
Starshine Technical Services,
<A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
</H6>
<!-- *** END copyright *** -->
<!--startcut ======================================================= -->
<P> <hr>
<!-- begin tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::-->
<p align="center">
<table width="100%" border="0"><tr>
<td align="right" valign="center"
><IMG ALT="" SRC="../../gx/navbar/left.jpg"
WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="middle" border="0"
><A HREF="..//"
><IMG SRC="../../gx/navbar/toc.jpg" align="middle"
ALT="[ Table Of Contents ]" border="0"></A
><A HREF="../lg_answer.html"
><IMG SRC="../../gx/dennis/answertoc.jpg" align="middle"
ALT="[ Answer Guy Current Index ]" border="0"></A></td>
<td align="center" valign="center"><A HREF="../lg_answer.html#greeting"><img align="middle"
src="../../gx/dennis/smily.gif" alt="greetings" border="0"></A> &nbsp;
<A HREF="../tag/bios.html">Meet&nbsp;the&nbsp;Gang</A> &nbsp;
<A HREF="1.html">1</A> &nbsp;
<A HREF="2.html">2</A> &nbsp;
<A HREF="3.html">3</A> &nbsp;
<A HREF="4.html">4</A> &nbsp;
<A HREF="5.html">5</A> &nbsp;
<A HREF="6.html">6</A> &nbsp;
<A HREF="7.html">7</A> &nbsp;
<A HREF="8.html">8</A> &nbsp;
<A HREF="9.html">9</A> &nbsp;
<A HREF="10.html">10</A> &nbsp;
<A HREF="11.html">11</A> &nbsp;
<A HREF="12.html">12</A>
</td>
<td align="left" valign="center"><A HREF="../../tag/kb.html"
><IMG SRC="../../gx/dennis/answerpast.jpg" align="middle"
ALT="[ Index of Past Answers ]" border="0"></A
><IMG ALT="" SRC="../../gx/navbar/right.jpg" align="middle"
WIDTH="14" HEIGHT="45" BORDER="0"></td></tr></table>
</p>
<!-- end tagnav ::::::::::::::::::::::::::::::::::::::::::::::::::::-->
<!--endcut ========================================================= -->
<P> <hr>
<!--startcut ======================================================= -->
<CENTER>
<!-- *** BEGIN navbar *** -->
<!-- *** END navbar *** -->
</CENTER>
</p>
<!--endcut ========================================================= -->
<!--startcut ======================================================= -->
</BODY></HTML>
<!--endcut ========================================================= -->