228 lines
8.6 KiB
HTML
228 lines
8.6 KiB
HTML
<!--startcut ======================================================= -->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<html><head>
|
|
<META NAME="generator" CONTENT="lgazmail v1.1preB">
|
|
<TITLE>The Answer Guy 32:
|
|
Bad Super-block on Filesystem
|
|
</TITLE>
|
|
<!-- ORIGINAL SUBJECT:
|
|
corrupted super-block
|
|
JTD SUBTITLE:
|
|
|
|
-->
|
|
</head>
|
|
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#A000A0"
|
|
ALINK="#FF0000">
|
|
<H4>"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
|
</H4>
|
|
<P> <hr> <P>
|
|
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
|
<H1 align="center"><A NAME="answer">
|
|
<img src="../gx/dennis/qbubble.gif" alt="" border="0" align="middle">
|
|
<a href="./index.html">The Answer Guy</a>
|
|
<img src="../gx/dennis/bbubble.gif" alt="" border="0" align="middle">
|
|
</A></H1>
|
|
<BR>
|
|
<H4 align="center">By James T. Dennis,
|
|
<a href="mailto:linux-questions-only@ssc.com">linux-questions-only@ssc.com</a>
|
|
<BR>Starshine Technical Services, <A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
|
|
</H4>
|
|
<p><hr><p>
|
|
<!--endcut ========================================================= -->
|
|
<H3><img src="../gx/dennis/qbub.gif" alt="(?)"
|
|
width="50" height="28" align="left" border="0"
|
|
>Bad Super-block on Filesystem</H3>
|
|
<p><strong>From Mike Klicpera on 20 Aug 1998 </strong></p>
|
|
<!-- begin body -->
|
|
|
|
|
|
<strong><p>I am trying to correct a corrupted super-block on my Linux (Redhat
|
|
ver. 4.2) system. When using the command "<tt>e2fsck -av /dev/hda2</tt>"
|
|
the resulting message is that "<tt>a bad magic number in super-block</tt>"
|
|
When using the command "<tt>e2fsck -b 8193 /dev/hda2</tt>" the resulting
|
|
message is "<tt>attempt to read block from filesystem resulted in short
|
|
read while trying to open /dev/hda2</tt>". In neither case did the
|
|
program <tt>e2fsck</tt> correct the super-block. Could you provide any
|
|
advice or point me in the right direction?
|
|
</p></strong>
|
|
|
|
<blockquote>I'd start by looking at the partition table.
|
|
</blockquote>
|
|
<blockquote>Use <tt>fdisk -l</tt>
|
|
<em>[the letter ell, not the number one -- Heather]</em>
|
|
to list all the partitions that your Linux
|
|
system can see. Make sure that the <tt>/dev/hda2</tt> really
|
|
is supposed to be a Linux native partition (that you
|
|
haven't swap devices and the partition has moved to
|
|
<tt>/dev/hdb2</tt> --- and that it isn't a swap partition or
|
|
whatever).
|
|
</blockquote>
|
|
<blockquote>It's also possible that you've switched from some
|
|
autotranslation mode to linear (LBA) or otherwise changed
|
|
how the system addresses this drive. Normally this
|
|
shouldn't affect Linux --- but I don't know what sort
|
|
of situation you have.
|
|
</blockquote>
|
|
<blockquote>The "short read" error causes me to suspect that
|
|
the partition table is wrong or that you're pointing
|
|
fsck to the wrong device/slice. That's the error I get
|
|
if I run <tt>debugfs</tt> on a directory or file rather than the
|
|
proper <tt>/dev/</tt> node. It's also possible to get this if
|
|
you've got a partition that's listed as Linux native
|
|
that has <EM>no filesystem</EM> yet made on it or when you
|
|
try the <tt>e2fsck -b</tt> on an MS-DOS filesystem.
|
|
</blockquote>
|
|
<blockquote>You can try a number of other superblocks (they should
|
|
be scattered every 8K clusters)
|
|
</blockquote>
|
|
<blockquote>In a particularly bad case you can try <tt>mke2fs -S</tt>
|
|
(make superblocks and group descriptors only). This
|
|
is described in the man page --- and is for "last ditch"
|
|
efforts only.
|
|
</blockquote>
|
|
<blockquote>If you have a tape drive or a suitably large extra
|
|
disk drive you can make an "image" backup of this
|
|
device before you try any other (more radical) attempts
|
|
at data recovery. You'd just use a command like:
|
|
</blockquote>
|
|
|
|
<blockquote><blockquote><code>dd if=/dev/hda2 of=/dev/nst0
|
|
</code></blockquote></blockquote>
|
|
|
|
<blockquote>... or better:
|
|
</blockquote>
|
|
|
|
<blockquote><blockquote><code>dd if=/dev/hda | buffer /dev/st0
|
|
</code></blockquote></blockquote>
|
|
|
|
<blockquote>... to backup the entire drive through the "<tt>buffer</tt>"
|
|
program to stream all of the data out to your SCSI
|
|
tape drive.
|
|
</blockquote>
|
|
<blockquote>You can write the image to another block device, such
|
|
as <tt>hdc3</tt> using a command like:
|
|
</blockquote>
|
|
|
|
<blockquote><blockquote><code>dd if=/dev/hda of=/dev/hdc3
|
|
</code></blockquote></blockquote>
|
|
|
|
<blockquote>(assuming you have a large enough blank partition on
|
|
the extra or loaner drive).
|
|
</blockquote>
|
|
<blockquote>You can even send the data to another system with
|
|
a command like:
|
|
</blockquote>
|
|
|
|
<blockquote><blockquote><code>dd if=/dev/hda | rsh $othersystem dd of=/dev/hdc3
|
|
</code></blockquote></blockquote>
|
|
|
|
<blockquote>(or whatever).
|
|
</blockquote>
|
|
<blockquote>The advantage of any of these techniques is that
|
|
it allows you to experiment with various recovery
|
|
techniques with less chance of "making it worse"
|
|
(any time you think you've "made it worse" you
|
|
use the reverse commands to "start over").
|
|
</blockquote>
|
|
<blockquote>There are a number of hex editors for Linux, some
|
|
with nice ncurses interfaces. These can allow you
|
|
to explore a filesystem trying to find out where
|
|
things are. I haven't played with any of these
|
|
enough to be any good with them --- and I've never
|
|
read through the sources to find out where the
|
|
interesting data structures should be, or what they
|
|
should look like.
|
|
</blockquote>
|
|
<blockquote>Eventually I'd like to see the Linux programming
|
|
community produce a set of fs recovery tools to rival
|
|
the Norton Utilities for DOS (for which I used to be
|
|
a professional support rep). The first such tool would
|
|
be one that could scan a raw device, find superblocks
|
|
and report the information from them.
|
|
</blockquote>
|
|
|
|
<strong><p><img src="../gx/dennis/bbub.gif" height="28" width="50"
|
|
alt="(!)" border="0">Thanks in advance for any help.
|
|
</strong></p>
|
|
|
|
<blockquote><img src="../gx/dennis/bbub.gif" height="28" width="50"
|
|
alt="(!)" border="0">I hope it helps.</blockquote>
|
|
<!-- end body -->
|
|
|
|
<!--startcut ======================================================= -->
|
|
<P> <hr> <P>
|
|
<H5 align="center"><a href="http://www.linuxgazette.com/copying.html"
|
|
>Copyright ©</a> 1998, James T. Dennis <BR>
|
|
Published in <I>Linux Gazette</I> Issue 32 September 1998</H5>
|
|
<P> <hr> <P>
|
|
|
|
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::-->
|
|
<table width="98%"><tr valign="center" align="center">
|
|
<td rowspan="3"><A HREF="./lg_answer32.html"><IMG
|
|
SRC="../gx/dennis/answernew.gif"
|
|
ALT="[ Answer Guy Index ]"></A></td>
|
|
<td><A HREF="tag_phreak.html">phreak</A>
|
|
<td><A HREF="tag_abandon.html">abandon</A>
|
|
<td><A HREF="tag_javaterm.html">javaterm</A>
|
|
<td><A HREF="tag_BBS.html">BBS</A>
|
|
<td><A HREF="tag_flaws.html">flaws</A>
|
|
<td><A HREF="tag_doslinux.html">doslinux</A>
|
|
<td><A HREF="tag_resume.html">resume</A>
|
|
|
|
</tr><tr valign="center" align="center">
|
|
<td><A HREF="tag_softwindows.html">softwindows</A>
|
|
<td><A HREF="tag_convert.html">convert</A>
|
|
<td><A HREF="tag_apache.html">apache</A>
|
|
<td><A HREF="tag_emulate.html">emulate</A>
|
|
<td><A HREF="tag_database.html">database</A>
|
|
<td><A HREF="tag_distrib.html">distrib</A>
|
|
<td><A HREF="tag_proxy.html">proxy</A>
|
|
|
|
</tr><tr valign="center" align="center">
|
|
<td><A HREF="tag_disable.html">disable</A>
|
|
<td><A HREF="tag_DVI.html">DVI</A>
|
|
<td><A HREF="tag_superblock.html">superblock</A>
|
|
<td><A HREF="tag_serial.html">serial</A>
|
|
<td><A HREF="tag_permission.html">permission</A>
|
|
<td><A HREF="tag_detach.html">detach</A>
|
|
<td><A HREF="tag_cdr.html">cdr</A>
|
|
|
|
</tr><tr valign="center" align="center">
|
|
<td><A HREF="tag_rs422.html">rs422</A>
|
|
<td><A HREF="tag_modem.html">modem</A>
|
|
<td><A HREF="tag_notfound.html">notfound</A>
|
|
<td><A HREF="tag_tuning.html">tuning</A>
|
|
<td><A HREF="tag_libc5.html">libc5</A>
|
|
<td><A HREF="tag_startup.html">startup</A>
|
|
<td><A HREF="tag_clock.html">clock</A>
|
|
<td><A HREF="tag_ping.html">ping</A>
|
|
|
|
</tr><tr valign="center" align="center">
|
|
<td><A HREF="tag_accounts.html">accounts</A>
|
|
<td><A HREF="tag_lilo.html">lilo</A>
|
|
<td><A HREF="tag_NDS.html">NDS</A>
|
|
<td><A HREF="tag_95slow.html">95slow</A>
|
|
<td><A HREF="tag_nonlinux.html">nonlinux</A>
|
|
<td><A HREF="tag_progenv.html">progenv</A>
|
|
<td><A HREF="tag_cluster.html">cluster</A>
|
|
<td><A HREF="tag_ftpd.html">ftpd</A>
|
|
|
|
</tr></table>
|
|
<P> <hr> <P>
|
|
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::-->
|
|
<A HREF="./index.html"><IMG SRC="../gx/indexnew.gif"
|
|
ALT="[ Table Of Contents ]"></A>
|
|
<A HREF="../index.html"><IMG SRC="../gx/homenew.gif"
|
|
ALT="[ Front Page ]"></A>
|
|
<A HREF="lg_bytes32.html"><IMG SRC="../gx/back2.gif"
|
|
ALT="[ Previous Section ]"></A>
|
|
<A HREF="./stemen.html"><IMG SRC="../gx/fwd.gif"
|
|
ALT="[ Next Section ]"></A>
|
|
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::-->
|
|
</body>
|
|
</html>
|
|
<!--endcut ========================================================= -->
|
|
|
|
|