From owner-freebsd-questions@FreeBSD.ORG  Mon Mar 29 10:32:30 2004
Return-Path: <owner-freebsd-questions@FreeBSD.ORG>
Delivered-To: freebsd-questions@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id C884816A4CE
	for <freebsd-questions@freebsd.org>;
	Mon, 29 Mar 2004 10:32:30 -0800 (PST)
Received: from mail.dti.supsi.ch (mail.die.supsi.ch [193.5.153.13])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B721943D58
	for <freebsd-questions@freebsd.org>;
	Mon, 29 Mar 2004 10:32:29 -0800 (PST)
	(envelope-from roberto.nunnari@supsi.ch)
Received: from supsi.ch (pcm2027.dti.supsi.ch [193.5.152.27])
	by mail.dti.supsi.ch (8.11.6/8.11.6) with ESMTP id i2TIWSv09978
	for <freebsd-questions@freebsd.org>; Mon, 29 Mar 2004 20:32:28 +0200
Message-ID: <40686C3D.1050309@supsi.ch>
Date: Mon, 29 Mar 2004 20:34:37 +0200
From: Roberto Nunnari <roberto.nunnari@supsi.ch>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
	rv:1.4) Gecko/20030624
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: freebsd-questions@freebsd.org
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Subject: broken partition table
X-BeenThere: freebsd-questions@freebsd.org
X-Mailman-Version: 2.1.1
Precedence: list
List-Id: User questions <freebsd-questions.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-questions>,
	<mailto:freebsd-questions-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-questions>
List-Post: <mailto:freebsd-questions@freebsd.org>
List-Help: <mailto:freebsd-questions-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-questions>,
	<mailto:freebsd-questions-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 29 Mar 2004 18:32:30 -0000

Hi all.

Please also reply to my mailbox as I'm not on the list.
Thank you.


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 -f fdisk.conf.amrd0

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.

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


-- 
               Roberto Nunnari -software engineer-
                mailto:roberto.nunnari@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========================