New to the but not linux

Uncle Jim jim at jimani.com
Sun Sep 19 00:15:30 CDT 2004


Hi,

On Sat, Sep 18, 2004 at 11:06:31AM -0500, Jonathan Hutchins wrote:

> >        sb=n   Instead  of  block  1,  use block n as superblock. 
> 
> Given that sparse superblock backups are now the norm, how does one find them 
> if one didn't think of this before the crash?

Good question.  I doubt you are the first to ask it.  My guess is that
someone smarter/lazier than you and I has asked this question and then written
a tool to answer it but I don't know what that tool is.

Looking at the man page for ext2fs I found a reference to the mke2fs command
that could help:

              Additional backup superblocks can be  determined  by  using  the
              mke2fs  program  using  the  -n  option  to  print out where the
              superblocks were created.   The -b option to mke2fs, which spec-
              ifies blocksize of the filesystem must be specified in order for
              the superblock locations that are printed out to be accurate.

In the man page for mke2fs I found this:

       -n     causes  mke2fs  to not actually create a filesystem, but display
              what it would do if it were to create a filesystem.  This can be
              used  to  determine the location of the backup superblocks for a
              particular filesystem, so long as  the  mke2fs  parameters  that
              were  passed when the filesystem was originally created are used
              again.  (With the -n option added, of course!)

The command "tune2fs -l" will tell you what the blocksize is for a partition.  If
you have a good partition created at about the same time you could use this to
make a first guess at the blocksize for the bad partition.

>From here it is a lot of trial and error and luck.  Kinda makes you want to go
write down a list of backup superblocks for your favorite partitions, doesn't it?
-- 
Jim



More information about the Kclug mailing list