From owner-freebsd-current Wed Jul 15 11:53:08 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA00912 for freebsd-current-outgoing; Wed, 15 Jul 1998 11:53:08 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from uni-sb.de (uni-sb.de [134.96.252.33]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA00873 for ; Wed, 15 Jul 1998 11:53:02 -0700 (PDT) (envelope-from rock@wurzelausix.cs.uni-sb.de) Received: from cs.uni-sb.de (cs.uni-sb.de [134.96.252.31]) by uni-sb.de (8.9.0/1998052000) with ESMTP id UAA14888 for ; Wed, 15 Jul 1998 20:52:46 +0200 (CEST) Received: from gate.ics (acc2-212.telip.uni-sb.de [134.96.112.212]) by cs.uni-sb.de (8.9.0/1998060300) with ESMTP id UAA17758 for ; Wed, 15 Jul 1998 20:52:45 +0200 (CEST) Received: from doom.ics (doom.ics [192.168.0.254]) by gate.ics (8.9.0/1998061600) with ESMTP id UAA09563 for ; Wed, 15 Jul 1998 20:51:13 +0200 (CEST) Received: (from rock@localhost) by doom.ics (8.9.0/1998061600) id UAA13471; Wed, 15 Jul 1998 20:56:56 +0200 (CEST) From: "D. Rock" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Wed, 15 Jul 1998 20:56:56 +0200 (CEST) To: current@FreeBSD.ORG Subject: Bug in kernel disklabel code? X-Mailer: VM 6.43 under 20.4 "Emerald" XEmacs Lucid Message-ID: <13740.64305.837054.908108@doom.ics> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG There seems to be bug in the disklabel kernel code. I recently deleted an FreeBSD partition and created a DOS partition instead (with DOS fdisk). Because this is the 2nd DOS partition on the same drive an extended partition was created with an DOS drive in it. Because the extended partition is just "a disk drive by itself", the first (logical) head wasn't overwritten (besides the partition table). It seems the disklabel code finds a FreeBSD disklabel in it and tries to use it, although the partition type isn't FreeBSD: wd0s2: raw partition size != slice size wd0s2: start 6602715, end 9735389, size 3132675 wd0s2c: start 6602715, end 9767519, size 3164805 wd0s2: truncating raw partition wd0s2: rejecting partition in BSD label: it isn't entirely within the slice wd0s2: start 6602715, end 9735389, size 3132675 wd0s2a: start 6602715, end 9767519, size 3164805 It is rejecting them, but what if the partition sizes were slightly different (creating a DOS partition larger than the initial BSD partition(*))? Shouldn't the disklabel code look first at the partition ID? (*) The DOS partition is "magically" smaller than the BSD partition before. DOS fdisk didn't use the entire disk, but "forgot" the last 2 cylinders: ******* Working on device /dev/rwd0 ******* parameters extracted from in-core disklabel are: cylinders=608 heads=255 sectors/track=63 (16065 blks/cyl) parameters to be used for BIOS calculations are: cylinders=608 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 11,(DOS or Windows 95 with 32 bit FAT) start 63, size 6602652 (3223 Meg), flag 0 beg: cyl 0/ sector 1/ head 1; end: cyl 410/ sector 63/ head 254 The data for partition 2 is: sysid 5,(Extended DOS) start 6602715, size 3132675 (1529 Meg), flag 0 beg: cyl 411/ sector 1/ head 0; end: cyl 605/ sector 63/ head 254 The data for partition 3 is: The data for partition 4 is: Daniel To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message