Hard Drive Geometry 101



Hi Folks,

I am hoping some kind people on this NG could help me better
understand HDD Geometry. Dont get me wrong I have done some googling,
and read some wiki's - but some parts are still very blurry. I have
also used the man command since most of what I am doing is in linux.

Most of my questions have been brought about by various LInux tools I
have been experimenting with, such as testdisk, mount, and fdisk.

I will outline what I understand so far, if any of these statements
are wrong please let me know.

I understand so far:
That hard disks have physical geometry CHS, but modern hard disk CHS
bears no direct relationship to the physical geometry of the disk. I
think the modern CHS is sometimes called Psuedo CHS.

C and H numbering starts at 0, but S starts at 1.

The the definition of a sector (on the physical disk anyway) is a
strip extending from the center of the platter to the edge. And a
block is the intersection of a cylinder and a sector. Sometimes use
the terms block and sector to mean the same thing (block).

Block usually 512 bytes.

With read hard disk geometry C*H*S = number of blocks
Thus number of blocks * 512 = disk size?

Is there a relationship mathmatically, size wise, between a block and
a sector? ie 4 blocks = 1 sector or whatever?

Now to involve some real world data:

al@al-ubuntu:~$ sudo fdisk -l
[sudo] password for al:

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xaf010487

Device Boot Start End Blocks Id System
/dev/sda1 * 1 121601 976760001 83 Linux

I know that start and end are cylinder values and I assume that blocks
is the size of the partition in blocks. Assuming I was correct before
when I stated that blocks are 512 bytes in size, then:

976760001 * 512 bytes = disk size in bytes - but it doesnt, it equals
500101120512 bytes which is way off 1000204886016 bytes from the
header in fdisk. Why?

From fdisk headerline "255 heads, 63 sectors/track, 121601 cylinders"
- now using C*H*S = number of blocks

121601 * 255 * 63 = 1953520065 blocks
and because 512 bytes to a block:
512 * 1953520065 = 1000202273280 bytes (which should be the same as
the disk size given in the fdisk header line "1000204886016 bytes" but
it isnt. Why?)

The same disk:

TestDisk 6.10, Data Recovery Utility, July 2008
Christophe GRENIER <grenier@xxxxxxxxxxxxxx>
http://www.cgsecurity.org

Disk /dev/sda - 1000 GB / 931 GiB - CHS 121601 255 63
Current partition structure:
Partition Start End Size in sectors

1 * Linux 0 1 1 121600 254 63 1953520002

Now start and end are full CHS values and we can also see the size of
the partition in sectors. I have been told that:

(255 * 63 * 121601) - (63 * 1) = 1953520002

Which is the size in sectors. But I dont quite understand the
calculations.

In its simplest form the End CHS size - Start CHS size = size of
partition (True/False?)

Because of numbering starting at 0 start end CHS values in calculation
are:
121601,255,63 (True/False?)

Start CHS values, by the same reasoning should be:
0,2,2 (Clearly this is not whats used in the calculation - why?)

Well this has been a long post, and I suspect the answer will raise
more questions.

Thanks in advance for any replies.

-Al











.



Relevant Pages

  • Re: fdisk question (long)
    ... >> unlikely to have any connection to the physical disk structure. ... While the geometry is being reported as 16 heads it is certainly ... Whether it will rear its head as a problem I simply ... >> But the absolute start sector number and slice ...
    (freebsd-questions)
  • Re: fdisk question (long)
    ... > unlikely to have any connection to the physical disk structure. ... > However it is also quite common to define large disk geometries ... Or to put it another way the CHS ... > Work with absolute sector numbers but chosen so that a slice always ...
    (freebsd-questions)
  • Re: Hard Drive Geometry 101
    ... That hard disks have physical geometry CHS, ... the terms block and sector to mean the same thing. ...
    (comp.sys.ibm.pc.hardware.storage)
  • Re: 2.6.x partition breakage and dual booting
    ... In the ancient past a disk had a geometry ... well-determined geometry: the ATA command INITIALIZE DRIVE PARAMETERS ... A DOS-type partition table (see, e.g., ... One is the way used by Linux (the starting sector and length, ...
    (Linux-Kernel)
  • Re: Hard Drive Geometry 101
    ... That hard disks have physical geometry CHS, ... block is the intersection of a cylinder and a sector. ... I know that start and end are cylinder values and I assume that blocks ...
    (comp.sys.ibm.pc.hardware.storage)