Classic Computer Magazine Archive COMPUTE! ISSUE 140 / MAY 1992 / PAGE 56

Hard disk size crisis. (disk size limitations) (Column)
by Mark Minasi

By now, most everyone knows the worst part of PC- and MS-DOS 3.3--they're limited in that they can only address a drive up to 32MB. You may know that DOS 4.x and 5.x can theoretically address a drive of up to two terabytes (two trillion bytes), but you probably don't know that you're essentially restricted to 516MB because of your BIOS. This month, I lead you through the maze of disk size limitations--limitations we'll all have to learn to live with.

First, understand that limitations of various kinds are imposed by the layers that data must pass through from the disk to the applications program. It looks something like this: disk [right arrow] disk interface [right arrow] BIOS [right arrow] DOS.

The first hurdle is the interface. The most common interface is the ST506 interface, so let's start from there. Disk geometry is dependent on how the data is laid out on the disk. There are multiple read/write heads on a disk, as hard disks consist of multiple metal platters on which the data resides. Each disk surface is divided up into circular concentric areas called tracks, which are like the lanes of racing track, and each track is divided into a number of sectors. Each sector contains 512 bytes of data, or, expressed differently, 1/2K bytes of data. An ancient 10MB XT hard disk had four heads, 305 tracks per head, 17 sectors per track, and 1/2K bytes of data per sector for a total of 4 x 305 x 17 x 1/2K, or 10,370K bytes of data capacity.

The Beast with 16 Heads

The common ST506 interface can only support up to 16 heads (8, actually, but most AT-type ST506 controllers break the rules and go to 16), and it really doesn't care how many sectors or cylinders the disk has. So ST506 imposes the first constraint--the disk can have no more than 16 heads. The newer ESDI interface, by comparison, can support up to 256 heads, up to 4096 cylinders x 256 sectors per track x 1/2K bytes per sector would be about 135 gigabytes (GB). The other newer SCSI and IDE interfaces don't care about heads and cylinders, as they're designed differently, and are only concerned with the total number of sectors on the disk.

Next is the BIOS. The BIOS disk interface is called INT 13 after the programming command used to access it. It was originally defined for floppy disks, and therein lies the source of many of its problems. An 8-bit register, called CL, stored the sector number. Another named CH stored the track number. And a third 8-bit register called DH stored the head number. Eight bits can represent up to 256 values, so that meant that the BIOS supported up to 256 heads, 256 cylinders, and 256 sectors per track.

For the sake of convenience and compatibility, INT 13 was augmented to support hard disks in the XT and later machines. 256 cylinders x 256 heads per cylinder x 256 sectors per track x 1/2K bytes per sector isn't a bad limit--8.4GB. But it's arranged wrong. Nobody makes a drive with more than 16 heads, and virtually all hard disks have more than 256 cylinders.

So INT 13 for the hard disk cheated a bit.

The definition of CH and CL was blurred a bit. CL still stores the sector number, but only in the low six bits of CL. The high two bits of CL were tacked onto the front of CH for the cylinder number. That means that CL--the sector number--can only assume a value up to 63. CH--the cylinder number--can only assume a value up to 1023, the largest value that can be represented with ten bits.

So the BIOS imposes a restriction of cylinders no greater than 1023, sectors per track no greater than 63, and heads no greater than 256. As you'd imagine, 256 heads isn't a problem. The 1024 cylinder barrier is a major pain, as many of today's drives exceed it, and the 63 sector barrier is being approached by many drives. What should you do if you have a drive with more than 1024 cylinders? You can sidestep the BIOS, as with SpeedStor or OnTrack, but you sacrifice total compatibility with Windows and will be unable to use OS/2.

How do some drive makers get around this? They tell their drives to lie to the PC. Rather than saying that they have four heads and 2000 cylinders, they say they have eight heads and 1000 cylinders. The result comes out the same, capacitywise. Doing this is called translation--sector, head, or cylinder translation. Basically, translation is undesirable because it removes much of your flexibility in doing data recovery when problems arise with your drive. I avoid it.

One Size Fits All

Last in the limitations list, DOS has size limitations. The major DOS limitation is imposed by the boot record. There were, prior to DOS 3.31, two bytes--16 bits--set aside for the total number of sectors per logical drive. The size of 16 bits implies a maximum number of sectors equal to [2.sup.16], or 65,536, or 64K. As each sector is 1/2L in size, the total size of the logic disk was restrained to 64K x 1/2K bytes per sector, or 32MB per logical disk.

DOS 3.31 and later versions have removed this restriction, however, setting aside four bytes for the total number of sectors. Four bytes is 32 bits, describing two terabytes of disk size--enough to hold us for a while.

So how large a disk could you buy today without resorting to translation? Assuming that the large drive was an ESDI, your limitations would be as follows:

cylinders = 1023 (BIOS limitation) heads = 16 (market limitation--no drives today have 17 + heads) sectors per track = 63 (BIOS limitation) bytes per sector = 1/2K (only because most software expects it) total (1023 x 16 x 1.2K) = 516MB

Of course, this isn't the limit. As I've said, if you don't mind giving up OS/2 and UNIX compatibility, device drivers that ship with OnTrack and SpeedStor can double the size of the cylinders to 2048, allowing drives up to 1032MB, or just over a gigabytee, under DOS.

Should you care, given how complicated this all appears? Yes, and the reason is that DOS is reaching a crisis. While 516MB may seem like a lot, it's not. You can now buy a 200MB drive for just $500. Drives exist that store over one gigabyte and cost in the $3,000 range, not much more than you would've paid for a 60MB drive just a few years ago. In the mid nineties, you'll be able to buy a 500MB drive for just $700. Something's got to be done: either a general acceptance of device drivers to access hard disks or a new augmented BIOS standard. You can be sure that there will be more than one solution offered and several proposed new standards hawked by the big vendors.

Short-Term Solutions

Is there another answer? Sure. Two, in fact. But you won't necessarily like them. I recently installed a 631MB drive in a new system, an ESDI drive. As the drive's being put in a system with an EISA bus, I thought I'd try out a bus-mastering controller to see if bus-mastering controllers are all they're cracked up to be.

With ESDI, the drive tells the controller all its vital statistics. Rather than your having to run a setup program to tell the controller that you've got so many heads, cylinders, and the like, you just plug the drive into the controller, and away you go. When it's format time, the controller just asks the drive how it's laid out and formats accordingly.

You can imagine my surprise when I ran a disk-tester program on my new 631MB drive and it reported that it had 64 heads, 32 sectors per track, and 631 cylinders. After a moment's thought, I realized that my bus-mastering controller was evading the "How do I deal with more than 1023 cylinders?" problem by doing sector translation. Notice how the controller does it--64 heads, 32 sectors per track. (The actual geometry is 1630 cylinders, 15 heads, and 52 sectors per track.) A little arithmetic shows us that 64 heads x 32 sectors per track x 1/2K bytes per track yields a cylinder that's exactly 1024K--one megabyte--in size. This is actually a fairly popular translation scheme, perhaps because IBM uses it in many of its desktop PS/2s, most of which do some kind of translation. If it has any virtue, it's that the existence of cylinders that are exactly one megabyte in size makes partitioning easy under DOS 3.3's FDISK. When FDISK under 3.3 allows you to choip up a drive, it forces you to do it in units of cylinders, units that most of us don't have close to hand. By making each cylinder one megabyte in size, the translating controller lets you specify a number of cylinders equal to your desired partition size in megabytes.

So I've got the drive installed. It's incredibly fast, and DOS likes it just fine--but, as I said above, I'm stuck in DOS with this controller and hard disk. As it's a sector translator, it confuses OS/2 and UNIX. That's not the end of the world, however, as the controller manufacturer, Ultrastor, includes drivers for OS/2 and UNIX. The OS/2 drivers work just fine with OS/2 version 1.3, but I'm just a teensy bit uncomfortable about the future. Will Ultrastor support OS/2 version 2.0? Will the company be around when OS/2 version 47 arrives? We'll see.

I bought that drive because I've worked with one like it before. It's the Maxtor 676E, and it's an excellent device. I've installed it on another machine, gotten the full capacity available to DOS, and still not sacrificed OS/2 compatibility.

First, I got a fairly vanilla ESDI controller, the Western Digital WD1007W. It sees the drive as a 1630-cylinder drive--which is good. I avoid problems with DOS by just not telling DOS that there are any cylinders after 1023. So from the point of view of DOS, UNIX, OS/2, and the bunch, it's a drive with 15 heads, 1023 cylinders, and 52 sectors--a 390MB drive. That's all the drive that OS/2 and UNIX see. But I can recover the remaining 241MB by using Disk Manager. Now I have 390MB available to any system and an extra 241MB just for DOS. Not a perfect answer, but one that doesn't involve translation.