Cylinder-head-sector
From Wikipedia, the free encyclopedia
It has been suggested that Disk sector be merged into this article or section. (Discuss) |
Cylinder-head-sector, also known as CHS, was an early method for giving addresses to each physical block of data on a hard disk drive. In the case of floppy drives, for which the same exact diskette medium can be truly low-level formatted to different capacities, this is still true.
Though CHS values no longer have a direct physical relationship to the data stored on disks, pseudo CHS values (which can be translated by disk electronics or software) are still being used by many utility programs.
Contents |
[edit] Definitions
[edit] Heads
Data is written to and read from the surface of a platter by a device called a head. Naturally, a platter has 2 sides and thus 2 surfaces on which data could be manipulated; usually there are 2 heads per platter--one on each side, but not always. (Sometimes the term side is substituted for head, since platters might be separated from their head assemblies; as is definitely the case with the removable media of a floppy drive.)
[edit] Tracks
Are the thin concentric circular strips on a floppy medium or platter surface which actually contain the magnetic regions of data written to a disk drive.
[edit] Cylinders
A cylinder comprises all the tracks (on every usable platter surface) that can be accessed by the read/write heads while the actuator assembly remains stationary.
[edit] Sectors
Each usable side of a platter can also be thought of as a collection of slices called sectors. (See Blocks for an alternate definition of sector.)
[edit] Blocks
The intersection of a track and a sector is called a block. Thus, blocks are delineated by specifying a certain cylinder, head and sector. These blocks are the smallest geometrical breakdown of a disk, and represent the smallest amount of data which can be transferred to or from a disk (usually 512 bytes).
However, many PC engineers and technicians use the term sector (instead of block) as if it were also defined as the smallest geometrical breakdown of a disk.[1] The UNIX/Linux communities, however, continue to employ the term block. For example, the Linux fdisk utility normally displays partition table information using 1024-byte blocks while also using sector to help describe a disk's size with its phrase, 63 sectors/track.
Note: The term block is also often used out of the context of physical disks. It is still, by convention, a multiple of 512 bytes.
[edit] CHS Addressing
Hence, each block of data can be addressed by specifying a cylinder, head, and sector. The following formulas detail the CHS geometry and addressing scheme.
The number of blocks on one side of a platter is:
blocks_Per_Platter_Side = (cylinders_Per_Platter)*(Sectors_Per_Platter)
The number of blocks per platter is:
blocks_Per_Platter = (blocks_Per_Platter_Side)*(sides_Used_Per_Platter)
which is usually written in terms of the number of heads used:
blocks_Per_Platter = (blocks_Per_Platter_Side)*(Heads_Per_Platter)
This is usually expanded to:
blocks_Per_Platter = (cylinders_Per_Platter)*(Sectors_Per_Platter)*(Heads_Per_Platter)
and rearranged:
blocks_Per_Platter = (cylinders_Per_Platter)*(Heads_Per_Platter)*(Sectors_Per_Platter)
Since all the platters are the same size and hard drives usually have more than one platter, the total number of blocks on the drive can be written as:
total_Blocks = (Cylinders)*(Heads_Per_Platter)*(Sectors)*(Number_Of_Platters)
If the number of platters is combined with the number of heads per platter to form the single parameter Heads, the equation can be written in its final form as:
total_Blocks = (Cylinders)*(Heads)*(Sectors)
[edit] Examples
A "1.44 MB"[2] floppy disk has 80 cylinders (numbered 0 to 79), 2 heads (numbered 0 to 1) and 18 sectors (numbered 1 to 18). Therefore, its capacity in blocks is computed as follows:
totalBlocks = (80)*(2)*(18) = 2880
The 16-byte entries within an MBR or EBR Partition Table have CHS tuples which are limited to only (1023,254,64) for a total of 1024 cylinders, 255 heads and 63 sectors. For computers whose BIOS code was also limited to using only these CHS values, what was the largest size hard disk on which every block could be accessed? Starting with the formula above, but also including the term, 512 bytes/block
, the hard disk could be no larger than:
(1024)*(255)*(63)*(512) = 8,422,686,720 bytes (about 8.4 GB)
[edit] Equivalent values for CHS and LBA
The following tables show the corresponding CHS tuples[3] for a select group of LBA values, and how one would sequentially count through a number of blocks which these values represent. The data listed in the first table's entries will only be valid for hard disks having 63 sectors per track and 255 heads per cylinder.
LBA Value | CHS Tuple |
---|---|
0 | 0, 0, 1 |
1 | 0, 0, 2 |
2 | 0, 0, 3 |
62 | 0, 0, 63 |
63 | 0, 1, 1 |
64 | 0, 1, 2 |
65 | 0, 1, 3 |
125 | 0, 1, 63 |
126 | 0, 2, 1 |
127 | 0, 2, 2 |
188 | 0, 2, 63 |
189 | 0, 3, 1 |
190 | 0, 3, 2 |
16,063 | 0, 254, 62 |
16,064 | 0, 254, 63 |
16,065 | 1, 0, 1 |
16,066 | 1, 0, 2 |
16,127 | 1, 0, 63 |
16,128 | 1, 1, 1 |
16,450,497 | 1023, 254, 1 |
16,450,558 | 1023, 254, 62 |
16,450,559 | 1023, 254, 63 |
And as described in the previous section, this last LBA value of 16450559, being the 16,450,560th block on a drive, would indicate a capacity of: 16450560 blocks x 512 bytes/block = 8,422,686,720 bytes.
Hard disk manufacturers, however, have always used their own CHS scheme in which the number of heads never exceeds 16 (0-15), the number of sectors can be 255 (1-255; though 63 is often the largest used) and the number of cylinders can be as large as 65,536 (0-65535).[4] Therefore the number of cylinders in this scheme must be much larger than 1024 in order to describe many of the LBA values in the table above. For an LBA of 16450559, an ATA drive may respond with the CHS tuple: (16319, 15, 63).
The following table shows some CHS tuples for the ATA/IDE drive specifications using only 16 heads per cylinder.
LBA Value | CHS Tuple |
---|---|
0 | 0, 0, 1 |
1 | 0, 0, 2 |
2 | 0, 0, 3 |
62 | 0, 0, 63 |
945 | 0, 15, 1 |
1007 | 0, 15, 63 |
1008 | 1, 0, 1 |
1070 | 1, 0, 63 |
1071 | 1, 1, 1 |
1133 | 1, 1, 63 |
1134 | 1, 2, 1 |
2015 | 1, 15, 63 |
2016 | 2, 0, 1 |
16,127 | 15, 15, 63 |
16,128 | 16, 0, 1 |
32,255 | 31, 15, 63 |
32,256 | 32, 0, 1 |
16,450,559 | 16319, 15, 63 |
16,514,063 | 16382, 15, 63 |
According to the ATA specifications, the last entry in the table above is the largest tuple you'll most likely ever see a drive respond with, since section 6.2.1 of the ATA/ATAPI-5 spec states in part: "If the content of words (61:60) is greater than or equal to 16,514,064 then the content of word 1 [the number of logical cylinders] shall be equal to 16,383."[5]
[edit] History
This article requires authentication or verification by an expert. Please assist in recruiting an expert or improve this article yourself. See the talk page for details. This article has been tagged since May 2008. |
Older hard drives, such as MFM and RLL drives, divided each cylinder into an equal number of sectors and the CHS values matched the physical makeup of the drive. A drive with a CHS tuple of (500, 4, 32) would have 500 tracks per side on each platter, two platters (4 heads), and 32 sectors per cylinder, with a total of 32,768,000 bytes (about 32.8 MB, or 31.25 MiB).
For operating systems such as Microsoft DOS or Windows (before Vista), each partition must start and end at a cylinder boundary. Because of this, many drives still have a surplus of sectors (less than 1 cylinder in size) at the end of the drive, since the total number of sectors rarely, if ever, ends on a cylinder boundary. Only some of the most modern operating systems may disregard this rule, but doing so can still cause some compatibility issues, especially if the user wants to perform dual booting on the same drive.
ATA/IDE drives have replaced the now archaic MFM and RLL drives, since they're much more efficient at storing data. They use zone bit recording (ZBR), where the number of sectors dividing each track varies with the location of groups of tracks on the surface of the platter. Tracks nearer to the edge of the platter contain more blocks of data than tracks close to the spindle, because there is more physical space within a given track near the edge of the platter. Thus, the CHS addressing scheme cannot correspond directly with the physical geometry of such drives, due to the varying number of sectors per track for different regions on a platter.
An ATA/IDE drive can be set in the system BIOS with any configuration of cylinders, heads and sectors that do not exceed the capacity of the drive (or the BIOS), since the drive will convert any given CHS value into an actual address for its specific hardware configuration.
[edit] Notes
- ^ Early on, leaders in the computer industry, must have consciously chosen to do so, since the ANSI Accredited Standards Committee (ASC) X3 was already basing definitions in their ATA-1 X3T10 791D document on such sectors. Section 3.1.5 states: "LBA (Logical block address). This term defines the addressing mode of the drive as being by the linear mapping of sectors from 1 to n." And the T13 Technical Committee's Working Draft of ATA/ATAPI-7, 1410D Vol. 1, 5 November 2001, page 7, still defines a sector as: "A uniquely addressable set of 256 words (512 bytes)."
- ^ This popular label for the usual format of a 3.5-inch floppy diskette is a misnomer, since its actual capacity is 1440 KiB; or:
1440 binaryKilo-bytes x 1024/binaryKilo = (exactly) 1,474,560 bytes
(which is neither 1,440,000 bytes nor 1.44 MiB). - ^ Though CHS addressing definitely uses the mathematical concept of tuple, it may also be considered an example of the general scheme called mixed radix by viewing its cylinders, heads and sectors as having different numerical bases; e.g., cylinders counting from 0 to 1023, heads from 0 to 254 and sectors from 1 to 63.
- ^ These values are stored within every ATA/(E)IDE hard disk's electronic interface, and can be accessed by issuing the ATA command "Identify Device" (
EC
h) to the drive. See, for example, sections 6.2.1 and 8.12 of the T13 Technical Committee's, 29 February 2000, Working Draft of ATA/ATAPI-5. - ^ Ibid.