Understanding Disk
Drive Terminology, Technology
and Capacity
Calculations
Copyright©2001,2005,2007
by Daniel B. Sedory
NOT to be reproduced in any form without Permission
of the Author !
Hard Disk drives can be thought of as a combination of the old Vinyl record technology of turntables with a spinning disc on a platter and an arm you could move across the disc's surface, and the technology of audio cassette tapes that used a head (instead of a needle) to both play and record signals on a magnetic memory media.
Basically, disk drives have heads that record (write) and playback (read) data on rigid spinning circular disks (often called platters) that are coated with a thin magnetic media plus a protective surface layer; both of which are very easy to damage and contaminate, thus the dire warnings to never open the metal cover of a hard drive's case. For floppy drives, there's a somewhat flexible disk (instead of a rigid platter) whose storage media is similar to that of audio tapes ( and can also be removed from the drive like an audio cassette tape can from a tape player ). And just like the old phonograph records, there's always an area near the center of both floppy diskette media and hard drive platters that never contains any data.
In the following discussion, we'll introduce terms such as heads and cylinders which still have real physical connections to floppy diskettes. However, due to changes in the manufacturing of hard disk drives and PCs, these terms are no longer directly applicable to the physical reality inside a modern HDD. But you still need to know where these and other terms came from and how they were used historically in order to understand why, for example, an HDD that's labeled as having 6136 cylinders and 16 heads is seen by the BIOS of a computer as having only 767 cylinders and 128 heads; when in reality, the drive probably had just 6 (or less) physical heads! Let's start . . .
The usable surface area of a hard or floppy disk is divided into a number of invisible concentric rings called tracks (see Fig. 1). And each track is divided into the same number* of small arcs called sectors. If a drive has more than one platter (or surface) that can store data (such as a double-sided floppy disk), then all the tracks that are located in the same position on each platter (or side of a disk) are collectively known | ||
as a cylinder. Data is read from or written to a disk drive's platter by a head on the end of an actuator arm. |
* In reality, the manufacturers of modern hard disk drives vary the number of sectors per track, increasing the total by thousands of sectors for the larger tracks (those closer to the outside edge of the platters). This is called zoned recording. Since the size of the magnetic domains that can be written to/read from a platter have become just a tiny fraction of those on the first hard disks, there would be a huge amount of wasted space between them if the longer tracks were limited to the same number of sectors as the shortest (innermost) track! |
NOTE: If an HDD platter/disc (or floppy diskette) has only one usable side, then the term cylinder becomes pointless since it will refer to the same physical locations as the term track; we'll comment on this later, under the section on calculating the capacity of a drive. Another important point: the terms head and side were often used interchangeably when computing the capacity of very small disk drives. Thus, sectors on a disk might have been referenced as being either Cylinder x, Side y, Sector z or as Cylinder x, Head y, Sector z. The most common method (and the one used by the BIOS and many utility programs) is to specify by CHS (Cylinder, Head and Sector; in that order). However, some old timers in the computer industry still have a tendency to use the term Side; especially when discussing Floppy Disks.
The photo below shows a modern hard drive with three platters and (most likely) five usable sides (difficult to determine from just the photograph, where the light blue color of the platters is a false color added to the picture for better contrast due to their actual mirror-like reflective surfaces).
Note: the heads do not touch the platters while they are spinning, but ride on a very thin cushion of air. At speeds of 5400, 7200 or even 10,000 RPM, a head touching the platter could easily crash (ruin the thin surface of) the drive! This can also happen if tiny particles get stuck between a head and the surface and scratch it, or if the drive chassis is struck hard, which may force the head assembly against the surface in spite of the lift it has from the air flowing under it.
When correctly powered-down, the heads are moved to a "parking position" where they won't rest on (or cause problems for) any stored data. Even the slightest head crash produces some loose particles, and that debris might cause further crashes later on if they're not picked up by air filters inside the drive!
NOTE: The platters of a common hard drive are not completely sealed off from the outside as many people think. Therefore, you can damage an HDD by running it at too high of an altitude where there is less air pressure; since the heads may stay in contact with the platters or skip up and down! Laptop users might want to check with their drive's manufacturer before taking it on a mountain top experience they'll never forget! The astronomical observatories atop Mauna Kea, Hawaii, are at almost 13,800 feet (4205 m) and must use specially designed air tight drives similar to those used in aircraft/spaceflight where air pressure could be reduced or lost completely.
Even though the air which does reach the platters is sometimes said to be cleaned by a series of filters, all of the drives we've taken apart had just small pieces of filtering material (similar to that of a surgeon's mask) behind one or a few small holes open to the outside environment. Have you ever seen all the minute dust particles in a used computer; especially around the fan? So, it's a good idea not to have your computer fans aimed directly at any of those holes. Heat is the enemy of most any electronic equipment, and if that dirt seals off those air filters, it can only get hotter inside that drive! And you definitely don't want someone blowing cigarette smoke towards your computer either! (Consider what might happen to the data inside an HDD if any paricles of smoke; which are actually quite small, were to get past those filters and lodge between a head and the media.)
For more detailed information
and photographs of the small filters that separate your HDD
platters from the outside world, click: http://www.storagereview.com/guide2000/ref/hdd/op/packAir.html. Here's a more general page about HDD platters and heads and the "head gap" (a tiny cushion of air) between them: http://www.storagereview.com/guide2000/ref/hdd/op/heads/opHeight.html. |
In one very important aspect, the first generation of PC Hard Disk Drives were not all that much different than diskette drives: The mechanisms that positioned the heads over their respective magnetic surfaces were essentially the same design! They both used what might be called dead reckoning and the same kind of stepper motors you'll still find inside a Floppy Drive. This meant that you could use a large electro-magnet or degaussing coil to erase an HDD (just like some companies do with floppy disks), because you could still employ a true low-level formatting (LLF usage note) program to reformat all of its tracks and sectors; just like we still do today with the 1440 KiB floppy diskette!
But HDD technology soon advanced far beyond that of floppy disks; recall the note above about extremely high densities on HDD platters and zoned recording! If you were to thoroughly degauss a modern HDD today, it would be useless for storing data! Why? Because they now use servo motors and record data that's specific to each HDD's operational parameters on its own platters! Erase that data, and it would have to go through its original factory set up all over again with special equipment; not just software!
So, how much of a magnetic field does it take to mess up a modern HDD? Well, the case does provide some protection against speakers (which have a magnet in them) and powering-up CRT monitors (which not only have magnets, but often employ degaussing rings!) Although I have no idea what kind of magnetic field intensity might be required to do any damage to your embedded servo data, I do know that most servo motors in disk drives have their own magnet. Someone recenlty shared with me that the servo motor has a rather strong magnet (in his opinion; I don't know the facts though), but they are always placed in one of the corners of the drive. To be safe, I wouldn't set any permanet magnets directly on an HDD case, but perhaps there's no need to worry about it! If you're really interested, you could always experiment with floppy disks, to see just how strong of a field it takes to erase data from them and assume it would take a much stronger magnet to affect the platters inside an HDD.
How Large is a Megabyte or a Gigabyte? |
---|
Disk Drive manufacturers have always used the more proper (you could even say correct or true) definitions of Mega and Giga in reference to the byte-capacity of their drives. Along with virtually all technical organizations in the world (including the Standards Board of the IEEE), they use the International System of Units (SI) which defines a Megabyte as exactly 1 x 10^6 bytes (1,000,000 bytes) and a Gigabyte as exactly 1 x 10^9 bytes (1,000,000,000 bytes). Of course, this doesn't mean that a sales blurb will give the exact capacity of an HDD (it may only be rounded up or down to the nearest one or two digits); usually the drive case will have a label giving the correct size in 512-byte sectors. In contrast to the world of disk drives, Memory chip manufacturers had a basic problem with the SI prefixes, since electronic computer Memory has always been based on the Binary system! When computer Memory was rather small, engineers and technicians began to refer to a Kilobyte of Memory as the nearest value to 1 Kilo (or 1000) for a power of two. The differences were fairly easy to compute back then: A Kilobyte of Memory was not 1000 bytes, but rather 1024 bytes, since 2^10 is 1024. This became a bit more complicated when Memory sizes reached a "Megabyte" of 2^20 which is not 1,000,000 bytes, but rather 1,048,576 (1024 x 1024) bytes. Now there are hundreds of "Megabytes" of memory being used in home computers and even "Gigabytes" in large servers! These Binary "Gigabytes" of Memory are equivalent to 2^30 (or 1024 x 1024 x 1024 bytes) which gives us: 1,073,741,824 bytes. The prefixes used on this page follow SI system usage; or will state specifically that they refer to the Binary (power of two) format. In time, people should eventually start to use the new terms MiB and GiB to represent Binary-Megabytes and Binary-Gigabytes (see the essay Prefixes for Binary Multiples ). |
After a PC's BIOS eliminates the possibility
of a floppy disk boot, control is passed to some code in Memory
that comes from the contents of the very first sector of its first physical
Hard Disk. The code contained in that sector is most often* that
of the OS's MBR (Master Boot Record). This location
can be referenced as either Absolute Sector Zero (0) or as CHS
0, 0, 1.
_________________
* There are many Boot Manager
programs and some viruses (called stealth boot viruses) that may be found occupying
the first sector instead. The code of early BIOS chips (in most PCs sold
before 1995) couldn't recognize more than about 528 MB (or
exactly 504 Binary-MB; see below for the details)
of any drive that happened to be larger than that. When HDD capacities
suddenly became much larger, 'drive translation' software such as EZ-DRIVE
(also called EZ-BIOS) by StorageSoft, Inc. (distributed by Microhouse);
and now owned by Phoenix Technologies, or MAXBLAST by Maxtor,
etc. was often installed in the first sector and beyond. This type of software
is known as a DDO (Dynamic Drive Overlay). Note:
In some cases, a computer manufacturer might even replace the MBR with their
own special software; although the tendency today is to reprogram the BIOS
chips instead, making sure their logos and data cannot be easily changed.
There is no MBR
on a Floppy Disk. The very first sector of a 'Floppy' may
or may not contain the Boot Record for an operating system. If it does,
the disk must contain all the necessary files to boot that OS into Memory,
or it cannot be considered a bootable floppy disk. [See the MBR Index page for more information
on Floppy Disks.]
Here's a simple diagram that shows the beginning of an HDD (for either an NTFS or FAT32 file system as its first partition); its sectors are shown as a linear display (from left to right), but are not to scale. The digits near the top (in blue or green) refer to Absolute Sectors:
The OS Boot Record for the first (or only) partition on a hard disk is usually found at Absolute Sector 63* (the 64th sector on the disk drive) and following; that's also at CHS = 0, 1, 1 for any drive, or Absolute sectors 63 through 125. [Note: Referencing a particular sector using the CHS system of early BIOS design is technically limited to only the first 16,450,560 sectors; the so-called 8.4 GB limit, even though you will see many utilities listing the number of cylinders well over 1024.] An NTFS partition has a Boot Record that's 16 sectors long (NTFS Boot Sector), and its MFT (Master File Table) begins at Absolute Sector 79 (or Logical Sector 16). A FAT32 partition has a Boot Record that's 3 sectors long (FAT32 Boot Record) in Logical Sectors 0 through 2, followed by a few zero-byte sectors plus a "Backup Boot Record" in Logical Sectors 6 through 8. But just as we found for all NTFS volumes, a Windows OS reserves many extra sectors for FAT32 partitions as well: The OS may never make use of this area (we've seen no indication that it ever does)! It's comprised of 23 sectors that are all filled with zero-bytes (from Logical Sectors 9 through 31); it's located between the "Backup copy" of the FAT32 Boot Record and the beginning of the first FAT (File Allocation Table; at Logical Sector 32).
___________________
*This location used to vary with the drive's SPT (Sectors
per Track). On an old (1993) 245MB drive having only 31
SPT (rather than the usual 63 SPT), the Boot Record was found at Absolute Sector
31 (the 32nd sector). But that's something you'll never have to
consider with a modern HDD. It does, however, let you know why most DDO software
is never larger than about 30 sectors! Today, there's always 62 sectors of space
available for a Boot Manager; but most of them would never consider using all
of the available space even today.]
After an OS boots up, it almost always "hides"
the first Track (Cylinder 0) of the first Side (Head 0);
which obviously includes the MBR sector, leaving only the OS's Boot Record
as the first logically accessible sector. This yields another
way we can reference the OS Boot Record: We would say that it is located at
Logical Sector 0 for that partition (or volume).
IMPORTANT: To avoid a lot of confusion, you must first try to determine
if a particular sector is: 1) being referenced from an Absolute
or Logical Sector as the starting point (LBA or Linear references
use these methods); both of which always begin counting from Sector ZERO (0),
or 2) if the the CHS method is being used to reference
a sector which always begins counting from Sector ONE (1).
You must also NOTE the difference between Physical
(or Absolute) sectors, and Logical sectors:
1) When discussing the MBR code, or any other code which gets loaded
immediately after the BIOS, you should refer to sectors using Physical
(or Absolute) sector numbers; after an OS has booted into Memory, these sectors
are often inaccessible by many standard utility programs (such as MS-DEBUG).
2) When an OS Boot Record is being discussed, it's likely that the sector
numbers in the text will be Logical (so sector 0, 1, 2, etc. might actually
be the 64th, 65th, 66th, etc. physical sectors on that drive).
After executing the POST (Power-On Self Test), the BIOS loads the MBR (Master Boot Record) from your first HDD into memory at 0000:7C00 and then executes it. The MBR is relocated to 0000:0600* , so it can load any Active OS Boot Record into the same location it was in: First the MBR checks your HDD for an Active Partition, then it loads the OS Boot Record into memory at 0000:7C00 and turns control over to the OS Boot code. Finally, the OS Boot Record code loads the rest of the Operating System into Memory.
_______________
*This
may not be the case with a Non-IBM/Microsoft MBR; for example, see the
LILO MBR (which moves itself to a much
higher location in memory; that being: 8A00:0098
for the MBR we examined).
First, you should be aware that the Parameters for the Cylinders, Heads and SPT listed on hard drive labels haven't had anything to do with how they're physically constructed inside for a very long time! The actual number of Sectors per Track varies a great deal depending upon which part of the disc is being accessed: the innermost track or one of the longer tracks near the outer edge of a platter. There are often just a few heads and many more cylinders (tracks) than listed. [ If you can't find any CHS parameters listed a drive, then look for the letters LBA (it stands for "Logical Block Addressing") followed by a single large number; that will be the Total number of Sectors for the drive. ]
Way back when most drives were still under 100 Megabytes, certain drive manufacturers developed and began to implement an interface for the controllers of their drives which allowed them to have a virtual maximum of 65,536 cylinders, 16 heads and 256 SPT. Each drive soon had its own little onboard computer to translate the actual physical locations of sectors on the platter(s) into a pseudo set of Cylinders, Heads and SPT that these HDD manufacturers had agreed upon. For example, a Western Digital Caviar® 33100 drive of 3166.7 MB says it has 6,136 cylinders, 16 heads and 63 SPT. Obviously with only three platters inside (that's what the first digit of the 33100 means), it's impossible for it to have more than six real heads (and may have only three)!
Unfortunately, the BIOS code for handling disks (which soon became an International
standard for all PC programmers), had developed its own set of maximum specs
of 1024
cylinders, 256* heads
and 63 SPT.
This caused all sorts of problems for PC users when they tried to increase their
drive sizes to anything more than about 528MB, because only the lowest common
values in each spec could interface with each other:
512 bytes/sector
x 63 sectors/cylinder x 1024 cylinders/head x 16 heads
= 528,482,304 bytes (or exactly 504 Binary-MB).
Eventually, computer manufacturers had to turn to programmers to create new
BIOS code which added yet another layer of translation, so all
the old programs using the BIOS code could still be compatible with these larger
drives.
[ Note:
This solution hit yet another barrier when drive capacity exceeded 8,422,686,720
bytes (The 8.4 GB Barrier). And once again, computer
manufacturers had to have new code programmed for their BIOS chips. Soon there
were drives of 30, 40, 60, and now over 200 Gigabytes that must be dealt
with. And some of these are again using a newer type of DDO software
or having their BIOS chips reprogrammed with Flash utilities (since new
BIOS code can often be downloaded from manufacturers via the Net)! These drives
may be partitioned into smaller sections, and those partitions
may have completely separate Operating and/or File systems in them. Different
OSs are often booted independently at power-up (one at a time) using various
types of specialized MBRs (such as LILO
or GRUB when a Linux OS is installed)
or some other Boot Manager software. ]
_________________
*
That's 256 possible Heads; but not what's
used in reality! There are 8-bits
that can be used for the Head count and since its
value begins with a zero and can end with 255
(or FFh), it's
possible to count up
to 256 heads. So, I had always wondered why
various notes (which also agreed with my own experience) would say that in
practice the Partition Table in the MBR and the BIOS
code used a
value of only 254 (or FEh)
for a maximum of only 255 Heads. Well, some time after I'd started using
Ralf Brown's Interrupt List for Assembly projects, I came across this
little note under INT 13 Function 02:
"All
versions of MS-DOS (including MS-DOS 7 [Windows 95]) have a bug
which prevents booting on hard disks with 256 heads (FFh), so many modern
BIOSes provide mappings with at most 255 (FEh) heads."
[INTER61 Copyright©1989-2000 by Ralf Brown].
So, this was all because of a bug in MS-DOS which has been perpetuated by Microsoft®, IBM® and the BIOS chip manufacturers just so you can still run MS-DOS x.x (for whatever version this bug first appeared in) on the same PC you've got with an OS that'd never be affected by it (Win 2000/XP, Linux or whatever)! This is yet another lesson in how one possibly stupid mistake can change a technology for a very long time! And this one will likely be with us until the CHS values are no longer used by any current software (including all BIOS, OSs and programs), hardware, interfaces, etc., so I won't even guess at how long that might take!
Computing the Capacity of a Disk
A sector
contains 512 bytes. This is the smallest amount of data that
can be written to or read from a disk drive by most software.
The 1440 KB (1.44
Mb*)
Floppy Disk:
The standard 3.5 inch PC floppy disk has
two Sides or Heads; counting from Side 0 (which is on
the bottom or hub side). There are 80 Tracks or Cylinders and
18 SPT (sectors per track). So it's capacity can be computed as follows:
512 bytes/sector x 18
sectors/track x 80 tracks/side x 2 sides = 1,474,560 bytes or 2,880 sectors.
What's that? Your computer always says it has "1,457,664 bytes total
disk space." Well, that's because you can't use the Boot sector, the
two 12-bit FATs (File Allocation Tables; of 9 sectors each)
or the fixed-size Root Directory (of 14 sectors) for storing data! So you're
left with 2,880 - 1 - 18 - 14 = 2,847 sectors
or 1,457,664 bytes for your files.
___________________
*
This odd designation of
1.44Mb by Floppy Disk and/or Drive manufacturers
is arrived at by rounding off the actual capacity
of 1440 Binary-KB (KiB) to an incorrect 1.44 Binary-MB
( just as they did for the 1200 KiB diskette by calling its size 1.2
Mb ). I'm sure this has caused even more confusion among those trying to figure
out why their hard drive (or floppy diskette) has fewer total 'GB' (or 'MB')
bytes than what's printed on the package!
[ See note above on the SI definition of a Megabyte.
]
Example: A 3.1 GB Hard Disk
The BIOS code from an early
Pentium computer translates the specs from the 3.1 GB drive mentioned earlier
this way: The Sector numbers vary from 1 through 63
for each Head, and the heads vary from 0 through 127
for each Cylinder. There's also a total of 767 cylinders
on the drive; numbered 0 through 766 (But, the BIOS might show
a total of only 766 cylinders to the OS! More on this shortly). Thus, the
total capacity of the drive can be computed as follows:
512 bytes/sector x 63 sectors/head x 128
heads/cylinder x 767 cylinders = 3,166,765,056
bytes (unformatted) or 6,185,088 sectors.
CHKDSK gives the usable space after formatting
with Microsoft's 32-bit FAT file system as: 3,156,418,560
bytes or 770,610 clusters ("total allocation units")
using a cluster size of 4 kb per cluster. (CHKDSK uses
a Binary-Kb, so 1 cluster equals 4,096 bytes or 8 sectors.
770,610 clusters x 8 sectors/cluster x 512
bytes/sector = 3,156,418,560 bytes.)
NOTE: Microsoft's MS-DOS FDISK utility along
with most third-party related software (such as PowerQuest's Partition
Magic) always follow whatever the BIOS dictates as the Cylinder
size of your HDDs. If the BIOS code was written to never make use of the last
cylinder of a hard drive, then these programs will do the same. If
you have a BIOS with more recent code (say after 1998), even your DOS software
should use all the cylinders! If you partition an HDD
using Windows 2000/XP or another modern OS such as Linux, then it will
always make use of the last cylinder because these OSs are not dependent upon
the BIOS code.
This whole problem is due to an historical
practice started many years ago which left that area available for certain
test programs; thus, the name Test Cylinder.
Wanting to be fair to the companies that make these utility programs, I'll
point out that the reason for this is because they rely upon the BIOS
to tell them how many cylinders the hard disk has rather than querying the
disk directly! Newer utilities should no longer do this. Since the drive being
discussed here (a WD 3.1 GB) was partitioned with an MS-DOS FDISK program on an
old machine, it never even knew the last cylinder was available; thus it leaves
63 sectors/head x 128 heads = 8064 sectors (or
4,128,768 bytes) reserved as a useless test cylinder.* Some
utility programs will point this out. For example, when you check this drive
with the Ranish Partition Manager (ver. 2.37), it states:
Last Update: 22 July 2007.
You can write to me using this:
online reply form.
(It opens in a new window.)
MBR and Boot Records Index
The Starman's Realm Index Page