II.  Generalities

II.3  BIOS geometry translation modes

BIOS geometry translation

While the use of logical hard disk geometry gets around the problem that physical hard disk geometries cannot be properly expressed using standard BIOS settings, they don't go far enough. In most cases, higher levels of translation are needed as well because other problems relating to old design decisions make it impossible for even the logical geometry to be used with modern large hard disks.

In order to get around hard disk capacity barriers, another layer of translation is often applied on top of the geometry translation that occurs inside the hard disk. this translation is performed by the BIOS. There are three BIOS translation modes:

  1. Normal / Standard CHS Mode,
  2. Extended CHS (ECHS) / Large Mode,
  3. Logical Block Addressing (LBA).

Note: None of this has any relevance when using only SCSI hard disks. They are not subject to any of the BIOS limitations other than the 7.88 GB barrier, which is not overcome through translation.

Note: SCSI by its nature uses logical block addressing (LBA) to address devices.

Normal / Standard CHS Mode

In this mode, there is no translation done at the BIOS level, and the logical geometry presented by the disk is used by the BIOS directly. "CHS" stands for "cylinder, head, sector", the three parameters - coordinates- used in hard disk geometry specifications. This mode can be used with drives not exceeding 504MB in capacity otherwise, only the 504 MB part of the disk will be accessible when no BIOS bypassing is used.

Extended CHS (ECHS) / Large Mode

Extended CHS, also called ECHS or large mode in some BIOS's, uses BIOS translation to get around the 504 MB size barrier inherent in standard CHS mode.

BIOS translation works by taking advantage of the fact that BIOS Int 13h allows more heads than the IDE/ATA standard but fewer cylinders. The BIOS takes the logical geometry that the hard disk specifies according to the IDE/ATA standard, and translates it into an equivalent geometry that will "fit" into the maximums allowed by the BIOS Int 13h standard. This is done by dividing the number of logical cylinders by an integer, and then multiplying the number of logical heads by the same number. The translation made by BIOS is simply an exchange of coordinate systems.

Consider a 3.1 GB Western Digital Caviar hard drive, AC33100. This drive actually has a capacity of 2.95 binary GB, and logical geometry of 6,136 cylinders, 16 heads and 63 sectors. This is well within the bounds of the IDE/ATA limitations, but exceeds the BIOS limit of 1,024 cylinders. The BIOS picks a translation factor such that dividing the logical number of cylinders by this number will produce a number of cylinders below 1,024. Usually one of 2, 4, 8, or 16 are selected; in this case the optimal number is 8. The BIOS then divides the number of cylinders by 8 and multiplies the number of heads by 8. This results in a translated geometry of 767 cylinders, 128 heads and 63 sectors. Evidently, the capacity stays unchanged, and the new geometry fits quite nicely into the BIOS limits:

Table II.3.1: ECSH geometry translation applied to 3.1 GB Western Digital Caviar TM.
Standard Cylinders Heads Sectors Capacity
IDE/ATA Limits 65,536 16 256 128 GB
Hard Disk Logical Geometry 6,136 16 63 2.95 GB
BIOS translation Factor divide by 8 multiply by 8 -- --
BIOS translated Geometry 767 128 63 2.95 GB
BIOS Int 13h Limits 1,024 256 63 7.88 GB

The BIOS presents the translated geometry to the operating system and the hard disk is seen as it has 767 cylinders, 128 heads and 63 sectors. Whenever the operating system or an application wants to use BIOS Int 13h calls, they use this geometry. The BIOS, when it executes its disk access routines, translates back to the real logical geometry used by the hard disk before sending its request to the disk.

Extended CHS or large mode are, in practice, not that frequently used. Instead, LBA mode is more popular; it is similar in concept but does the translation differently.

Logical Block Addressing (LBA)

As we mentioned, regular addressing of IDE/ATA drives is done by specifying a cylinder, head and sector address where the data that is required resides. Extended CHS addressing adds a translation step that changes the way the geometry appears in order to break the 504 MB barrier, but the addressing is still done in terms of cylinder, head and sector numbers, however, they are just translated one or more times before they get to the actual disk itself.

In contrast, logical block addressing or LBA involves a new way of addressing sectors. Instead of referring to a cylinder, head and sector number, each sector is instead assigned a unique "sector number". 3-dimensional coordinate system is just linearized. In essence, the sectors are numbered 0, 1, 2, etc. up to (N-1), where N is the number of sectors on the disk. An analogy would be as follows. The mailing address is composed of a street number, street name and city name. Here we have three coordinates as in conventional CHS addressing. Instead however, let's say that every house in the country were given a unique identifying number. That is how LBA works.

In order for LBA to work, it must be supported by the BIOS, as well, as by the hard disk. Most newer hard disks do in fact support LBA, and when auto-detected by a BIOS supporting LBA, will be set up to use that mode.

A drive using LBA is not subject to the 504 MB disk size barrier, however there has been a great deal of confusion regarding LBA and what it does. In particular, a lot of people think that it is the LBA addressing that "gets around the 504 MB barrier". Strictly speaking, this is inaccurate. It isn't the LBA that is getting around the barrier, because LBA is just a different way of addressing same geometry; if you were still limited to 1,024 cylinders, 16 heads and 63 sectors, you would still have logical sectors numbered 0, 1, 2, etc. up to 1,032,191, and you would still be stuck with 504 MB.

The reason that setting a drive's mode to LBA will get around the 504 MB barrier is that LBA mode automatically enables geometry translation as well. This translation is still required because the software calling the BIOS Int 13h routines knows nothing about LBA. It is the translation that is what really gets around the barrier, but of course all of this happens transparently to the user.

When LBA is turned on, the BIOS will enable geometry translation; this is done the same way that it is done in Extended CHS or large mode. The translated geometry is still what is presented to the operating system for use in Int 13h calls. The difference is that when using ECHS the BIOS translates the parameters used by these calls from the translated geometry to the drive's logical geometry. With LBA, it translates from the translated geometry directly into a logical block (sector) number (cf. [Kozierok]).