Subject: bin/6624: NetBSD (in particular "disklabel") should probably not use sectors/track and sectors/cyl. on SCSI disks...
To: None <gnats-bugs@gnats.netbsd.org>
From: None <woods@mail.weird.com>
List: netbsd-bugs
Date: 12/20/1998 23:14:29
>Number:         6624
>Category:       bin
>Synopsis:       NetBSD (in particular "disklabel") should probably not use sectors/track and sectors/cyl. on SCSI disks...
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 20 20:20:01 1998
>Last-Modified:
>Originator:     Greg A. Woods
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Release:        NetBSD-current
>Environment:

System: NetBSD

>Description:

	Modern disks, including almost any SCSI disk that still spins
	today, use constant density recording techniques that make the
	number of sectors per track.

	As a result many modern (SCSI) disks also totally hide the true
	geometry of the disk (usually behind a RAM buffer).  The actual
	sector sequence layout of the disk may be completely different
	than any driver could ever guess without knowing the on-board
	controller firmware intimately.

	Operating system software that still calculates disk
	partitioning and filesystem parameters based on recording
	surface count, sectors per track, cylinders per spindle,
	rotational speed, interleave, etc., is likely to be so
	incredibly wrong that disks with small cache buffers will likely
	be slower than if the OS simply ignored all of this faked up
	geometry information (though this is something I've yet to see
	proven).  Even if it's not all that much slower, the additional
	unnecessary complexity and confusion should be avoided for the
	user's sake.

>How-To-Repeat:

	Obverve that on some modern disks as much as 1-2 MB can be lost
	due to rounding errors:

	sd2: 4345MB, 6144 cyl, 8 head, 181 sec, 512 bytes/sect x 8899737 sectors

	8 heads * 181 avg.sect/trk = 1448 sect/cyl

	1448 sect/cyl * 6144 cyl = 8896512 sectors

	8899737 - 8896512 = 3225 lost sectors

	That's only 0.03% of the available disk space, but still!  ;-)

>Fix:

	Make disklabel smarter so that it ignores sectors/track on SCSI
	disks where such a measurement is meaningless (or "average" at
	best).  This might not be too difficult, assuming the user
	manages to put the right keyword into the "type" field to hint
	that the sectors/track value is an "average" value.

	Disklabel should also ignore cylinder boundary checks except on
	those architectures (sun3 + sparc) where it is known that the
	PROM refuses to boot from partitions that don't "jive".

	Make FFS ignore disk geometry on modern disks.  This is not so
	easy to do, unfortunately....
>Audit-Trail:
>Unformatted: