Subject: Re: mkfs should clear possible alternate superblocks
To: Bill Studenmund <wrstuden@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-userlevel
Date: 09/11/2003 08:22:53
> > 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?
The reason for FFSv2 moving its superblock down the filesystem is to
allow for larger boot code - so you have to assume that there is
a large boot program in that area.
> > 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.
In that case I'm looking in the wrong place for an ext2fs magic number.
It also makes booting from ext2fs somewhat tricky!
> > 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).
It skips 8k for FFSv1 and 64k for FFSv2. On i386 this skips the
partition boot code (the MBR is in disk sector 0 and just reads in the
first sector of the partition).
> > 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.
I'd say it depends on your numbering scheme :-)
On i386 (and similar) this the code that loads the 'boot' program.
David
--
David Laight: david@l8s.co.uk