Jump to content

Cylinder-head-sector

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 82.113.99.171 (talk) at 11:29, 30 July 2011 (→‎Cylinders: added ATA-2 reference (presumably the same I deleted before as "obsolete" - that's just how it is, my bad)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Cylinder, head, and sector of a hard drive.
Cylinder, head, and sector of a hard drive.

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, virtual CHS values (which can be translated by disk electronics or software) are still being used by many utility programs.

Definitions

CHS addressing is the process of identifying individual sectors on a disk by their position in a track, where the track is determined by the head and cylinder numbers. The terms are explained bottom up, for disk addressing the sector is the smallest unit. Disk controllers can introduce address translations to map logical to physical positions, e.g., zone bit recording stores less sectors in shorter tracks, physical disk formats are not necessarily cylindrical, and sector numbers in a track can be skewed.

Sectors

A sector is the smallest storage unit that is addressable by a hard drive, and all information stored by the hard drive is recorded in sectors. Common sector sizes are 512 bytes for hard disks and 2048 bytes for CDs and DVDs, but other sizes such as 128 and 1024 were also used.[1] Some vendors of hard drives, and some software developers, are attempting to create a new standard for the future by revising the amount of data stored in a sector to 4096 bytes.[2]

In CHS addressing the sector numbers always start at 1, there is no sector 0. For physical disk geometries the maximal sector number is determined by the low level format of the disk. However, for disk access with the BIOS, the sector number was encoded in six bits, resulting in a maximal number of 63=64-1 sectors per track, where 64=2**6 corresponds to six bits. The maximum 63 is still in use for virtual CHS geometries.

Heads

A device called a head reads and writes data in hard drive by manipulating the magnetic medium that composes the surface of an associated disk platter. 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.)

The CHS addressing supported in old BIOS code used eight bits for up to 256 heads counted as head 0 up to 255 (hex. FFh). However, some long forgotten[citation needed] software supported only 255 heads, causing no problems for physical disks at this time with less heads. The in essence erroneous 255 is still in use for virtual 255×63 geometries. This historical oddity can affect the maximal disk size in old BIOS code as well as old PC DOS or similar operating systems:

1024×255×63/2048=8032.5 MB, but actually 1024×256×63/2048=8064 MB yields what is known as 8 GB limit. The in this context relevant definition of 8 GB = 8192 MB is another incorrect limit, because it would require CHS 1024×256×64 with 64 sectors per track.

Tracks

The tracks are the thin concentric circular strips of sectors. At least one head is required to read a single track. With respect to disk geometries the terms track and cylinder are closely related. For a single or double sided floppy disk track is the common term; and for more than two heads cylinder is the common term. Strictly speaking a track is a given CH combination consisting of SPT sectors, while a cylinder consists of SPT×H sectors.

Tracks and cylinders are counted from 0, i.e., track 0 is the first (outer-most) track on floppy or other cylindrical disks. Old BIOS code supported ten bits in CHS addressing with up to 1024 cylinders (1024=2**10). Adding six bits for sectors and eight bits for heads results in the 24 bits supported by BIOS interrupt 13h. Subtracting the disallowed sector number 0 in 1024×256 tracks corresponds to 128 MB for a sector size of 512 bytes (128=1024×256/2048); and 8192-128=8064 confirms the (roughly) 8 GB limit.

Cylinders

A cylinder comprises the same track number on each platter, spanning all such tracks across each platter surface that is able to store data (without regard to whether or not the track is "bad"). Thus, it is a three-dimensional structure. Any track comprising part of a specific cylinder can be written to and read from while the actuator assembly remains stationary, and one way in which hard drive manufacturers have increased drive access speed has been by increasing the number of platters which can be read at the same time.

CHS used for addressing starts at 0 0 1 with a maximal value 1023 255 63 for 24=10+8+6 bits, or 1023 254 63 for 24 bits limited to 255 heads. CHS values used to specify the capacity of a disk have to count cylinder 0 and head 0 resulting in a maximum 1024 256 63 or 1024 255 63 for 24 bits with 256 or 255 heads. As larger hard disks have come into use, a cylinder has become also a logical disk structure, standardised[citation needed] at 16 065 sectors (16065=255×63).

CHS addressing with 28 bits (EIDE and ATA-2) permits eight bits for sectors still starting at 1, i.e., sectors 1..255, four bits for heads 0..15, and sixteen bits for cylinders 0..65535.[3] This results in a roughly 128 GB limit; actually 65536×16×255=267386880 sectors corresponding to 130560 MB for a sector size of 512 bytes.[4]

The 28=16+4+8 bits in the ATA-2 specification are also covered by Ralf Brown's Interrupt List, and an old working draft of this now expired standard was published.[5]

Blocks and Clusters

The Unix communities employ the term block to refer to a sector or group of sectors. For example, the Linux fdisk utility normally displays partition table information using 1024-byte blocks, but also uses the word sector to help describe a disk's size in the phrase, 63 sectors per track.

Clusters are allocation units for data on various file systems (FAT, NTFS, etc.), where data mainly consists of files. Clusters are not directly affected by the physical or virtual geometry of the disk, i.e., a cluster can begin at a sector near the end of a given CH position, and end in a sector on the physically or logically next CH position.

CHS to LBA mapping

CHS tuples can be mapped onto LBA (Logical Block Addressing) addresses using the following formula:


Where is the LBA address, is the number of heads on the disk, is the number of sectors per track, and is the CHS address.

History

Earlier hard drives used in the PC, such as MFM and RLL drives, divided each cylinder into an equal number of sectors, so the CHS values matched the physical properties 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 track, with a total of 32 768 000 bytes (about 32.8 MB, or 31.25 MiB).

ATA/IDE drives were much more efficient at storing data and have replaced the now archaic MFM and RLL drives. 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. 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.

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. This however can cause compatibility problems.

For operating systems such as Microsoft DOS or older version of Windows, each partition must start and end at a cylinder boundary. Only some of the most modern operating systems (Windows XP included) 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. Microsoft does not follow this rule with internal disk partition tools since Windows Vista. [6]

See also

References

  1. ^ standards - Ecma-107
  2. ^ "Western Digital's Advanced Format: The 4K Sector Transition Begins". AnandTech. 18 December 2009. Retrieved 29 July 2011.
  3. ^ "5K500.B SATA OEM Specification Revision 1.2" (PDF). Hitachi. 17 March 2009. p. 51. Retrieved 29 July 2011.
  4. ^ Andries Brouwer (1 November 2004). "History of BIOS and IDE limits". Large Disk HOWTO v2.5. Retrieved 30 July 2011.
  5. ^ "AT Attachment Interface with Extensions (ATA-2)" (PDF). X3T10/0948D Revision 4c. INCITS Technical Committee T13 AT Attachment. 18 March 1996. Retrieved 30 July 2011.
  6. ^ KB931760

See also