*BSD News Article 14955


Return to BSD News archive

Path: sserve!nschq!runxtsa!bde
From: bde@runx.oz.au (Bruce Evans)
Newsgroups: comp.os.386bsd.questions
Subject: Re: Problems installing NetBSD to coexist with DOS.
Message-ID: <1993Apr24.132607.3758@runx.oz.au>
Date: Sat, 24 Apr 93 13:26:07 GMT
References: <1627@rook.ukc.ac.uk> <1r5vqs$ah5@leps5.phys.psu.edu>
Organization: RUNX Un*x Timeshare.  Sydney, Australia.

In article <1r5vqs$ah5@leps5.phys.psu.edu> kenh@leps5.phys.psu.edu (Ken Hornstein) writes:
>In article <1627@rook.ukc.ac.uk> dac@ukc.ac.uk (David Clear) writes:

>>I played around with the numbers and found a start sector number which
>>I think didn't hit the DOS partition.  I gave these to the NetBSD
>>install program and the install started.
>>At the point where the disklabel happens, it said:
>>
>>"Overwriting disk with DOS partition table? (n):"
>...
>I really hate this; I ran into the exact same problems with disklabel when I
>was trying to do disk partitioning under 386BSD.  Talk about a worthless
>message!  But the results are different; if you hit "y", then all you get is
>the NetBSD partition; if you hit "n", then all you get is the MSDOS parition.

The correct response to this message is to turn the computer off.

The message only appears in the following circumstances:

1) disklabel thinks that the disk has a valid DOS partition table. If it
   guesses wrong about this then it overwrites the partition table without
   warning.
and
2) you have set up a 386BSD partition (of type 0xA5).
and
3) the offset of this partition in the DOS partition table agrees with the
   offset of the 'a' partition in the disktab entry (or in the on-disk
   label.  I once wrote the label without trusting or using disklabel,
   and didn't have an 'a' partition.  The 'a' partition defaulted to
   offset 0 and running disklabel to change the label destroyed the
   partition table instead).

The "n" in the message is what you have to type to avoid overwriting the
label.  Typing "%^#%^&"<Enter> destroys the label the same as "y"<Enter>.
The "n" should be "y" to match the default action but the default action
is bad.  Disklabel should refuse to overwrite disks with partition tables.
If the table really has to be overwritten, then all partitions should be
removed first!

Mismatched offsets in point 3) is probably the most common source of
errors.  The offset in the 386BSD partition table entry ought to be
reliable at least if you have created the partition using an fdisk
program and not hacked it in using a binary editor.  386BSD will probably
get it wrong if it is confused about the drive's geometry.

To recover from overwritten partition tables I use
	dd if=/dev/rwd0 of=/somewhere/safe/mydrive-bootblock bs=8k count=1
Then clobbered partition tables can be restored using
	dd of=/dev/rwd0 if=/somewhere/safe/mydrive-bootblock bs=8k count=1
Replace rwd0 by rwd1 for drive 1 and by rwd0c for preservation of disk
labels and boot stuff instead of partition tables.

>I did manage to get one step farther; remembering that 386BSD wanted a
>parition
>ID of 165, I used pfdisk to make a parition with that ID number.  _then_ when
>I installed, I didn't get that damn message from disklabel.  Unfortunately,

Maybe point 2) above is a more common sources of errors that point 3) :-).

>>Finally, the NetBSD system I installed worked fine.  Except that,
>>doesn't 386BSD have a 'reboot -todos' command or something similar?  I
>>couldn't find a way to take the system down so it would reboot to DOS.

Every OS shouldn't have to support rebooting every other OS.  I just
use plain reboot and then select the OS to boot from a boot selection
program.

>>Now something a little worrying.  After completely bogging the
>>installation, I tried to re-install DOS.  I rebooted from the DOS5.0
>>install disk and it said 'Determining your configuration', accessed the
>>disk and hang.

This is because DOS FDISK is confused by the junk in the master boot record
left by 386BSD.  It thinks that the mbr must contain valid data because it
wrote the data itself.

>>I had to boot from another system floppy and use FDISK
>>/MBR (and my DOS manual doesn't actually quote what that command
>...
>>I think this is awful.  What crud is the installation leaving on the
>>disk to make it know it has been there before?  Is there any way to
>>remove it?

>Try a low-level format; worked for me.

Just use dd.  If you haven't saved an old mbr, use a file filled with 0's.
Unfortunately you need a working (non-DOS) system to run dd.
-- 
Bruce Evans  bde@runx.oz.au