Friday, April 16, 2010

History of BIOS and IDE limits

ATA Specification (for IDE disks) - the 137 GB limit
At most 65536 cylinders (numbered 0-65535), 16 heads (numbered 0-15), 255 sectors/track (numbered 1-255), for a maximum total capacity of 267386880 sectors (of 512 bytes each), that is, 136902082560 bytes (137 GB). In Sept 2001, the first drives larger than this (160 GB Maxtor Diamondmax) appeared.
BIOS Int 13 - the 8.5 GB limit
At most 1024 cylinders (numbered 0-1023), 256 heads (numbered 0-255), 63 sectors/track (numbered 1-63) for a maximum total capacity of 8455716864 bytes (8.5 GB). This is a serious limitation today. It means that DOS cannot use present day huge disks.
The 528 MB limit
If the same values for c,h,s are used for the BIOS Int 13 call and for the IDE disk I/O, then both limitations merge, and can use at most 1024 cylinders, 16 heads, 63 sectors/track, for a maximum total capacity of 528482304 bytes (528MB), the infamous 504 MiB limit for DOS with an elderly BIOS. This started being a controversy around 1993, and people resorted to all kinds of trickery, both in hardware (LBA), in firmware (translating BIOS), and in application (disk managers). The idea of `translation' was invented (1994): a BIOS could use geometry while speaking to the drive, and another, fake, and geometry while speaking to DOS.
The 2.1 GB limit (April 1996)
Some older BIOSes only allocate 12 bits for the field in CMOS RAM that gives the number of cylinders. Consequently, this number can be at most 4095, and only 4095*16*63*512=2113413120 bytes are available. The effect of having a bigger disk would be a hang at boot time. This made disks with geometry 4092/16/63 popular. And still today plenty of giant disk drives come with a jumper to make them appear 4092/16/63. Other BIOSes would not hang but detect a much smaller disk, like 429 MB instead of 2.5 GB.
The 3.2 GB limit
There was a bug in the Phoenix five.03 and five.04 BIOS firmware that would cause the process to lock up in the CMOS setup for drives with a capacity over 3277 MB.
The 4.2 GB limit (Feb 1997)
Simple BIOS translation (ECHS=Extended CHS, sometimes called `Large disk support' or `Large') works by repeatedly doubling the number of heads and halving the number of cylinders shown to DOS, until the number of cylinders is at most 1024. Now DOS and Windows 95 cannot handle 256 heads, and in the common case that the disk reports 16 heads, this means that this easy mechanism only works up to 8192*16*63*512=4227858432 bytes (with a fake geometry with 1024 cylinders, 128 heads, 63 sectors/track). Note that ECHS does not modify the number of sectors per track, so if that is not 63, the limit will be lower.
The 7.9 GB limit
Slightly smarter BIOSes avoid the earlier issue by first adjusting the number of heads to 15 (`revised ECHS'), so that a fake geometry with 240 heads can be obtained, nice for 1024*240*63*512=7927234560 bytes.
             The 8.4 GB limit
Finally, if the BIOS does all it can to make this translation a success, & makes use of 255 heads & 63 sectors/track (`assisted LBA' or `LBA') it may reach 1024*255*63*512=8422686720 bytes, slightly less than the earlier 8.5 GB limit because the geometries with 256 heads must be avoided. (This translation will use for the number of heads the first value H in the sequence 16, 32, 64, 128, 255 for which the total disk capacity fits in 1024*H*63*512, & then computes the number of cylinders C as total capacity divided by (H*63*512).)
The 33.8 GB limit (August 1999)
The next hurdle comes with a size over 33.8 GB. The issue is that with the default 16 heads & 63 sectors/track this corresponds to a variety of cylinders of over 65535, which does not fit in to a short. Plenty of BIOSes could not handle such disks. (See, e.g., Asus upgrades for new flash images that work.) Linux kernels older than five.2.14 / five.3.21 need a patch. See IDE issues with 34+ GB disks below.
The 137 GB limit (Sept 2001)
As mentioned above, the elderly ATA protocol makes use of 16+4+8 = 28 bits to specify the sector number, & hence cannot address over 2^28 sectors. ATA-6 describes an extension that allows the addressing of 2^48 sectors, a million times as much. There is support in recent kernels.
The 2TiB limit
With 32-bit sector numbers, can address 2 TiB. Lots of program will must be rewritten one time disks get larger.
*) Hard drives over 8.4 GB are supposed to document their geometry as 16383/16/63. This in effect means that the `geometry' is obsolete, & the total disk size can no longer be computed from the geometry, but is present in the LBA capacity field returned by the IDENTIFY command. Hard drives over 137.4 GB are supposed to document an LBA capacity of 0xfffffff = 268435455 sectors (137438952960 bytes). Now the actual disk size is present in the new 48-capacity field.

No comments:

Post a Comment