The procedures here are to be used when replacing the primary hard drive if no
factory CD/DVD was ever created/provided and the drive is too cooked to repair.
This page assumes a computer with a hidden partition on the primary drive containing a factory
restore image that can usually be invoked by pressing F10 during boot; except in our
case, the drive is being replaced because it's too cooked
The only tools needed are the standard Linux tools fdisk, dd, and hdparm.
The idea is to salvage the Master Boot Record (MBR - absolute sector 0) and the factory restore
partition (usually the first one and MS-DOS Fat-32). The second partition on the drive will
probably be the main partition and probably only part of it will be recoverable.
There are two techniques that can be tried to recover data from the main partition.
The first is to buy and use SpinRite by Gibson Research (grc.com).
The second is to mount the drive and try to copy all those important files that were
not important enough to back up on a regular basis :)
The MBR is 512 bytes long (exactly one sector) and contains both code and data.
The code comes first and is loaded into memory along with the location and size of the
4 allowable primary partitions, after which the bootstrap loader jumps to the code.
(Disassemble it to see how it works. There's not much to it, it simply
examines the four partition tables and loads the first bootable one it finds into memory
and execs it).
No extended partition information is contained in the MBR. Once the old MBR is placed on the
new drive, obviously the location and size of the original partitions is no longer important
(unless the new drive is the same size as the old one -- doubtful) and so can be deleted using
fdisk. Deleting partitions with fdisk doesn't actually delete partitions, just their meta data
in the MBR.
OK, Here we go. Fill in the blanks as you come to them :)
![]() |
This site best viewed with a browser |
| Warning: This is a Debian centric site | |
| Many thanks to Debra and Ian Murdock for making Debian possible | |
| First created Apr 22, 2008 ~ Last revised August 24, 2009 |