VOICE Home Page: http://www.os2voice.org
[Newsletter Index]
[Previous Page] [Next Page]
[Features Index]

December 2000
editor@os2voice.org

Hard Drive Geometry and OS/2

By Daniela Engert ©December 2000

Referenced web sites:
T10 Technical Committee (I/O Interfaces):http://www.t10.org
Technical Committee T13 AT Attachmenthttp://www.t13.org
Let me step in to shed some light onto the subject of how ATA (IDE) and SCSI sub-system drive geometry is seen from within OS/2.

We are talking about a scenario, where the BIOS is involved in the communication between the application and the disk. Thus, the application doesn't talk to the disk but rather an abstract interface that the BIOS provides: the INT13 API. This is true for both ATA and SCSI systems.

Now, what most people don't know (and usually don't have to care about), is the fact, that up to *two* different CHS (Cylinder, Head, Sector) geometry translations may be in effect during this process! Let's look at them in detail.

1) The interface between the application and the BIOS.

The 'old' INT13 API provides a CHS-style interface only:
10 bits for the cylinder number (C), max. range 0..1023
 8 bits for the head number (
H), max. range 0..254
 6 bits for the sector number (
S), max. range 1..63
The upper limit of 254 for Heads, is because of programming errors in some MSDOS flavours, the lower limit of 1 for Sectors is for historical reasons. CHS combined gives a maximum addressable range of up to 1,645,056 Sectors (7.84GiB). This limit is imposed by the API spec only, I haven't talked about any kind of hardware up to now!

The system BIOS chooses a "virtual" geometry based on the above limits and some selectable flavours in the BIOS settings (normal/large/LBA). Both partners using this interface have to agree on this geometry. This "virtual" geometry is used for partitioning and formatting the disk!

The 'new' (enhanced) INT13 API provides an LBA-style interface only with a 64 bit LBA value. This gives a maximum addressable range of 8,388,608 PeB.

SCSI host adapters usually provide an INT13 API as well. They have to do so if they offer the boot capability. Thus SCSI attached disks suffer from the same BIOS limitation as ATA disks do. To be compatible these SCSI BIOS implementations need to fake up "virtual" geometries as well. The most common standard here is the so called "Adaptec" standard which uses different CHS mapping for disks with less than 1 GiB, less than 2GiB, and more than 2GiB (IIRC) - sometimes this mapping is selectable in the SCSI BIOS. LSI (formerly known as NCR or Symbios) based SCSI host adapters behave differently: if you attach a partitioned/formatted disk to such a controller, its BIOS will use the CHS geometry found in the MBR instead of calculating one by itself based on the disk size.

The same rules about matching "virtual" geometries reported by the BIOS and used during disk partitioning/formatting apply here as well!

2) The interface between the BIOS and the disk.
In the case of an ATA system, the ATA specification offers two addressing schemes from day one - a CHS addressing scheme and an LBA one. The SCSI specification knows about the LBA addressing scheme only.

The ATA CHS addressing is as follows:

16 bits for the cylinder number (C), max. range 0..65535
 4 bits for the head number (
H), max. range 0..15
 8 bits for the sector number (
S), max. range 1..255
This gives a maximum addressable sector range in CHS mode of 267,386,880 sectors (127.5GiB) but the spec allows this to be limited to (16,383/16/63) or 16,514,064 sectors (7.8GiB). Most devices don't support CHS addressing beyond this limit.

The drive proposes a "best" CHS translation geometry for this communication level, but the BIOS may decide to override that within the above limits.

The ATA LBA addressing uses a 28 bit LBA value which offers a maximum addressable range of 268,435,456 sectors (128GiB). There are proposals to lift this limit to up to 64 bit in the forthcoming ATA specs. For details have a look at the ANSI T13 committee web site.

In the case of SCSI, there were different upper limits of the addressable LBA range in the past (6/10/12 byte commands). For details have a look at the ANSI T10 committee web site.

As you can see, with the LBA addressing scheme there never was a true limit on the addressable range in both ATA and SCSI systems, the only limit is the 'old' BIOS CHS interface.

The OS/2 BootManager that comes with WSeB (and MCP/eCS as well), and the parts involved in later OS/2 boot stages (partition sector loader, OS2BOOT, OS2LDR, ...), can take advantage of the 'new' INT13 BIOS API to overcome the dreaded 1024 cylinder limit, and boot OS/2 beyond this old barrier.

A little secret:

Neither OS/2 IDE driver (IBM1S506 and DaniS506) minds if one changes the BIOS settings (LBA/Large etc.) or moves the drive to a new system with different settings! When a disk drive is found, the partitions are scanned. If there is a partition with a valid BPB found (or at least a consistent MBR in the case of DaniS506), the driver uses this CHS info instead of the one reported from the BIOS. This way you can shuffle disks between different machines without hassles.

Glossary of terms used in this article:

ATA: (AT Attachment) The specification for IDE drives.

Int 13: A base operating system interrupt, dating from DOS, used to activate disk functions, such as seek, read, write and format.

LBA: (Logical Block Addressing) A method used to support IDE hard disks larger than 504MB (528,482,304 bytes) on PCs. LBA provides the necessary address conversion in the BIOS to support drives up to 8GB. BIOSs after mid 1994, which are sometimes called "Enhanced BIOSs," generally provide LBA conversion.

MBR: A disk drives Master Boot Record.

BPB: Boot Parameter Block, part of the first sector of IBM/MS compatible filesystems, describes the basic organization of the partition (amongst others, the CHS geometry used while formatting the partition).

PeB: Petabyte, 1 PeB = 2^50 byte = 1024 TeB = 1024 * 1024 GiB


Daniela Engert, systems engineer at MEDAV GmbH. Daniela is the author of the DANIS506.ADD and DANIATAPI.FLT replacement drivers, as well as a number of other freeware OS/2 items.

[Features]
editor@os2voice.org
[Previous Page ] [Index] [Next Page ]
VOICE Home Page: http://www.os2voice.org