*BSD News Article 16329


Return to BSD News archive

Newsgroups: comp.os.386bsd.questions
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!hamblin.math.byu.edu!news.byu.edu!ns.novell.com!gateway.univel.com!fcom.cc.utah.edu!cs.weber.edu!terry
From: terry@cs.weber.edu (A Wizard of Earth C)
Subject: Re: NetBSD and DOS coexistence ?
Message-ID: <1993May20.181205.22897@fcom.cc.utah.edu>
Sender: news@fcom.cc.utah.edu
Organization: Weber State University  (Ogden, UT)
References: <1t5kqp$mh4@lucy.ee.und.ac.za> <1993May16.212102.6346@fcom.cc.utah.edu> <1tfr68$f4b@lucy.ee.und.ac.za>
Date: Thu, 20 May 93 18:12:05 GMT
Lines: 130

In article <1tfr68$f4b@lucy.ee.und.ac.za> barrett@lucy.ee.und.ac.za (Alan Barrett) writes:
>Well, after several days' delay, I have finally got around to going through
>this carefully.
[ ... ]
>In article <1993May16.212102.6346@fcom.cc.utah.edu>,
>Terry Lambert <terry@cs.weber.edu> (A Wizard of Earth C) replied
>with a long description of what looked like a complicated process, but
>turned out to be only trivially different from what I had already
>tried, without success.
>
>> 3)	Translated geometries are "different".  You still need a calculator,
>> 	but you also need a piece of paper and a pen.  Then you need to do
>> 	the following:
>> 
>> 	c, h, s :	untranslated geometry, as reported during boot.
>
>In my case (Maxtor 7120 drive), c=1024, h=14, s=17.  (and c*h*s = 243712)
>
>> 	c', h`, s':	translated geometry, as reported by int13 ah=8
>> 			or ide_conf.exe or pfdisk.exe..
>
>In my case, c'=900, h'=15, s'=17.  (and c'*h'*s' = 229500)
>
>> 	Dc:		Number of cylinders (using the translated geometry)
>> 			reported by fdisk/pfdisk under DOS (1c).
>
>I think that what is really wanted is the number of the first cylinder
>available for NetBSD, which in my case is 501.  My DOS partition is in
>fact slightly less than 501 cylinders, because 1 sector is used by the
>partition table and several sectors are wasted between the partition
>table and the start of the DOS partition.

No!  The DOS partition, if it is at the front of the drive, is assumed to
contain the partition table!  (If it's not at the front, you will generally
end up screwed).

The offsets and numbers I gave are *the real thing* for my drive, and I
(obviously) have a DOS partition table hanging around.  Ignore the size
of the partition table and the distance to the start of the DOS partition!

If you use pfdisk to create your 386BSD partition, pfdisk will report (with
the "l" command) the offset from the start of disk that you must enter for
the NetBSD install.  This should match the value calculated as I suggested!

If your controller does bad sector forwarding during the translation, then
all bets are off unless you have written documentation as to where the
"replacement" sectors are located and how many there are.  This is what I
called a "non-linear translation" in my post, and it generally means that
you are allowed to share the disk between multiple OSs, but only if they
either always use BIOS (getting the same non-linear translation) or never
use BIOS (getting the linear physical layout of the disk).  You have the
choice in that case of running the drive DOS only or 386BSD only but not
both.  I don't know of *any* "cheap" IDE controllers that do this at all,
do you should be safe.

>> 	The calculations:
>> 		Total_translated_cylinders = ( c * h * s) / ( h' * s')
>
>In my case, (1024 * 14 * 17) / (15 * 17) gives 955 and some change, so
>truncate it to 955.  (This is the only difference that I could find
>between what I had already done and what Terry described; I had used
>Total_translated_cylinders = c' = 900, but I don't see why that should
>make any difference other than to deny me the use of the last 55
>translated cylinders.)

Nope, it won't do a thing other than rob you of about 7 Meg of disk space.

>> 		Total_translated_sectors = Total_translated_cylinders * h' * s'
>
>In my case, Total_translated_sectors = 224525 (or 229500 when calculated
>my old way).
>
>> 		Total_translated_offset_sectors = Dc * h' * s'
>
>In my case, Total_translated_offset_sectors = 127755

What did pfdisk say after you created the A5 (165) partition for 386BSD?
It has the correct offset.  *DON'T* count the partition table seperate
from the DOS partition!

>Fine so far, and the install process writes the disk label in
>translated cylinder 501, head 0, sector 2, as expected.  However, a
>subsequent attempt to copy the kernel from the kernel copy disk fails,
>with mount complaining about a missing or invalid disk label.  Sorry, I
>don't remember the exact error messagei, and I haven't tried it again
>recently because my system now works with a partition table that fools
>NetBSD into storing the disk label in the physical second sector.

The location (501/0/2) isn't correct, then.

The disklabel is used twice:  Once by the BIOS based boot code to locate
the absolute sector of the root partition to find the second stage boot,
and again during the second stage boot to get the absolute untranslated
sector offsets for use by the 386BSD disk driver, which operates in an
untranslated mode.

Finding the disklabel is a function of placing it in the correct location
relative to the first stage boot that is written at the start of the
386BSD partition.  If the disklabel is not in the correct location (if,
for instance, you "add one to skip the partition table"), then the DOS
MBR isn't going to find the first stage boot because it will *ALSO* be
in the wrong location.

A disk will look like:

[MBR][       DOS        ][                     386BSD                 ]

The partition table is embedded in the MBR.

The DOS partition will look like:

[[DOS BOOT][        DOS CRUFT        ]]

The 386BSD partition will look like:

[[1st stage boot][disklabel][ partition a][ swap ][ ... ]]

The whole partition in quantity is /dev/rsd0c or /dev/rwd0c.
The whole disk in quantity is /dev/rsd0d or /dev/rwd0d.


----
					Terry Lambert
					terry@icarus.weber.edu
---
Any opinions in this posting are my own and not those of my present
or previous employers.
-- 
-------------------------------------------------------------------------------
                                        "I have an 8 user poetic license" - me