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.
Don't use CHS values. See offsets 60-61 in the ATA spec on IDENTIFY DEVICE
Offsets 60 and 61 give you the sector count of the disk, total. You don't touch CHS values when working with LBA - you just use numbers from 0 to count-1
This struct is used in MBR. First goes to 0x1BE. LBAFirstSector contains number of first LBA sector. Choose maximum of possible (that should be last partition), the plus to it partition's size: NumberofBlocks*0x200. You get disk size (almost: my calculations differs from reality in 5Kb, I gues I forget something else but it is tiny).
Daniel.
Don't think a ****, but in ukrainian schools English is TOO BAD!
djsilence wrote:You should not calculate anything. Read sector 0 (MBR sector) than read this struct:
<snip>
Not all disks have an MBR in their first sector. The ATA spec itself gives a method for getting the LBA count of the medium so you don't need to figure it out yourself (IDENTIFY DEVICE), the section for which in the spec has a full description of all fields returned from the command.
CHS values are available for backwards compatibility (and for any modern devices which do not support LBA, which are very rare), but are limited - as you have seen.