Cloning a Dell Hard Disk (HPA Problem)

My (far) better half’s old notebook hard disk was becoming slower and slower with bad sectors; it was 4 years old and was taking quite a long time to both boot and come out of hibernation. The Hitachi tool reported a large number of bad sectors, and it was getting worse, so we decided to change it out.

We bought a new 160 GB Western Digital Scorpio Blue and a 2.5″ SATA -> USB enclosure. I put Norton Ghost on her machine and set off the image, expanding both the C and D drives which were on the disk from their original 40 and 20 GB sizes to 120 and 40 GB respectively.

This took a good few hours as the imager had to re-read all the bad sectors multiple times. After it completed, I swapped out the disks and rebooted. Windows started to boot but NTLDR immediately blue-screened with UNMOUNTABLE BOOT VOLUME.

I re-imaged the disk with Partition Magic, thinking Ghost had messed up, but had the same result.

Now having a disk I was sure had imaged correctly, I booted with Kubuntu Live and ran fdisk. This showed that the disk was showing as 58 GB big, with an invalid partition table.

After using HDAT2 to get low-level info on the disk, it turns out that HPA was active on the disk. HPA – Host Protected Area – is a way of changing the apparent size of a hard disk in order to ‘hide’ a partition at the end of the disk.

I used HDAT2 to remove the HPA flag, and the disk returned to its full size of 160GB.

On the next boot, the problem returned.  Before I explain what happened, the layout of the disk is as follows:

  • Partition 0 is a small Dell utility partition
  • Partition 1 is Windows XP, NTFS,  C:
  • Partition 2 is NTFS D:
  • Partition 3 is beyond the HPA, i.e. hidden (normally), containing Dell MediaDirect.

Dell MediaDirect is triggered off a hardware button which we have never pressed, and we assume boots something used to play CDs, MP3s etc.

So the boot sequence for a normal (non MediaDirect) boot on a Dell notebook seems to be:

  1. Power on via Power button.
  2. MBR/Partition table designates partition 0 (P0) as the boot partition.
  3. P0 boots.
  4. MediaDirect button is not pressed.
  5. Dell loader hides P3 – i.e. sets HPA  active and set to 58 BG to hide it.
  6. Dell loader chain boots P1 (Windows XP).

With MediaDirect active:

  1. Power on via MediaDirect button.
  2. MBR/Partition table designates P0 as the boot partition.
  3. P0 boots.
  4. MediaDirect is pressed (or has been pressed and flagged in the BIOS).
  5. Dell loader unhides P3 by removing HPA (and copies a valid partition table containing P3 in), making the apparent size of the disk the full size (60 GB).
  6. Dell loader chain boots P3 (MediaDirect).

When we transplanted the disk, step 5 from the Normal sequence above re-set the disk size to 58 GB, which was in the middle of the new C:, causing the UNMOUNTABLE BOOT VOLUME from Windows – which was correct:  the partition was far too short — it should have been 120 GB.  The truncated partition was (naturally) not a valid NTFS filesystem.

We don’t need MediaDirect at all, so here’s how I solved it:

  1. Use HDAT2 to remove the HPA, making the disk appear 160 GB on the next boot.
  2. Boot Kubuntu Live from CD immediately.  This is important because if you allow the hard disk boot sequence to commence, it will reset HPA to 58 GB (step 5 from the normal sequence).  If you don’t catch the boot menu in time, and start a boot from disk, reboot and go back to step 1.
  3. Use fdisk in linux to delete P0 (Dell utility) and P3 (Dell MediaDirect),  then nominate P1 as the boot partition. Rewrite the partition table.  You can enlarge partitions later using Partition Magic.
  4. Boot Windows Repair Mode and run bootcfg /scan to ensure Windows knows about all the Windows installations and fixboot to fix up NTLDR.  I can’t remember if I had to run fixmbr or not – try it without first.
  5. Reboot, and Windows should boot from P1.

The problem is, if you don’t know HPA is active (or like me, you didn’t know HPA even existed) you’ll never come up with google search terms to even start to solve the problems.

  • Share/Bookmark
This entry was posted in Hardware and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>