Date: Tue, 11 Mar 2008 19:47:09 -0700 From: Xin LI <delphij@delphij.net> To: Dieter <freebsd@sopwith.solgatos.com> Cc: freebsd-bugs@FreeBSD.org Subject: Re: kern/119638: [ffs] fsck_ffs -b 32 doesn't repair primary superblock Message-ID: <47D7442D.2080600@delphij.net> In-Reply-To: <200803120230.m2C2U32p094690@freefall.freebsd.org>
index | next in thread | previous in thread | raw e-mail
Dieter wrote:
> The following reply was made to PR kern/119638; it has been noted by GNATS.
>
> From: Dieter <freebsd@sopwith.solgatos.com>
> To: Yoshihiro Ota <ota@j.email.ne.jp>
> Cc: bug-followup@FreeBSD.org
> Subject: Re: kern/119638: [ffs] fsck_ffs -b 32 doesn't repair primary superblock
> Date: Tue, 11 Mar 2008 14:31:49 +0100
>
> > Was your filesystem on /dev/da0s1 "UFS version 1?"
> >
> > See "man fsck_ffs":
> >
> > -b Use the block specified immediately after the flag as the super
> > block for the file system. An alternate super block is usually
> > located at block 32 for UFS1, and block 160 for UFS2.
> >
> > If you had UFS2, which is the default since 5.1-RELEASE for almost 4 years,
> > you should have used 160, instead.
>
> AAAUUGHH!!!
>
> For decades, FFS always used 32 as the first backup superblock, and
> now some rocket scientist has broken it. Now we have some random
> block. :-( 160? I'm getting block 256 as the first alternate.
>
> Despite this, fsck was perfectly happy using whatever bits happened to be at
> block 32 and mangled the filesystem accordingly. Except it didn't repair
> the primary superblock for some reason.
>
> Fsck accepting block 32 when it isn't really the superblock is a whole
> other (more difficult) problem. If block 32 is a data block, there is
> nothing stopping it from looking like a superblock. Have to think about
> that one.
Are you really sure? Without a signature (UFS1_MAGIC or UFS2_MAGIC) in
the superblock, fsck_ffs would not allow you to use that block as an
alternative superblock...
> This PR is about fsck not repairing the primary superblock. Why didn't
> fsck repair the primary superblock once it had mangled everything else
> into compliance?
Try this:
Index: fsutil.c
===================================================================
RCS file: /home/ncvs/src/sbin/fsck_ffs/fsutil.c,v
retrieving revision 1.26
diff -u -p -r1.26 fsutil.c
--- fsutil.c 31 Oct 2006 22:06:56 -0000 1.26
+++ fsutil.c 22 Feb 2008 00:50:43 -0000
@@ -301,7 +301,7 @@ ckfini(int markclean)
if (havesb && cursnapshot == 0 && sblock.fs_magic ==
FS_UFS2_MAGIC &&
sblk.b_bno != sblock.fs_sblockloc / dev_bsize &&
!preen && reply("UPDATE STANDARD SUPERBLOCK")) {
- sblk.b_bno = sblock.fs_sblockloc / dev_bsize;
+ sblk.b_bno = SBLOCK_UFS2 / dev_bsize;
sbdirty();
flush(fswritefd, &sblk);
}
Cheers,
--
Xin LI <delphij@delphij.net> http://www.delphij.net/
FreeBSD - The Power to Serve!
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47D7442D.2080600>
