Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Sep 2006 23:42:12 -0700
From:      "jdow" <jdow@earthlink.net>
To:        <freebsd-questions@freebsd.org>
Subject:   Re: Origin of hard drive parameters
Message-ID:  <001d01c6d56d$6d4cd060$0225a8c0@Wednesday>
References:  <20060909201151.30355.qmail@web32715.mail.mud.yahoo.com><089801c6d484$4812a1b0$0225a8c0@Wednesday> <200609101908.25757.ihilt@bluebottle.com>

next in thread | previous in thread | raw e-mail | index | archive | help
From: "Ian Graeme Hilt" <ihilt@bluebottle.com>
>
> May I point out that I was not interested in CHS alone. My focus was the
> origin of the hard drives parameters i.e. geometry, which is the subject of > 
> discussion. From this discussion and other sources I have learned that CHS, > as you 
> say, is arbitrary when referring to modern drives. To be specific,
> drives adhering to ATA/ATAPI Specification 6 and later. ATA/ATAPI Spec. 5 and
> earlier used CHS mode for representing hard drive capacity. The reason I am > interested 
> in this topic is partially because of my "idle curiosity". I'm the
> type of person interested in the challenge of answering questions. The
> questions, "How does the BIOS automatically detect correct values for hard
> disks?" and, "Where is this information stored?" have been stuck in my head > for at 
> least 6 months. No amount of searching the web provided me with
> satisfactory results. I tried a few tests of my own, all of which failed to > answer my 
> questions. So, I decided to appeal to the FreeBSD-questions mailing
> list. Mainly because I have found useful answers to other questions here. The
> other part of my reason is that one of my coworkers thought this information
> was stored on the platters of the hard drive. I thought differently but I
> could not _prove_ it.

Good reason. And the information is indeed stored on the platters of
the hard disks in a place you cannot read directly. It is easier for
me to refer to SCSI than to ATA. With SCSI the operating code for the
disk is stored on the disk. What comes up at first is enough SCSI to
say "I'm a disk; and, I'm not ready."  When you issue ReadCapacity,
Mode Sense, and Inquiry commands you are accessing data stored on the
same reserved sectors as the disk's operating code. Special diagnositic
commands allow the operating code to be modified. The "Mode Select"
command allows you to reconfigure the disk's geometry. This takes
effect after you next low level format the drive if you have no other
intervening commands. This allows you to alter the spare blocks and
cylinders on the disk as well as configure most other operating
parameters. These are stored where operating systems normally cannot
see them with normal read/write commands.

So your coworker is correct, it is stored on the drive and barring
nvram on the drive it is stored on the actual platters.

>> As for storing it - read block zero of the disk.
>> Be DAMN careful not to WRITE to block zero. And if you DO write
>> to block zero at about the time I quit doing such low level stuff
>> and moved to other things there were several SCSI hard disk
>> manufacturers using code that had a defect such that if you wrote
>> more than one disk block starting at block 0 the whole disk was
>> toast until you did a fresh low level format on it. One sincerely
>> hopes THAT defect is gone these days.)
>>
>> {O.O}   Joanne
>
> Reading through ATA/ATAPI -7 has helped me rephrase my questions into one:
> When the command READ NATIVE MAX ADDRESS is issued to the device, from where
> is this information returned?

It may be cached somewhere for quick returns. There are tools for tuning
disk performance for both ATA and SCSI disks that can alter the operating
parameters. Some options read OS cached values. Others dig down and issue
the 'standard' query commands and read the actual values off the disk. The
disk is the final arbiter, in modern terms. When doing the configuration
utility that became arguably the most popular one for the Amiga I ran
across some small number of hard disks that returned off by 1 values for
size. (Micropolis was one offender at one time.) And I also ran across
drives delivered with only the first few megabytes formatted. So I built
into the configuration utility an actual search for the last readable
block. I used the lesser of that value and the value the drive declared
to Read Capacity commands. At least the formats it generated were safe.
(I think it was either Maxtor or CDC/Seagate that had the partially
formatted drives escape from their factory.)

I hope this answers questions enough so that the next question is more
obvious. (And in retrospect - the drive is the only thing that knows
the precise formatting parameters. So it is quite logical that the
original source for the size data is the drive itself. This is not
always, in my experience, a constant for all revisions of the same
model of drive.)

{^_^}   Joanne 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001d01c6d56d$6d4cd060$0225a8c0>