Subject: restoring the boot selector; repairing the disk label
To: None <port-i386@netbsd.org>
From: Steve Bellovin <smb@research.att.com>
List: port-i386
Date: 03/31/2001 00:16:30
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.)

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
2: <UNUSED>
3: <UNUSED>
# /dev/rwd0d:
type: unknown
disk: NetBSD
label: 
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 16383
total sectors: 150136560
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

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)


		--Steve Bellovin, http://www.research.att.com/~smb