Subject: Re: Of SCSI disks and things amiss
To: None <tech-kern@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: tech-kern
Date: 02/29/1996 15:59:42
[Sorry for getting this thread all out of order....]

[plug in new SCSI disk, run disklabel (RAW_PART is d), see]

> sectors/cylinder: 1188
> cylinders: 3511

> 4 partitions:
> #        size   offset    fstype   [fsize bsize   cpg]
>   d:  4194058        0    unused        0     0         # (Cyl.    0 - 3530*)

> You will note that 1188 * 3511 is 4171068, just a tad below the
> 4194058 sectors used for the size of the raw partition.  If you
> attempt to write this disklabel, you get the complaint:
> 	disklabel: partition d: partition extends past end of unit

disklabel is almost certainly lying.  It is probably a
variable-geometry disk (I notice it's two gigs, and probably relatively
modern), and thus there is no integer sectors-per-track value that can
be multiplied by the cylinder and head counts to give the disk size.

> Evidently, sd->params.disksize includes the reserved sectors on the
> disk.

More likely it's a variable-geometry disk, I think.  I think it's much
more likely for a new two-gig scsi disk that it's variable-geometry
than that it includes the spare sectors when reporting its size.

Notice that the discrepancy is about half a percent.  Do you really
think the disk has only one spare out of every two hundred sectors?

You don't quote the head count value, and 1188 factors as 2*2*3*3*3*11,
so it's hard to guess.  But try dividing 4194058 by the product of 3511
and the head count.  Round the result down to an integer, and multiply
by those same two numbers.  I'd bet money you'll get 4171068.

> Every other piece of code in the kernel appears to calculate
> d_secperunit using d_secpercyl * d_ncylinders.

Then "[e]very other piece of code in the kernel" is wrong.  (Perhaps
not wrong enough to cause trouble; perhaps not even wrong enough to be
worth the effort of fixing...but still wrong.)

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu