Page 1 of 1

Determining the size of an IDE drive

Posted: Thu Aug 18, 2005 3:53 pm
by jair
I am attempting to write a procedure that will return the size of a given IDE drive.
I've looked through the ATA/ATAPI-6 specification and think that the READ NATIVE MAX ADDRESS and/or READ NATIVE MAX ADDRESS EXT are what I'm looking for.
Unfortunately, I'm unsure as to how to use them, or if I'm even on the right track. Any help would be greatly appreciated.

Re:Determining the size of an IDE drive

Posted: Thu Aug 18, 2005 5:13 pm
by DennisCGc
Hi,

You should look at the identify command. It contains the total amount of cylinders, heads and sectors. More information is available in the ATA/ATAPI-6 specification.

DennisCGc.

Re:Determining the size of an IDE drive

Posted: Thu Aug 18, 2005 5:25 pm
by jair
I've gotten Identify Device (for pulling the drive model), but I thought that the size gotten from C/H/S was limited? I need this to work for large drives (200Gb+). Thanks for the help.

Re:Determining the size of an IDE drive

Posted: Thu Aug 18, 2005 5:37 pm
by DennisCGc
Hi,
jair wrote: I've gotten Identify Device (for pulling the drive model), but I thought that the size gotten from C/H/S was limited? I need this to work for large drives (200Gb+). Thanks for the help.
Well, IIRC in the new specification some fields are obsolete. :( (which indeed contained the CHS information). From my experience the CHS information is still there. But if you want to have support for harddisks > 128 GB, you should rely on the "WORD 100-103" field.
100-103 O V Maximum user LBA for 48-bit Address feature set.
So in short: normally you should read the Max. user lba.... field, but to be backwards-compatible you also should read the 'obsolete' fields. Which I don't remember (thought word 1,3 and 6, will have a look at my driver)

HTH,

DennisCGc.

Re:Determining the size of an IDE drive

Posted: Thu Aug 18, 2005 6:01 pm
by jair
DennisCGc wrote:
100-103 O V Maximum user LBA for 48-bit Address feature set.
Heh, didn't know that was in there... Guess I should read more carefully ::) I'll it a shot. Thanks!