Page 1 of 1

Get Hard Disk Drive Max Heads And Cylinders

Posted: Mon Sep 14, 2009 2:40 pm
by ahmedhalawa
How can i get hard disk maximum heads and maximum cylinders?

Re: Get Hard Disk Drive Max Heads And Cylinders

Posted: Mon Sep 14, 2009 8:31 pm
by Troy Martin
Read the MBR. It's usually in there, just look for the last block of the last used partition.

Then again, this only works if every chunk of the hard drive is partitioned.

Re: Get Hard Disk Drive Max Heads And Cylinders

Posted: Mon Sep 14, 2009 8:58 pm
by pcmattman
Use the ATA IDENTIFY DEVICE command.

Re: Get Hard Disk Drive Max Heads And Cylinders

Posted: Mon Sep 14, 2009 9:32 pm
by quok
Troy Martin wrote:Read the MBR. It's usually in there, just look for the last block of the last used partition.

Then again, this only works if every chunk of the hard drive is partitioned.
And it fails entirely if the MBR uses LBA instead of CHS, or for GPT partitioned drives.

A better solution:
  • Int 13h AH=08h -- Get Drive Parameters
  • Int 13h AH=48h -- Get Extended Drive Parameters
Of course those only work in real mode (or vm86 mode), but it's perhaps the best way to get that information without having to worry if the drive is ATA, ATAPI, SATA, SATAPI, or SCSI.

For a little more information: http://en.wikipedia.org/wiki/INT_13