HPA Problems When Upgrading Hard Disk
Some people will eventually want to upgrade their hard disk to a new disk with larger capacity.
Users should be warned about a unique problem that may occur in certain circumstances.
If you try to replace your hard disk with a larger disk, if you try to clone the contents
of your original disk to the new disk, and if your original disk contains
HPA-based MediaDirect, then you may discover your new disk's
capacity becomes truncated to the size of the original disk.
For example, say you wish to replace your 60 GB disk with a new 120 GB disk. To avoid
reinstalling everything, you decide to use something like Acronis True Image or Symantec
Ghost to clone the contents of the 60 GB disk to the 120 GB disk. When you try to boot
the new disk, however, it blue-screens or fails to boot, and a check of the BIOS settings
shows the BIOS thinks your new disk is around the same size as the old disk!
No amount of recloning, reformatting, repartitioning, or rejumpering will get the BIOS
to recognize the full size of the disk.
During the process of cloning, some utilities will copy the entire first track from
the original disk, which includes the Dell MBR (in LBA Sector 0) and the HPA boot code
(in LBA Sector 3). The problem is caused when both of these sectors are carried over
to the new disk. The problem is avoided if either one or both sectors are
not copied.
(Note to reader: Remember that we are only talking about HPA-based
MediaDirect here. MediaDirect 3 does not use LBA-3 or the HPA.)
How The Dell MBR Works
Here is a play-by-play of what happens when the computer boots with the Dell MBR.
When the machine is off, pressing the power button turns the computer on. Pressing the
MediaDirect button instead turns the computer on and additionally sets a bit in the bios
cmos registers. The computer proceeds through its POST (Power-On Self Test), then turns
to the hard disk and MBR to determine what to do next:
- Begin code in LBA-0. This tests if code exists in LBA-3.
If not, skip to step 6. If yes, continue with step 2.
(Code in LBA-3 means the system is equipped with MD).
- Begin code in LBA-3. This tests whether the MD bit in the cmos is set.
If not, skip to step 4. If yes, continue with step 3.
(The MD bit tells whether or not the MD button was pressed).
- If MD button pressed, prepare to boot MD. Unhide the HPA, save partition table
descriptor #4, replace it with the hidden MD partition descriptor, and set it active.
Skip to step 5.
- If MD button not pressed, prepare to boot normally. Hide the HPA, replace partition
table descriptor #4 with the saved copy (from step 3), and set partition #2 active
(the XP partition).
- Return to LBA-0.
- LBA-0 checks whether Ctrl+F11 is in the keyboard queue.
If not, skip to step 8. If yes, continue with step 7.
- Prepare to boot the DSR partition by changing the DSR partition's descriptor from
'DB' to '0C' and setting it active.
- Check which partition is set active (normally it's partition 2, unless step 3 or 7
changed it), display "Loading PBR x..." on the screen, load that partition's boot
record into memory, and display "done" if the pbr read was successful.
- The MBR's job is now done. Transfer control to the code loaded from the pbr, which
is expected to take over and load the rest of the operating system installed on
that partition--either XP (pbr2), DSR, or MD (pbr4).
The crucial factor is that
LBA-3 has embedded in it the starting location of the HPA.
This information is used in steps 3-4. The starting location will be where the HPA
begins
on the original hard disk. When you install a larger hard disk and copy
LBA-3 (as part of track-0), this number does not get changed. (After all, the cloning
utility has no idea what Dell is doing with LBA-3.)
Thereafter, the first time you boot from the hard disk and the MBR is executed,
step 4 will assume the HPA begins in the same place as it did on the original disk.
All that extra space on the new hard disk will be hidden as part of the (now, super-large) HPA.
Remember, when the HPA is enabled, the true size is kept secret by the disk drive itself.
The computer, XP, and most utilities will think the hard disk is smaller than it actually is.
This BIOS will think your new disk is the same size as the original disk.
Reformatting or repartitioning will not unhide the HPA and give you back your disk space.
The HPA is Difficult to Copy
No cloning utility can copy the contents of a hidden HPA from one hard disk to another.
Many utilities will not even know a HPA exists. Even if you expose the HPA sectors,
utilities will not know there is a MediaDirect partition in there because the existence
of the MediaDirect partition is not recorded in the partition table.
Remember, it's partition descriptor is secretly stored in LBA-3, so unless you manage
to transfer that descriptor into the partition table nobody will know that extra space
at the end of the disk contains a partition.
If you want your new hard disk to include MediaDirect, do a fresh install from the
MediaDirect CD. (Note that reinstalling from CD will not recreate the HPA.
The CD will instead create a regular partition of type D7.)
How To Avoid the Truncation Problem
The problem occurs when the Dell MBR and LBA-3 are both copied to the new disk.
The problem is avoided if either the Dell MBR is not copied, and/or LBA-3 is not copied.
As can be seen from the play-by-play above, the Dell MBR executes LBA-3 if the HPA-hiding
code exists. Eliminate the code in LBA-3 (non-HPA Dell machines have all zeroes in LBA-3)
and there will be no code to hide the HPA. Or eliminate the Dell MBR (replacing it with
a generic Microsoft MBR, for example) and the code in LBA-3, even if exists, will not be
executed.
Remember, the HPA is difficult to recreate. The one and only purpose of LBA-3 is to enable
the HPA. So, if the new disk won't have a HPA there is no reason to keep LBA-3. Use a utility
(such as
Roadkil's Sector Editor)
to overwrite LBA-3 with all zeroes on the original disk before attempting the cloning operation.
The new disk will not get the LBA-3 code, and will not have a HPA or the MediaDirect partition.
The Dell MBR has two purposes: to enable booting the DSR partition, or enable booting
the HPA (via LBA-3). Even with LBA-3 eliminated, the Dell MBR may still be needed if
you plan on copying the DSR partition to the new disk. If you are copying the DSR partition,
keep the Dell MBR and just zero LBA-3. If you are not keeping the DSR partition (or do not
have one to begin with), then there is no reason to keep the Dell MBR at all.
A simple "fdisk /mbr" command executed from a Win98 boot floppy, or the "fixmbr" command
executed from the XP CD's recovery console will replace the Dell MBR with a generic MBR.
How To Repair A Truncated Disk
If you've already made the mistake of copying LBA-3 and had it hide the HPA, then you will
need to take the extra step of unhiding the HPA. Zeroing LBA-3 and recloning will prevent the
HPA from being hidden again in the future, but that will not unhide an already-hidden HPA.
There are several tools that can be used to unhide the HPA and return a hard disk to
its full capacity. These include
Hitachi Feature Tool,
Seagate SeaTools,
Magic Boot Disk (MHDD), and
HDAT2, among others.
Additional Reading