Subject: How can one lay out a DOS disk so a NetBSD disklabel can live on it?
To: None <port-i386@NetBSD.ORG>
From: Greg Earle <earle@isolar.tujunga.ca.us>
List: port-i386
Date: 05/12/1995 00:59:31
OK, this is getting frustrating  :-)

When we last left Our Hero, he was begging for a Fixit floppy disk much like
the contents of INST-10.FS only with "restore" substituted for some other
things not needed to restore from a backup tape.

(I can't get "restore" over the network as someone else suggested, because the
 1.0 GENERICAHA kernel doesn't have the right settings for my NE2000 Ethernet
 board in it.)

What I *do* have is a Maxtor 7120 AT 124 Mb IDE disk which is being used as a
DOS C:  partition - the whole disk.  The geometry is 935 cyls, 16 heads, 17
sect./tr.

It looks to me like DOS' "fdisk" program created a DOS FAT16 partition that
starts at one track offset - 17 sectors, in this case - from the start of the
disk.  I booted the INST-10.FS floppy and dropped out of the install to a
shell, and then I hand-crafted an /etc/disktab entry for the IDE drive, using
the start offset and length reported back to me by both "fdisk" and "pfdisk":

Maxtor|NetBSD installation generated:\
	:dt=ST506:ty=winchester:\
	:nc#936:ns#16:nt#17:\
	:se#512:\
	:pc#254303:oc#17:ta=MS-DOS:

I then tried to mount the DOS partition via "mount -r -t msdos /dev/wd0a /mnt2"
but I got rebuffed by a lack of a NetBSD disklabel.  So I ran "disklabel"
and tried to put one on, but had a lot of problems doing so.  Eventually I
got it to the point where it would try to do it - but it warned me about the
DOS-only partition with no NetBSD partition/disklabel present.  I blindly
went forward and ended up apparently scribbling on the DOS partition table :-(

I also had some other weird errors like "wd0: hard error" trying to read
sectors 16 and 17, which was strange.

Anyway, eventually I gave up and sure enough, upon trying to boot DOS again
it said the disk was scrambled.  I booted from floppy, used OS-BS 2.0b8 to
restore the old MBR and re-installed OS-BS on the disk, and now it's back to
happily booting DOS again.  Sigh.

I take it from this experience that there's gotta be some way for one to set
up the DOS disk such that it starts at an offset sufficiently in from the
beginning of the disk that will make it avoid getting trampled if one puts a
NetBSD disklabel on it.  Is this the case?  On our old setup, an Extended DOS
partition started at sector 32 (SCSI disk) and there was a NetBSD disklabel
on it (I assume; since NetBSD installed OK ... ).  Is the key here to use
"pfdisk" to partition the DOS drive manually and have it start on some other
sector number - perhaps 34 == 2 * 17 - to allow this to work?  I suspect
"fdisk" always wants to start it 1 track in, and "pfdisk" seems to allow one
more flexibility in terms of naming & placement ... any advice from you
folks well-versed in DOS & NetBSD disk layouts would be appreciated ...

I'm convinced there's gotta be a way for me to boot the INST-10.FS floppy,
drop out to a shell, and mount an "MS-DOS" only disk temporarily onto /mnt2
so I can get at this "restore" binary.  I'm sure of it.  It's just escaping
me right now ...

	- Greg