Subject: bin/33633: /sbin/fdisk does not work
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <ykomatsu@akaumigame.org>
List: netbsd-bugs
Date: 06/02/2006 16:55:00
>Number:         33633
>Category:       bin
>Synopsis:       /sbin/fdisk does not work
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 02 16:55:00 +0000 2006
>Originator:     Yoshito Komatsu
>Release:        NetBSD 3.99.20
>Organization:
>Environment:
System: NetBSD c8.ln.akaumigame.org 3.99.20 NetBSD 3.99.20 (XENU) #0: Mon May 29 05:13:15 JST 2006 root@c8.ln.akaumigame.org:/usr/obj/sys/arch/i386/compile/XENU i386
Architecture: i386
Machine: i386
>Description:
	When I run /sbin/fdisk after I updated fdisk.c to Revision 1.100,
	the following message is displayed:

	# fdisk wd0
	fdisk: removing corrupt bootsel information
	fdisk: Cannot determine the number of heads

	fdisk failed in sanity check (xheads == -1),
	but when I remove this check, it works:

--- fdisk.c.orig	2006-06-03 00:02:51.000000000 +0900
+++ fdisk.c	2006-06-03 00:05:04.000000000 +0900
@@ -1334,7 +1334,7 @@
	}
 
	if (xheads == -1)
-		errx(1, "Cannot determine the number of heads");
+		return;
 
	/* Estimate the number of cylinders. */
	xcylinders = disklabel.d_secperunit / xheads / xsectors;

	# fdisk wd0
	fdisk: removing corrupt bootsel information
	Disk: /dev/rwd0d
	NetBSD disklabel disk geometry:
	cylinders: 486344, heads: 16, sectors/track: 63 (1008 sectors/cylinder)
	total sectors: 490234752

	BIOS disk geometry:
	cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
	total sectors: 490234752

	Partition table:
	0: NetBSD (sysid 169)
	    start 63, size 490234689 (239372 MB, Cyls 0-30515/179/1), Active
	1: <UNUSED>
	2: <UNUSED>
	3: <UNUSED>
>How-To-Repeat:
	# fdisk wd0
>Fix: