Bad magic number in super-block ?

Bad magic number in super-block ?

Post by cg.. » Sat, 27 Jul 2002 02:03:12



Hi,

Something happened so I can no longer mount my /dev/hda.

 cfdisk shows:---
                             Disk Drive: /dev/hda
                          Size: 5250011136 bytes
             Heads: 255   Sectors per Track: 63   Cylinders: 638

 Name        Flags      Part Type  FS Type          [Label]        Size (MB)
--------------------------------------------------------
 hda1        Boot        Primary   FAT16            [MS-DOS_6   ]     494.97*    
 hda2                    Primary   Linux swap                          50.81*    
 hda3                    Primary   Linux ext2                         838.98*    
 hda5                    Logical   Linux                             2143.90*    
 hda6                    Logical   Linux ext2                        1719.09

 hda5 was a RH6.2 instalation (before problem).
As is hda6, which is now 'seeing' it.
Note the 'slightly' different "FS Type" seen by cfdisk.

e2fsck /dev/hda5               shows:-
e2fsck 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
Couldn't find ext2 superblock, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/hda5

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
--------
and e2fsck -b 8193 /dev/hda5   shows the same.
--------
and then: debugfs /dev/hda5    shows:-
debugfs 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
/dev/hda5: Bad magic number in super-block while opening filesystem
debugfs:    <- awaiting input ??

The use of debugfs apparently needs an in-depth knowledge of ext2 ?

Can I fix my /dev/hda5 ?

Thanks for any ideas/info.

-- Chris Glur.

 
 
 

Bad magic number in super-block ?

Post by Dances With Crow » Sat, 27 Jul 2002 08:30:58



Sun and said:

[ c.o.l.dev.system removed--this has nothing to do with development! ]

Quote:> Something happened so I can no longer mount my /dev/hda.

> e2fsck /dev/hda5               shows:-
> e2fsck 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
> Couldn't find ext2 superblock, trying backup blocks...
> e2fsck: Bad magic number in super-block while trying to open /dev/hda5

> and e2fsck -b 8193 /dev/hda5   shows the same.

The maintainers of the e2fsprogs package never updated the messages that
e2fsck spits out.  Since about 2000, mke2fs creates filesystems with the
sparse_superblock flag turned on, which means the first backup
superblock is at 32768, not 8193.  Try that one instead.

Quote:> and then: debugfs /dev/hda5    shows:-
> debugfs 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
> /dev/hda5: Bad magic number in super-block while opening filesystem
> debugfs:    <- awaiting input ??

> The use of debugfs apparently needs an in-depth knowledge of ext2 ?

Well, that's what the man page recommends.  You *did* read the man page,
right?  Read it several times, just to make sure, since it is not a tool
intended for casual use.  You may wish to practice using it on a
partition that is reasonably OK and that you've backed up recently, so
you can learn how it works before trying to use it in a semi-critical
situation.

Quote:> Can I fix my /dev/hda5 ?

If you have a backup (why don't you have one, if you don't?  Make
regular backups, or you *will* *lose* *data*, and it will be your fault)
then just run badblocks on hda5, followed by mkfs, followed by
restoring from your backup to hda5.  If not... it depends on a lot of
things.  If you can get fsck to work, you have a good chance of
recovering some data.

--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin /
http://www.brainbench.com     /  "He is a rhythmic movement of the
-----------------------------/    penguins, is Tux." --MegaHAL

 
 
 

Bad magic number in super-block ?

Post by Kasper Dupon » Mon, 29 Jul 2002 00:24:53



> Hi,

> Something happened so I can no longer mount my /dev/hda.

What happened? Without knowing what happened it is hard to
fix it.

Quote:

>  cfdisk shows:---
>                              Disk Drive: /dev/hda
>                           Size: 5250011136 bytes
>              Heads: 255   Sectors per Track: 63   Cylinders: 638

>  Name        Flags      Part Type  FS Type          [Label]        Size (MB)
> --------------------------------------------------------
>  hda1        Boot        Primary   FAT16            [MS-DOS_6   ]     494.97*
>  hda2                    Primary   Linux swap                          50.81*
>  hda3                    Primary   Linux ext2                         838.98*
>  hda5                    Logical   Linux                             2143.90*
>  hda6                    Logical   Linux ext2                        1719.09

>  hda5 was a RH6.2 instalation (before problem).
> As is hda6, which is now 'seeing' it.

Is the table otherwise correct? Are the size and location
of all partitions exactly what they used to be?

Quote:> Note the 'slightly' different "FS Type" seen by cfdisk.

Linux does not use that field for anything, it is only
there for other OSes like DOS. The two partitions could
be created by different programs.

Quote:

> e2fsck /dev/hda5               shows:-
> e2fsck 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
> Couldn't find ext2 superblock, trying backup blocks...
> e2fsck: Bad magic number in super-block while trying to open /dev/hda5

> The superblock could not be read or does not describe a correct ext2
> filesystem.  If the device is valid and it really contains an ext2
> filesystem (and not swap or ufs or something else), then the superblock
> is corrupt, and you might try running e2fsck with an alternate superblock:
>     e2fsck -b 8193 <device>
> --------
> and e2fsck -b 8193 /dev/hda5   shows the same.

There will usually be many backup superblocks. But
without the superblock it will be difficult to know
exactly where. If you know the circumstances under
which the filesystem was created, you might also be
able to find out where the superblocks will be.
Otherwise trial and error is the only option. Perhaps
there is some tool to scan a partition for superblocks.

But notice that e2fsck is only going to help you if
the entry in the partition table is correct. If the
problem is in the partitioning and not the filesystem
e2fsck is only going to make the problem worse.

Quote:> --------
> and then: debugfs /dev/hda5    shows:-
> debugfs 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
> /dev/hda5: Bad magic number in super-block while opening filesystem
> debugfs:    <- awaiting input ??

> The use of debugfs apparently needs an in-depth knowledge of ext2 ?

Yes.

Quote:

> Can I fix my /dev/hda5 ?

Maybee. I suggest you take a look on the partition
with a hexdump utility or something similar to get an
idea about the amount of damage.

Another option is the -S option to mke2fs. But this
is dangerous and could easilly destroy what data is
not already lost. DON'T DO THIS to the only copy of
your partition.

       -S     Write superblock and group descriptors only.   This
              is  useful  if  all  of  the  superblock and backup
              superblocks are corrupted, and a last-ditch  recov-
              ery  method is desired.  It causes mke2fs to reini-
              tialize the superblock and group descriptors, while
              not  touching  the  inode  table  and the block and
              inode bitmaps.  The e2fsck program  should  be  run
              immediately after this option is used, and there is
              no guarantee that any data will be salvageable.  It
              is  critical  to  specify  the  correct  filesystem
              blocksize when using this option, or  there  is  no
              chance of recovery.

Quote:

> Thanks for any ideas/info.

How valuable are your data?

You could buy a new harddisk and do your experiments
on a copy of the partition rather than on the original.

Quote:

> -- Chris Glur.

--
Kasper Dupont -- der bruger for meget tid p? usenet.


 
 
 

Bad magic number in super-block ?

Post by cg.. » Mon, 29 Jul 2002 04:13:21


> > Something happened so I can no longer mount my /dev/hda.
> > ... snip ...

> > e2fsck /dev/hda5               shows:-
> > e2fsck 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
> > Couldn't find ext2 superblock, trying backup blocks...
> > e2fsck: Bad magic number in super-block while trying to open /dev/hda5

> > The superblock could not be read or does not describe a correct ext2
> > filesystem.  If the device is valid and it really contains an ext2
> > filesystem (and not swap or ufs or something else), then the superblock
> > is corrupt, and you might try running e2fsck with an alternate superblock:
> >     e2fsck -b 8193 <device>
> > --------
> > and e2fsck -b 8193 /dev/hda5   shows the same.
> > ... snip ...

> The maintainers of the e2fsprogs package never updated the messages that
> e2fsck spits out.  Since about 2000, mke2fs creates filesystems with the
> sparse_superblock flag turned on, which means the first backup
> superblock is at 32768, not 8193.  Try that one instead.
> ...
> If you can get fsck to work, you have a good chance of
> recovering some data.

Thanks.  This recovered much data, including the important ap.

-- Chris Glur.

 
 
 

1. Bad magic number in super-block / Group descriptors look bad

Hi,

Ever found yourself in this situation ?
You've had a power-failure or just did something very bad with your
harddisk
and now when trying to mount it fsck screams:

Group descriptors look bad... trung backup blocks....
/sbin/e2fsck: Bad magic number in super-block while trying to open
/dev/hdb1

I've had this problem 2 times before now, and i've had a hell of a
time finding any docs related. I DID eventually find this:
(Note: text below is copy-pasted together from several articles, and
so not
 written by myself...)

----- begin of article pastes ----------------

From MANPAGES of mke2fs:

-S
Write superblock and group descriptors only. This is useful if all of
the superblock and backup superblocks are corrupted,
 and a last-ditch recovery method is desired. It causes mke2fs to
reinitialize the superblock and group descriptors, while not
 touching the inode table and the block and inode bitmaps. The e2fsck
program should be run immediately after this option is used,
 and there is no guarantee that any data will be salvageable.

Ofcourse you're should only try this when you've exhausted all other
options.
Other options are:

fsck -b 32 /dev/hdb1  (use the first backup super-block)

To determine the locations of the backup superblocks:
# newfs -N /dev/r

    Caution: Use the "N" option. If the "n" option is used, the
filesystem
             may be destroyed.

Example using fsck on a backup superblock:

     /dev/rsd1a:   204540 sectors in 974 cylinders of 6 tracks, 35
sectors
     104.7MB in 61 cyl groups (16 c/g, 1.72MB/g, 768 i/g)
     super-block backups (for fsck -b #) at:
     32, 3440, 6848, 10256, 13664, 17072, 20480, 23888, 26912,
     30320, 33728, 37136, 40544, 43952, 47360, 50768, 53792, 57200,
     60608, 64016, 67424, 70832, 74240, 77648, 80672, 84080, 87488,
     90896, 94304, 97712, 101120, 104528, 107552, 110960, 114368,
117776,
     121184, 124592, 128000, 131408, 134432, 137840,141248, 144656,
148064,
     151472, 154880, 158288, 161312, 164720, 168128, 171536, 174944,
178352,
     181760, 185168, 188192, 191600, 195008, 198416, 201824,

         In this example, 201824 is the last backup superblock
location
         198416 is the next to last backup superblock location.

------------- end of article pastes --------------
Also it's interesting to note that it seems the larger the disk
the less backup super-block are stored.. I my case, on a 40 GB Maxtor:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632,
2654208, 4096000

where the only backups, (the newfs command mentioned above, was not
installed here, and i could not find it anywhere) i learned this only
after mk2fs told me after it had written the new super-block to my
disk...

Hope this helpes some people !

Best regards,

Jan Wilmans

2. Problem with ipldevice

3. Newbie: Bad magic number in super-block

4. Printing from Windows NT thru SUNSPARC

5. bad magic number in super-block

6. What kind of locking does sendmail do on /var/spool/mail/*

7. Bad magic number in super-block (help!)

8. Clueless newbie modem question

9. HELP!! - bad magic number in super-block.

10. e2fsck: bad magic number in super-block

11. Bad magic number in super-block

12. Error when booting; bad magic number in super-block; please help!

13. bad magic number in super-block