Subject: Supporting sector size != DEV_BSIZE -- tests
To: None <tech-kern@netbsd.org>
From: Trevin Beattie <trevin@xmission.com>
List: tech-kern
Date: 06/11/2002 08:24:55
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
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.

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.

-----------------------
Trevin Beattie          "Do not meddle in the affairs of wizards,
trevin@xmission.com     for you are crunchy and good with ketchup."
      {:->                                     --unknown