tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: fsck(8) and superblock backups



On Tue, 6 Mar 2012 08:20:22 +0000
David Laight <david%l8s.co.uk@localhost> wrote:

> On Mon, Mar 05, 2012 at 07:16:09PM -0500, Matthew Mondor wrote:
> > Hello,
> > 
> > Does FFS1 contain superblock backups?  I have a broken FS image which I
> > have attempted to fix or recover files from, and the corruption is
> > located at the beginning.  fsck(8) complains that it cannot find the
> > superblock, but I see no scan mode for it to search for a superblock
> > backup, either.
> 
> There are a lot of copies of the superblock.
> 
> My thoughts are that even mount should verify the last one in the fs.
> fsck could search/guess the location of a later superblock quite easily
> and verify the a reasonable number of the later ones are present.
> 
> One reason for doing the verifies is that the subsequent superblocks
> are much more likely to have been destroyed if the disk has been
> reused for a different fs type.
> Checking the last one (and the last physical sector of the fs) is
> also a good check against fsck using corrupt data.
> 
> I've also sometimes thought that fsck should queue up sector writes
> so that it can decide 'this is all horribly wrong' and not have written
> to the disk.
> 
> Maybe some of this could be a 'summer of code' project...

Those are good ideas.

Perhaps that meanwhile we could modify fsck_ffs(8)'s -b option
documentation to also mention scan_ffs(8) which can be used with -b to
locate other superblock backups?  It greatly helped me when Jonathan A.
Kollasch mentioned to me that we had it.  A proposed diff is attached.

I also like the previously mentioned idea about fsck(8) supporting -b
and being able to pass it to fsck_ffs(8), as it took me a while to
notice that fsck could be given such an option.  I had to first notice
there was an fsck_ffs(8) man page and invoke fsck_ffs(8) explicitely.
Perhaps that fsck(8) doesn't support -b as not all fsck backends
support it, though.

Thanks,
-- 
Matt
--- fsck_ffs.8.orig     2012-03-06 04:52:58.000000000 -0500
+++ fsck_ffs.8  2012-03-06 04:59:00.000000000 -0500
@@ -163,6 +163,12 @@
 .Ar block
 as the super block for the file system.
 Block 32 is usually an alternative super block.
+The
+.Fl b
+option of the
+.Xr scan_ffs 8
+utility can also be used to find the offset of other super block backups
+in a file system.
 .It Fl c Ar level
 Convert the FFSv1 file system to the level
 .Ar level .
@@ -364,6 +370,7 @@
 .Xr fs 5 ,
 .Xr fstab 5 ,
 .Xr dumpfs 8 ,
+.Xr scan_ffs 8 ,
 .Xr fsck 8 ,
 .Xr fsdb 8 ,
 .Xr newfs 8 ,


Home | Main Index | Thread Index | Old Index