NetBSD Problem Report #47670

From www@NetBSD.org  Wed Mar 20 00:55:37 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id ECDB763F105
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 20 Mar 2013 00:55:36 +0000 (UTC)
Message-Id: <20130320005536.2850F63F105@www.NetBSD.org>
Date: Wed, 20 Mar 2013 00:55:36 +0000 (UTC)
From: andrew.cagney@gmail.com
Reply-To: andrew.cagney@gmail.com
To: gnats-bugs@NetBSD.org
Subject: mbrlabel's math is off
X-Send-Pr-Version: www-1.0

>Number:         47670
>Category:       bin
>Synopsis:       mbrlabel's math is off
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 20 01:00:00 +0000 2013
>Originator:     cagney
>Release:        6.1 beta(?)
>Organization:
>Environment:
NetBSD rpi 6.99.17 NetBSD 6.99.17 (RPI) #3: Fri Mar 15 16:35:21 EDT 2013  cagney@tv-desktop:/home/cagney/src/NetBSD/cvs/sys/arch/evbarm/compile/obj/RPI evbarm


>Description:
This is from mbrlabel, the first bit is correct:

Found MSDOS partition; size 1073741824 (524288 MB), offset 2048
  skipping existing MSDOS partition at slot a.
Found 4.2BSD partition; size 524288000 (256000 MB), offset 1073743872
  adding 4.2BSD partition to slot d.

but the second bit (esp partition's b and d size), is wrong:

4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a: 1073741824      2048      MSDOS                     # (Cyl.      1 - 524288)
 b:     16384 1073743872     4.2BSD   1024  8192    16  # (Cyl. 524289 - 524296)
 c: 1952151552         0     unused      0     0        # (Cyl.      0 - 953198)
 d:     16384 1073743872     4.2BSD   1024  8192    16  # (Cyl. 524289 - 524296)

(first time b was created, re-run and d gets created ...)
(I'm not even sure I'm ment to run mbrlabel - fdisk.8 mentions it but disklabel.8 does not).

>How-To-Repeat:
Run mbrlabel /dev/sd0
>Fix:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.