Subject: kern/26634: kernel miscalculates default label on non-512-byte-sector disks
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <cjs@cynic.net>
List: netbsd-bugs
Date: 08/13/2004 10:16:19
>Number:         26634
>Category:       kern
>Synopsis:       kernel miscalculates default label on non-512-byte-sector disks
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 13 01:42:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Curt Sampson
>Release:        NetBSD 2.0_BETA Mon Jul 12 01:40:25 UTC 2004
>Organization:
NetBSD
>Environment:
System: NetBSD dev1.tabemo.com 2.0_BETA NetBSD 2.0_BETA (GENERIC) #0: Mon Jul 12 01:40:25 UTC 2004 autobuild@tgm.netbsd.org:/autobuild/netbsd-2-0/i386/OBJ/autobuild/netbsd-2-0/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
On my DVD-RAM media, when I erase the disklabel and then "disklabel cd0",
the fictitious label that the kernel generates has partition sizes that
are four times the number of sectors on the disk, probably because it assumes
512 byte blocks though the media has 2048 byte blocks. (Note that the
"total sectors" figure is correct.) Here's the sample:

dev1 # disklabel cd0
disklabel: Can't read master boot record 0: Invalid argument
# /dev/rcd0d:
type: ATAPI
disk: mydisc
label: fictitious
flags: removable
bytes/sector: 2048
sectors/track: 100
tracks/cylinder: 1
sectors/cylinder: 100
cylinders: 22368
total sectors: 2236704
rpm: 300
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:   8946816         0     4.2BSD      0     0     0  # (Cyl.      0 -  89468+)
 d:   8946816         0    ISO9660       0             # (Cyl.      0 -  89468+)

>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: