*BSD News Article 19883


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!ucsvax!ns1.nodak.edu!netnews.nwnet.net!news.clark.edu!spool.mu.edu!agate!dog.ee.lbl.gov!hellgate.utah.edu!fcom.cc.utah.edu!cs.weber.edu!terry
Newsgroups: comp.os.386bsd.misc
Subject: Re: Will this work (two IDE drives, DOS and *BSD)?
Message-ID: <1993Aug23.164125.1497@fcom.cc.utah.edu>
From: terry@cs.weber.edu (A Wizard of Earth C)
Date: Mon, 23 Aug 93 16:41:25 GMT
Sender: news@fcom.cc.utah.edu
References: <CC73xF.8n0@rex.uokhsc.edu>
Organization: Weber State University, Ogden, UT
Lines: 172

In article <CC73xF.8n0@rex.uokhsc.edu> benjamin-goldsteen@uokhsc.edu writes:
>      I currently have a 386SX-20, 5MB RAM, 44MB IDE (Seagate ST157-A
>-- 560 cyls, 6 heads, 26 syls), AMI BIOS, etc.  I just bought a Connor
>DiskStor 84MB IDE drive (physical is 2 heads, 1522 cyls, and 46
>sectors) because my Seagate died on me (not the first time).  However,
>my Seagate came mysteriously back to life and I am thinking of trying
>to 386BSD/NetBSD/FreeBSD again.  I would like to have a 20 MB DOS
>partition on the Connor's (which will be the primary/master/C: -- I do
>not and have never trusted this Seagate) with the rest of it and the
>rest of the Seagate being one of these 386BSD's.  I have had some
>problems mixing NetBSD and DOS before and I am wondering if this will
>work?
>
>     You may wonder why I want DOS on the Connor.  If the Seagate goes
>out again, than I only loose UNIX -- which is no big deal for me
>because I only intend to look around, recompile kernels, play around
>with device drivers (all the stuff people used to do before buying
>source from AT&T got expensive).  "real work" for me still has to be
>under DOS because I need WordPerfect.
>
>     Also, which is the boot manager to use?  Perhaps not a manager --
>something simple like a program for DOS called bootunix.exe and a
>program for UNIX called bootdos.  A floppy I could insert that would
>boot UNIX would be fine, too (I do not want to load the kernel from a
>floppy).  I would like it to boot DOS normally/no questions asked.

Unfortunately, even if you replace the disk MBR on one drive with one
that understands booting from other than the first drive, you don't have
OS specific boot tracks for the partitions on the other drive that will
go to the second drive instead of the first drive.

DOS boot works like:

DOS MBR(C:) --> DOS BOOT (C:<DOS PARTITION>) --> LOAD FROM DISK(C:<DOS>)

What you would need is a modified piece of code for all three places.
For NetBSD to boot off the second drive, you'd need a modified MBR on the
first drive, then:

            --> BSD BOOT (C:<BSD PARTITION>) --> LOAD FROM DISK(C:<BSD>)

Both of these would have to be changed for BSD to boot from a drive other
than the primary drive.

You could probably do this with sufficient knowlege of the BIOS and an
assembler if there were only a possibility of two drives in the system;
in the case of a SCSI drive, you'd have to pass the device identification
information to each boot stage.  There is also some question about what
the kernel would then try to mount as root.


Instead, you should probably think about making the Seagate the primary
boot disk.  Before you yell, you should:

(1)	Make the Connor a bootable drive and install it normally; you can
	then use it as the boot device if the Seagate fails.

(2)	Change the ID on the conner and install the Seagate drive.

(3)	Make a small DOS partition at the front of the Seagate that
	has the same version of DOS and config.sys and AUTOEXEC.BAT as
	the Conner.

(4)	The first thing in the AUTOEXEC.BAT, got to D:; subsequent lines
	in the .BAT file will be run off D: (that's why the files have to
	be identical).

(5)	Get a copy of pfdisk.exe to get the BIOS apparent geometry of the
	Seagate and to create the 386BSD partition.

(6)	Follow my old coresident install instructions (reprinted following
	in case you didn't save them last time ;-)):

=============================================================================

c, h, s :	untranslated geometry, as reported by BSD driver during boot.
c', h`, s':	translated geometry, as reported by int13 ah=8.
Dc:		Number of cylinders (using the translated geometry) reported
		by fdisk/pfdisk under DOS.

The calculations:

	Total_translated_cylinders = ( c * h * s) / ( h' * s')

	Total_translated_sectors = Total_translated_cylinders * h' * s'

	Total_translated_offset_sectors = Dc * h' * s'

	Total_386BSD_translated_sectors =
		Total_translated_sectors - Total_translated_offset_sectors

yield the information necessary for the disklabel for the 386BSD install
after the DOS install.  Let's take a real example:

We have a Maxtor Panther P1-17S SCSI drive (1.778G unformatted).
We have an Adaptec 1742A in Standard mode with enhance translation turned
off (standard translation is turned on).

The translated geometry of the drive (reported by int13 ah=8) is:

	1024 Cylinders			c'
	  64 Heads			h'
	  32 Sectors			s'

The actual geometry of the drive (reported by 386BSD on boot) is:

	1778 Cylinders			c
	  19 Heads			h
	  86 Sectors			s

The 'Total_translated_cylinders' is the number of translated cylinders the
disk would have if DOS didn't limit it to 1024.  This ends up being:

	( 1778 * 19 * 86 ) / ( 64 * 32) = 1418.58

To calculate 'Total_translated_sectors', we first round thi down to an
integer value, since non-integer cylinder numbers are meaningless.  This
means we are going to lose some disk space (about 608k, to be exact):

	1418 * ( 64 * 32) = 2904064


Now we need to know 'Dc': the number of DOS cylinders; for our example,
let's assume 180M.  This works out to a nice round 180 cylinders for DOS
(the DOS fdisk program shows a start of '0' and an end of '179').  Using
this number, we determine the number of sectors into the disk where the
386BSD parition starts ('Total_translated_offset_sectors):

	180 * ( 64 * 32) = 368640

Finally, we need to know how many sectors are going to be available to
386BSD, or 'Total_386BSD_translated_sectors':

	2904064 - 368640 = 2535424


We now have all the information necessary for our disktab entry:

	P1-17S|Maxtor Panther 1.78GB SCSI:\
		:dt=SCSI:ty=winchester:se#512:nt#64:ns#32:nc#1418:\
		:pa#????:oa#368640:ta=4.2BSD:ba#4096:fa#512:\
		:pb#????:ob#????:tb=swap:\
		:pc#2535424:oc#368640:\
		:pd#2904064:od#0:\
		:pe#????:oe#????:te=4.2BSD:be#4096:fe#512:\
		:pf#????:of#????:tf=4.2BSD:bf#4096:ff#512:\
		:pg#????:og#????:tg=4.2BSD:bg#4096:fg#512:\
		:ph#????:oh#????:th=4.2BSD:bh#4096:fh#512:


Calculation of ???? values is based on how you want to divide up the disk
partitions.  Partitions e-h are optional depending on the configuration
chosen by the user, with the exception that the total of pa, pb, pe, pf, pg
and ph can not exceed the value of pc, and that ob = oa + pa, oe = ob + pb,
of = oe + pe, og = of + pf, and oh = og + pg.

The values nt, ns, nc, oa, pc, oc, pd, and od should all be obvious in
their derivation from:

	Total_386BSD_translated_sectors
	Total_translated_offset_sectors
	Total_translated_cylinders
	h'
	s'

=============================================================================

					Terry Lambert
					terry@icarus.weber.edu
---
Any opinions in this posting are my own and not those of my present
or previous employers.