Understanding Hard Disk Geometry


You'll see a lot of references to "hard disk geometry" in the online tutorials that explain how to prepare your disks, and you'll encounter this term every time you run fdisk (or the friendlier interfaces to fdisk that you use in this chapter). Fortunately, this is something that owners of newer hardware (that is, hardware manufactured after hard disks larger than 8GB were common) or owners of SCSI disks can skip or ignore. Disk geometry data is only there for informational purposes. The functional importance of this information is now no longer the administrator's responsibilityit's the hardware's.

One of FreeBSD's strengths, though, is that it will run efficiently even on older hardware that is considered obsolete for desktop use or to run Windows. Your ancient 166MHz Pentium motherboard will support FreeBSD just fine. But there's a trap: Try to plug in a new 70GB IDE hard disk, and the system might not realize that it's any larger than 8GB. This is where the unpleasantness of disk geometry comes into play. To use the disk, you will need to use some techniques that have otherwise been made obsolete by newer BIOS technology as well as know something about the history of hard disk development.

Back in the mists of time, when data storage registers were made only as large as cost would allow, regardless of future scalability implications, IDE hard disks reported their size as a function of their physical geometry. Four dimensionsheads, cylinders, sectors, and bytesdescribed the layout of the disk and subsequently its size, or the amount of data that could be stored on it (see Figure 20.1). Hard disks still have the same internal geometry as they always did; it's just no longer as important to understand it thoroughly as it was back then.

Figure 20.1. Hard disk geometry.


A disk is made up of a number of platters, stacked on a central spindle, with data stored on both sides of each platter and one or more magnetic heads reading each side. A disk with four platters and two heads per side, for example, would have 16 heads. Each platter is divided into concentric rings, or cylinders (not in a spiral configuration, as with optical disks such as CDs), and the combination of a cylinder and the head that reads it is called a track (or cylinder-head). Tracks are then divided into sectors (usually 64 of them, with 63 usable), and each sector stores a certain number of bytes (generally 512).

Each disk is shipped with information, usually on the label, showing how many of each of these subdivisions exist on the disk. You can calculate the total size of the disk by multiplying all of them together. The disk used for the demonstration of fdisk back in Chapter 12 had the following information:

# fdisk /dev/ad1 ******* Working on device /dev/ad1 ******* parameters extracted from in-core disklabel are: cylinders=1247 heads=255 sectors/track=63 (16065 blks/cyl) Media sector size is 512


Multiplying these figures together (ignoring the blocks-per-cylinder figure) and remembering that a cylinder-head is equivalent to a track (to keep your units straight) produces the following:

1247 cylinders x 255 heads x 63 sectors/track x 512 bytes/sector = 10.2GB


But wait a minute...255 heads? How can that many heads fit in a hard drive? Does this make sense at all? Nofirst of all we'd expect the number of heads to at least be an even number. Even if we allowed for that, we're talking about what appears to be at least 64 platters, which just isn't physically possible in a half-inch-high hard disk. What we've got here is a virtual disk geometry, made possible by two successive hacks by the hard disk industry, which get around register-size limitations imposed by the original design of the disk interface in the BIOS. These two hacks are LBA and Extended INT13 modes.

LBA and the 528MB Limit

In the days of floppy disks, nobody thought that anyone would ever use a disk as gargantuan as 528MB; this is why that number was allowed to remain as the size limitation imposed by the number of bits the original PC BIOS (combined with the ATA/IDE standard) allocated to each of the disk geometry dimensions, shown in Table 20.1.

Table 20.1. Dimensional Limits on Hard Disk Geometry

Dimension

Bit Size

Maximum Value

Cylinders

10 bits

2^10 = 1,024

Heads

8 bits

2^8 = 256

Sectors/tracks

6 bits

2^6-1 = 63


Therefore, a disk was allowed to have up to 256 heads, but no more than 1,024 cylinders. Because the number of bytes per sector and the number of sectors per track are relatively fixed numbers (dependent on physical limitations such as rotation speed and read reliability), and because you can't really put more than a few platters and heads into a drive you want people to be able to lift, this meant that the cylinder number rapidly emerged as the limiting factor in a disk's ultimate size. Disk manufacturers eventually converged on the ATA standard of 16 physical heads in a disk, so this meant a size limit of 528MB. The manufacturers could produce disks larger than that size by adding more cylinderswhich was easy because the stepper motor that moves the head's swingarm between cylinders can be controlled very preciselybut the BIOS couldn't address any of the cylinders above 1,023.

Around 1993, it became apparent that this wasn't going to fly as users' hunger for disk space continued to grow. A single video game could take up that much space! So, the BIOS manufacturers developed a scheme called Logical Block Addressing (LBA), whose purpose was to augment the BIOS disk addressing method by remapping cylinders above 1,024 to "virtual heads," thus taking advantage of all the available head numbers up to 255 that were going unused. For example, a disk with 1,852 cylinders and only 16 physical heads could actually be thought of as having 463 cylinders and 64 heads. Now the disk's calculated size was unchanged, and both the cylinder and head values were within their BIOS-imposed limits. All was well once again...for awhile.

Extended INT13 Modes and the 8.4GB Limit

The alert reader will have noticed that this scheme could only have been considered a temporary solution because eventually LBA would run out of room when both the cylinder and head numbers were completely filleda disk size that works out to about 8.4GB.

Indeed, it wasn't longanother four years or sobefore disks were jostling at the 8.4GB barrier. (It should also be noted that 8.4GB was only a theoretical limit; many buggy BIOS implementations and supporting software tools used pseudo-LBA routines that introduced barriers at lower numbers.)

The solution was a newly redesigned BIOS interface, commonly called Extended INT13, which is now in general use in modern hardware and in operating systems such as Windows (where the software still must communicate with the disk through its BIOS, something FreeBSD doesn't need to do). This new interface abstracts the disk geometry addressing through a 16-byte disk-addressing packet, effectively removing any size limitation imposed by new hardware.

If your hardware is modern enough to understand the Extended INT13 modes, you're home freedisk geometry need only interest you for curiosity's sake. If you use a tool to try to extract the geometry information from a disk larger than 8.4GB, it will report 16,383 cylinders, 16 heads, and 63 sectors per tracka "code" configuration that tells the operating system not to even try to compute the disk's size from its geometry. If you see this configuration being reported anywhere, rest assured that FreeBSD is taking care of all this "geometry" nonsense itself. That is, unless your disk is larger than 137GB, at which point even the Extended INT13 modes can't overcome the ATA standard-imposed limit of 65,536 cylinders.

48-bit LBA

Modern motherboards' BIOS chipsets support a new scheme called 48-bit LBA, the latest step in the ongoing arms race against hard drive size limitations. Prior to the introduction of 48-bit LBA, the ATA interface only had 28 bits with which to address data storage locations on a drive, which worked out to a practical maximum disk size of 137GB. With 48 bits to work with, though, the number of addressable cylinders was no longer limited to 65,536, and BIOSes could now address up to 144 petabytes of data (150,994,994 gigabytes). Hopefully that will hold us for a while....

Practical Implications of Installing FreeBSD on Older Systems

If you're installing FreeBSD on older hardware, such as a motherboard from the days of LBA, you may well run into one of these limitations. You won't lose any data, but you may notice odd problems, such as your 70GB disk only reporting 8.4GB total space. If it does, you'll know what the cause is.

Many motherboard and chipset manufacturers provide BIOS upgrades, which can help you get past these problems. Check with the maker of the motherboard or chipset (consult its website) to see whether a firmware update is available. If not, you may have no choice but to invest in a new motherboard and CPU, or else to use lots of small disks instead of one large one. FreeDOS (http://www.freedos.org) can be a lifesaver if you need to upgrade your BIOS using a DOS utility.

Of course, if you've chosen instead to use SCSI or FireWire (IEEE 1394) hard drives (and if your hardware is modern enough to support them), none of this need apply to you. These interfaces were designed with much more scalability in mind than IDE/ATA was, so their typically higher price is justified by their behavioral predictability.




FreeBSD 6 Unleashed
FreeBSD 6 Unleashed
ISBN: 0672328755
EAN: 2147483647
Year: 2006
Pages: 355
Authors: Brian Tiemann

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net