Disk Drives over 8.4 GB should reply to most direct access inquiries (using ATA commands and coded I/O instructions) as having a drive geometry of: 16,383 Cylinders, 16 Heads and 63 SPT. (NOTE: This is not the same as the "geometry" used by computer BIOS, most utility programs or the Partition Table itself to refer to drives over 8.4GB; see below!)
This should be true for all disk sizes over 8.4 Gigabytes! To find their true capacities, you can only use the Total number of Sectors (or LBA number). As a matter of fact, the 20 GB drive we'll be examining lists exactly these three values (16,383, 16 and 63 as its own Cylinders, Heads and SPT). I have no idea why Maxtor® did this, since this tells you almost nothing about the actual capacity of the drive!
Western Digital®, however, stopped using the terms Cylinder, Head and Sector on their drive cases a long time ago, switching to just a single LBA ( Logical Block Addressing ) number; for example, one of their 40 GB drives is labeled: LBA 78165360 (which means there's a total of 78,165,360 512-byte sectors available on this drive for a capacity of: 40,020,664,320 bytes). That's very useful information compared to the Maxtor® drive!
In order to confirm our test drive's size, we had
to search the Maxtor® web site for the exact model number and found that
the drive's Number of Cylinders was: 39,704. But, that's based
upon only 16 Heads and 63 SPT, so,
after multiplying them together, that finally gave us an LBA of: 40,021,632
sectors. Hopefully, Maxtor (and any drive manufacturers like them) will begin
using this single LBA number in the future!
The Useless "Geometry" Values: Programs which use only the CHS method for calculating partition sizes (including the CHS entries in the Partition Table of any MBR or EBRs (Extended Boot Records) should now list all Starting or Ending Locations beyond about 8.4 GB as: 1024 Cylinders, 255 Heads and 63 Sectors (this means the values shown in the Partition Table itself will be: 1023, 254 and 63, since the Cylinder and Head values begin counting from zero). The point here is that you can no longer compute the capacity of a drive's partitions from its CHS values if any portion of the partition extends beyond 8.4 GB; you can only use the Total Number of Sectors to obtain its size in such cases. [See the example Partition Table below.]
NOTE:
Various utility programs (such as
PowerQuest's PartInNT for Windows) will
display
values beyond the standard 1024 cylinders!
( You need to note that this is not what's really
inside of your Partition Table, since it's physically impossible
for a 16-byte Partition Table entry to hold a number larger than 1023
for its cylinder value! There are only 10 bits available for the
Cylinder value, and 11 1111 1111 in binary = 3FF in hex =
1023. ) If
a utility program explains that it's only displaying an interpretation
of the data found in the Partition Table, then I'd have no complaints about
it. Unfortunately, many utility programs, including all of PowerQuest's
utilities and TestDisk, assume you know the difference; so be aware of
this.
However, if you ever see such values being displayed in a Disk Editor (as I recall seeing at least once), that could totally confuse you! It's my opinion that a Disk editor should always show exactly what's inside of a sector (even when it's interpreting the CHS values for you), so you know for sure what data is on that disk!
PQ Utility Users, Note: Various versions of PowerQuest's Partition Magic always complain about incorrect CHS values for partitions that end or begin after 1024 cylinders! This is very confusing to users of their software! Though we're not exactly sure why PQ decided to do this (since their program can easily convert the data in the Partition Table into a usable cylinder value), it may be that they expected BIOS manufacturers to already be making chips that would do this; and Partition Magic and the BIOS chip should agree on the same cylinder value before proceeding! (If you find an answer from PQ, let me know.)
After obtaining the data from many different computers with various BIOS chips in them, sometimes we've seen a cylinder count of only 1023 instead of 1024 for entries ending or beginning beyond 8.4GB; I'm not quite sure why that should occur, but thought you should be aware that some variations still exist in the real world! As a matter of fact, it has recently been found that some new Linux distribution installation programs under certain settings will alter the Head count in a Partition Table to only 16; completely messing up the "geometry" of a drive for programs that depend upon those values!
Now we'll attempt to examine and account for every sector of a more recent hard drive that has a capacity of about 20 GB and was partitioned into a number of file systems for three different OSs!
Computing the Capacity of various Partitions
on a Disk with many OSs
Example: A 20 GB Hard Disk with Three
Different Operating Systems
The BIOS code from
a computer with INT 13 Extensions in place, should display the
size of this drive as: "20492 MB" but this is only an approximate
size. To get the actual capacity (user's area), we need to read the LBA
value on the HDD case (which if you recall from above, this Maxtor drive does
not list), or use a utility program of some kind.
Data from some Drive ID programs plus some calculations provide us with the following information for our 20 GB test HDD:
Make
and Model:
|
Maxtor
5T020H2
|
|
Firmware
Revision:
|
TAH71DP0
|
|
Actual
Sector Count:
|
40,021,632
sectors (LBA).
|
|
Surplus
Sectors:
|
3,717
sectors
(see below)
|
|
Usable
Area:
|
40,017,915
sectors (see below)
|
|
Usable
Area in bytes:
|
20,489,172,480 bytes
|
|
and
in Binary GB:
|
about
19.0820 GiB
|
|
(1
GiB = 1,073,741,824 bytes)
|
Some utilities, such as those that use the data returned by Function 48h of INT 13 (one of the new BIOS Extensions for drives over 8.4 GB), list only 40,017,915 usable sectors for this disk. As a matter of fact, if you open it up with the PTS-Disk Editor, you'll find at the top of the screen: ... sectors 0 - 40017914. Yet WinHex (a commercial disk editor) and some other utilities that are made for Win 2000/XP, correctly identify this drive as having 40,021,632 sectors! Why is there a difference? The answer is due to the fact that most OSs are still laboring under backwards compatibility issues. One of the old rules being: All user data must fit into partitions that both begin and end at a cylinder boundary! Altough this rule doesn't always waste a whole cylinder of space like that archaic test cylinder (see note here), it can come close to doing so. This general boundary rule is based on the number of Heads and Sectors that comprise whole cylinders on a particular drive; even though such references to CHS values are supposed to be "outdated" for newer drives!
WinHex states that the last 3,717 sectors of this disk are Surplus Sectors which leaves us with the 40,017,915 sectors listed by most utility programs. So, how can we figure that out for some other disk? If you divide the actual Number of Sectors (or LBA count listed by a disk manufacturer; 40,021,632 for this one) by 16,065 sectors per cylinder (that's 255 times 63), the quotient almost never comes out even! For this disk drive, the integer part is: 2,491 cylinders, and the remainder is 3,717 sectors. That remainder (or left-over area) is what WinHex calls the Surplus Sectors (which are often never used by an OS). Only some of the most modern OSs may disregard this rule, but when they do, that can cause compatibility problems for a user who boots up to more than one OS on the same drive! For example, If you partition a new drive using Microsoft's Dynamic Disk (instead of the standard Basic Disk), its 2nd, 3rd, etc. partitions are likely to never begin or end on a cylinder boundary. Some of the latest Linux distributions may act the same way if your not careful about deciding how your partitions should be created.
The following is a layout of our example drive as seen in the Windows 2000 Disk Management MMC snap-in:
Here we can see that the example disk has been roughly divided into thirds, for each of the three different OSs installed on it. Since Windows 98 cannot use the NTFS file system and Linux will not disturb system files on any Microsoft® volumes, it's quite safe to use a Primary Partition (those with the dark blue bar over them) for each of the three OSs. The Linux OS was divided into three separate areas: 1) the /boot directory, 2) the Swap File (which has its own file-system type: 82h under Linux) and 3) all the other directories off the root (/). The GREEN border around both the Swap File and Root partitions show that they are Logical volumes within an Extended Partition!
The following discussion shows views of various Partition Tables as interpreted by a disk editor. To see how they actually look (as Hexadecimal bytes) on the drive, open this page: Introduction to Partition Tables.
Let's focus on the Windows 2000 Partition first: It has a Partition Type of 07h, is bootable, and its Volume Boot Record sector is at CHS 0,1,1 which is Absolute Sector 63; don't forget that Absolute sectors start counting with a zero (0), as do cylinders and heads, whereas the Sector value in a CHS entry begins with a 1. The Partition ends at CHS 877,254,63 or: (878 cylinders x 255 heads x 63 sectors) - 1 = Absolute Sector 14,105,069. (You can see that's true by simply subracting 1 from the "Relative Sectors" item in the next partition's entry!) The Length of this partition is clearly shown in the Table as: 14,105,007 sectors. As we point out on our NTFS 5.0/5.1 Boot Sector page, an NTFS Volume is actually one sector less than its Partition Length; and it's inside that last sector of the partition (Absolute Sector 14,105,006 in this case) that you'll find its Backup Boot Sector! What's the size in bytes for this partition's volume? 14,105,006 sectors x 512 bytes per sector = 7,221,763,072 bytes! Dividing that by 1024 cubed (or 1,073,741,824 bytes/GiB) equals: about 6.726 GiB; which is the size you'll see in the Windows Disk Management program. [Only rarely does Microsoft use something other than Binary MB (MiB) and Binary GB (GiB) values.] So, here's a quick summary of this partition's data:
Range: Absolute Sectors
63 - 14,105,069
Length or Total Number of sectors: 14,105,007
Volume size (in NTFS Boot Sector): 14,105,006
Our FAT32 partition has a Partition Type of 0Ch (FAT32 LBA) which means that at least part of it extends past the 8.4 GB mark. It begins at CHS 878,0,1 (which corresponds to Absolute Sector 14,105,070), but the ending CHS values only mean that its last sector is somewhere beyond the 1024th cylinder! In this case, we must work out its actual location using both the "Relative" and "Total Number" of Sectors; which is still rather easy to compute for Primary Partitions: 14,105,070 + 12,289,725 - 1 = Absolute Sector 26,394,794.
Range: Absolute Sectors
14,105,070 - 26,394,794
Length or Total Number of sectors: 12,289,725
Size in Bytes: 6,292,339,200 bytes (5.86 GiB).
As is often the case, the last Absolute Sector of this partition ends up being one sector less than the number of "Relative Sectors" in the next partition's entry, which means there is no unused space between them.
Most utility programs,
however (including PQ's Partition Magic), will calculate a pseudo
set of CHS values having more than 1024 Cylinders. You can figure out
the number of cylinders that PM would like to use for this partition's Ending
Location by dividing its last Absolute sector plus one (26,394,794
+ 1) by 16,065 (255
times 63); which will equal exactly 1643
Cylinders. So, if a value larger than 1023 could actually
be contained in a Partition Table, the Ending Location for this partition
would be:
1642 254
63 (don't forget that cylinder values inside the table begin counting
with a zero, so the total number of cylinders is still 1643).
The /boot partition for our Linux (the Partition Type for a Linux Ext2/Ext3 File System is: 83h) installation begins at Absolute Sector 26,394,795 (or a pseudo-CHS of 1643,0,1). This partition is rather small (only 208,845 sectors; or 106,928,640 bytes; about 102 MiB); ending at Absolute Sector 26,603,639.
How many bytes are there in a single common HDD cylinder today? (There are: 63 x 255 x 512 = 8,225,280 bytes, or about 7.8 MiB, per cylinder). If you divide the size of this Linux partition in bytes by that value (106,928,640 / 8,225,280), you'll get exactly 13 cylinders. Most of the fdisk programs in the Linux (and other OS) worlds simply ask you how many cylinders you want to have for a partition; so here we have just 13 cylinders compared to the 878 for our NTFS partition, or the 765 (6,292,339,200 / 8,225,280) for our FAT32 partition. The summary for our /boot partition is:
Range: Absolute Sectors
26,394,795 - 26,603,639
Length or Total Number of sectors: 208,845
Size in Bytes: 106,928,640 bytes (102 MiB).
The much more interesting (and difficult for some to understand) Extended Partition begins at pseudo-CHS 1656,0,1 (1643 + 13 = 1656). As we pointed out in our Introduction to Partition Tables page, this entry only tells you the total size of the Extended Partition (and where it begins) but you know nothing about what's inside of it until you examine the Extended Partition Table that this entry points to; which could lead you to many other EBRs inside this partition!!!
Range: Absolute Sectors
26,603,640 - 40,017,914
Length or Total Number of sectors: 13,414,275
Size in Bytes: 6,868,108,800 bytes.
We can, however, use this entry to determine if we have any useable space remaining on this hard disk: By adding the length of this partition to its beginning sector, we find that it ends at Absolute Sector 40,017,914 which means there is no more space left; we already found out (see the Drive ID Table above) that the total number of sectors we can use to create partitions is: 40,017,915 (plus 3,717 surplus sectors).
To learn more about this disk, we must jump to Absolute Sector 26,603,640 (CHS = 1656,0,1) where we'll find the first Extended Partition Table:
You can see from the table above, that there is at least one more Extended Partition Table beyond this one! When you find an Extended Partition Table that has only one entry in it, then you'll know you've finally reached the last partition table in the whole daisy-chain of Tables.
Sorry,
but this page is still under construction!
Last Update: May 4, 2005. (04.05.2005)
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