Determining the size of an IDE drive

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
jair

Determining the size of an IDE drive

Post 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.
DennisCGc

Re:Determining the size of an IDE drive

Post 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.
jair

Re:Determining the size of an IDE drive

Post 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.
DennisCGc

Re:Determining the size of an IDE drive

Post 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.
jair

Re:Determining the size of an IDE drive

Post 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!
Post Reply