help! I broke the partition table of the drive with the bootable partition!

From: Roberto Nunnari <roberto.nunnari_at_supsi.ch>
Date: Tue, 30 Mar 2004 10:30:53 +0200
Hi all.

I was installing a new drive on my 5.2.1-p3 and I believe
I made some mistake while using fdisk and bsdlabel.. in
fact the partition table for my bootable disk has changed.


this was my fdisk amrd0 before:

web.dti.supsi.ch# cat fdisk.amrd0
******* Working on device /dev/amrd0 *******
parameters extracted from in-core disklabel are:
cylinders=4420 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=4420 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
     start 63, size 71007237 (34671 Meg), flag 80 (active)
         beg: cyl 0/ head 1/ sector 1;
         end: cyl 1023/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>


and this is how it looks now..

web.dti.supsi.ch# fdisk amrd0
******* Working on device /dev/amrd0 *******
parameters extracted from in-core disklabel are:
cylinders=4420 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=4420 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
     start 0, size 70766325 (34553 Meg), flag 0
         beg: cyl 0/ head 0/ sector 1;
         end: cyl 308/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>


as you can see, it is no longer bootable, and it doesn't
start at sect 63 like before but at 0

How can I fix it? I was about to give the following command
but thought I'd better ask first here...

web.dti.supsi.ch# fdisk -B

I expect the above to reinstall the boot code and to correct
the partition table.. I expect I'll be able to give that
command while the system and running and so the filesystem
mounted.

or if that doesn't work..
web.dti.supsi.ch# fdisk -B -f fdisk.conf.amrd0

also.. with the -t option the results are almost identical
to the original state, but end cyl is different.. See..
is that important?

web.dti.supsi.ch# fdisk -t -B -f fdisk.conf.amrd0
******* Working on device /dev/amrd0 *******
fdisk: WARNING line 2: number of cylinders (4420) may be out-of-range
     (must be within 1-1024 for normal BIOS operation, unless the entire 
disk
     is dedicated to FreeBSD)
parameters extracted from in-core disklabel are:
cylinders=4420 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=4420 heads=255 sectors/track=63 (16065 blks/cyl)

Information from DOS bootblock is:
1: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
     start 63, size 71007237 (34671 Meg), flag 80 (active)
         beg: cyl 0/ head 1/ sector 1;
         end: cyl 323/ head 254/ sector 63
2: <UNUSED>
3: <UNUSED>
4: <UNUSED>


and here is the fdisk.conf.amrd0 file
web.dti.supsi.ch# cat fdisk.conf.amrd0
# values extacted from old fdisk.amrd0
g       c4420   h255    s63
p       1       165     63      71007237
p       2       0       0       0
p       3       0       0       0
p       4       0       0       0
a       1


Thank you for your help.
-- 
               Roberto Nunnari -software engineer-
                mailto:roberto.nunnari_at_supsi.ch
  Scuola Universitaria Professionale della Svizzera Italiana
              Dipartimento Tecnologie Innovative
                   http://www.dti.supsi.ch
  SUPSI-DTI
  Via Cantonale                        tel: +41-91-6108561
  6928 Manno                 """       fax: +41-91-6108570
  Switzerland               (o o)
=======================oOO==(_)==OOo========================
Received on Mon Mar 29 2004 - 22:28:46 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:49 UTC