Subject: Re: Restoring MBR smashed by disklabel? [resolved]
To: None <port-i386@netbsd.org>
From: Peter Clark <ninjaz@webexpress.com>
List: port-i386
Date: 08/02/2000 12:58:47
Hi,

I didn't receive a response on this, but perseverence 
and inference combined with lots archive searches and 
general RTFM'ing has been help of its own. :)  For the 
benefit of the next guy trying to figure this out, I'm 
posting what led to resolution and the answers to those 
questions that were bugging me.  Hopefully if I make any 
factual errors, someone more knowledgeable will 
intercede.

> When I change the disklabel on sd0 (the boot device), 
> the system displays the "No Operating System" error 
> message when rebooted.

It turned out that this wasn't due to the MBR being 
smashed at all.  It was the boot sector which was wiped 
out.  I realized this when after following instructions 
in the NetBSD i386 FAQ "Booting NetBSD or 
DOS/Windows/other via a menu" entry:

1. run 'fdisk -i -c /usr/mdec/mbr_bootsel' to install 
the bootmenu 
2. run 'fdisk -B' afterwards to interactively configure 
it (this step is not optional) 

After doing both of these, '3' appeared after the reboot 
(rather than the boot menu and subsequent booting I was 
hoping for).  This was familiar, as it was mentioned in 
the bug reports I linked as symptomatic of the problem 
I was experiencing.

So, the next step was to use installboot.  After 
surmising that since the MBR installation didn't fix 
things, it must not be an MBR issue (which meant 
it wasn't sectors 0-62 that needed to be modified), I 
chose /dev/rsd0a as the device on which to install the 
biosboot.sym file.  This turned out to hit the mark, and 
the problems were resolved.

To remove any doubt that it was only the boot sector 
being wiped out and causing the problem, I relabeled the 
disk again and rebooted to another error code 3.

After booting from the boot prompt on the install floppy 
( boot sd0a:netbsd ), I ran the following: 

/usr/mdec/installboot /usr/mdec/biosboot.sym /dev/rsd0a

And, after a reboot, was looking at a happy NetBSD 
system again.

> Is it different depending whether the system was 
> installed as dedicated entirely to NetBSD or using the 
>"part of the disk" DOS partition mode?
> Does selecting to use the 
> whole disk at install time automatically just allocate 
> a netbsd spanning the whole disk, or does it do 
> "dangerously dedicated" mode such as FreeBSD?)

The standard x86 partitioning scheme is used for both 
the partial and whole disk installation menu methods of 
NetBSD (there is no dangerous dedication).  The 
NetBSD/i386 'd' partition type (whole physical disk) is 
used for the raw disk, with 'c' being the span of disk 
inside the NetBSD x86 partition.  Sectors 0-62 
(inclusive) are used for the MBR/partition table, with 
the first usable x86 partition starting at offset 63.

                             -pete