Subject: Re: restoring the boot selector; repairing the disk label
To: Steve Bellovin <smb@research.att.com>
From: Frank van der Linden <fvdl@wasabisystems.com>
List: port-i386
Date: 03/31/2001 13:35:46
On Sat, Mar 31, 2001 at 12:16:30AM -0500, Steve Bellovin wrote:
> I have NetBSD 1.5R running on a machine.  However, I made the mistake 
> of installing the Evil OS from Redmond in another partition -- which 
> overwrote the boot selector, so that it only boots you-know-what.  How 
> do I restore the boot selector?  I've tried 'fdisk -B' and 'fdisk -i', 
> to no avail.  (Both of those were done after booting from the cd, using 
> 'boot wd0a:netbsd', and running the commands in single-user with all 
> file systems mounted read-only.)

First an 'fdisk -i wd0' followed by 'fdisk -B wd0' should do the trick.
fdisk -i should overwrite all bootcode, including a possible leftover
bootselect magic number (fdisk -B may think that the botselector
is still there because of this).
> 
> While I'm at it -- what changes should I make to my disk label to be 
> able to mount the Windows partition?  Here's what I know of the disk:
> 
> # fdisk; disklabel wd0
> NetBSD disklabel disk geometry:
> cylinders: 16383 heads: 16 sectors/track: 63 (1008 sectors/cylinder)
> 
> BIOS disk geometry:
> cylinders: 1024 heads: 255 sectors/track: 63 (16065 sectors/cylinder)
> 
> Partition table:
> 0: sysid 12 (Primary DOS with 32 bit FAT - LBA)
>     start 1024, size 25175792 (12292 MB), flag 0x80
>         beg: cylinder    0, head  16, sector 17
>         end: cylinder 1023, head 254, sector 63
> 1: sysid 169 (NetBSD)
>     start 25176816, size 124959744 (61015 MB), flag 0x0
>         beg: cylinder 1023, head 254, sector 63
>         end: cylinder 1023, head 254, sector 63

[...]

> 8 partitions:
> #        size   offset     fstype   [fsize bsize cpg/sgs]
>   a:  1091664 25176816     4.2BSD     1024  8192    16   # (Cyl. 24977 - 26059)
>   b:  2098656 26268480       swap                        # (Cyl. 26060 - 28141)
>   c: 124959744 25176816     unused        0     0         # (Cyl. 24977 - 148944)
>   d: 150136560        0     unused        0     0         # (Cyl.    0 - 148944)
>   e: 121769424 28367136     4.2BSD     1024  8192    16   # (Cyl. 28142 - 148944)

You will need to add:

f: 25175792     1024    MSDOS        0      0      0

- Frank

-- 
Frank van der Linden                           fvdl@wasabisystems.com
======================================================================
Quality NetBSD CDs, Support & Service.   http://www.wasabisystems.com/