Subject: Re: mkfs should clear possible alternate superblocks
To: Greywolf <greywolf@starwolf.com>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-userlevel
Date: 09/10/2003 19:37:09
On Wed, 10 Sep 2003, Greywolf wrote:

> Thus spake David Laight ("DL> ") sometime Today...
>
> DL> From: David Laight <david@l8s.co.uk>
> DL> Cc: tech-userlevel@NetBSD.org
> DL> Subject: Re: mkfs should clear possible alternate superblocks
> DL> Date: Wed, 10 Sep 2003 23:46:19 +0100
> DL> X-Spam-Level:
> DL>
> DL> On Wed, Sep 10, 2003 at 10:21:13PM +0000, Martin J. Laubach wrote:
> DL> > | > NetBSD over a previously NetBSD-raided drive, and the initial boot
> DL> > | > after installation got very confused because it thought the filesystem
> DL> > | > was still raided?
> DL> > |
> DL> > |  For FFSv2 it won't and the raid header will be intact.
> DL> > |  So maybe the raid magic number needs adding to the list that get zapped.
> DL> >
> DL> >   So instead of hard coding a gazillion magic sector numbers
> DL> > to be zapped, why does newfs not just take the easy way and zero
> DL> > out the first 255 or so sectors?

Actually, how about from 8K in through the first 255 sectors?

> DL> Because they contain the boot code.
>
> 1.  In every filesystem?

No. Not sure what Windows does. ext2fs only saves the first 2k for boot
code.

> 2.  Doesn't newfs skip the MBR and the disklabel?

It skips the first 8k at present, so that the MBR and disklabel can be
there (though you'd only have both there on i386 if you made c == d).

> 3.  Which boot code, primary, secondary or tertiary?  [I'm guessing
> primary...]

Depends. For i386, it's the primary and secondary. Primary is the first
sector, secondary sectors 2 through 15.

Take care,

Bill