Subject: Re: Supporting sector size != DEV_BSIZE -- tests
To: Trevin Beattie <trevin@xmission.com>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 06/11/2002 18:03:22
On Tue, 11 Jun 2002, Trevin Beattie wrote:

> After a bit of effort, I've managed to create a 4.2BSD file system on a
> real 2048 bytes/sector MO disk with my patched kernel and populate it.  For
> the most part, everything seems to work okay.  (Of course, I'll probably
> have to recreate it all again when I change what gets stored in di_blocks.)
>
> There are still a couple of things that need fixing.  One is the
> installboot program, which failed when it tried to write the last partial
> sector of the boot code.  The other is fdisk, which was unable to read or
> write the MBR.
>
> The way things stand now, the disk label on the i386 port gets written at
> an offset of 512 bytes from the start of the partition.  (Or, more
> generally, 'LABELSECTOR' DEV_BSIZE blocks from the start of the disk, on
> any port.)  I've already posed the question of the disk label location
> before, and Bill recommends placing it on sector 1, using the drive's

Well, I'm not sure what else to do. Prior Art would be nice. :-)

> actual sector size.  Which of course means the kernel must know the sector
> size before reading the disk label (I don't think that's a problem), and
> you can't dump a file system to another drive with a different sector size
> without also regenerating a new disk label (I have no objection to that,
> either, since the label is supposed to describe the disk it sits on).  I
> haven't heard any alternative opinions on that matter.
>
> So, unless anyone has an objection (or better yet, prior art to the
> contrary), I'm going to add some changes to store the disk label at
> LABELSECTOR *sectors* from the start of a partition.

I asked Frank about this, and he thinks *sectors* is fine. So let's go for
it.

> Also, during my testing I've found that the i386 BIOS (at least mine) can't
> boot from a disk with 2048 bytes/sector. :-(  So even if I do get
> installboot and fdisk to do the right thing, I won't be able to test it.
> Despite that, I could load the kernel from the MO disk and use it as the
> root file system (I've done the latter already, after loading the kernel
> from floppy) as long as I have a boot loader installed on floppy or a
> regular hard disk, that could read netbsd from drive sd2.  Would adding
> more sd* drives to the boot code be trivial?  I'll also have to check
> whether the boot loader can read different sector sizes.

I don't think I ever got the boot code working with different sector
sizes. Ick.. :-(

Take care,

Bill