Destroying the Master Boot Record (MBR) of a hard disk is an easy thing to do. At least I’ve done it a thousand times. Another thousand, I have been told to assist someone to recover.
Here are a few notes:
On an XP machine, with a single boot, or just to restore the MBR, use :
fdisk /fixmbr C:
It maybe something similar (cause I’m not near by an XP machine to test it right now), but you can use fdisk /? to get some help. The problem is how to get a console. One solution is having a HiRen CD nearby. Another is to boot from the XP installation disk into recovery console.
Now if you are on linux and you use grub, things are a little more complicated:
Initially you need a live cd of the same architecture as the hdd-os. If you had 64bit on the hdd, then get the gentoo 64bit live cd. If you had 32bit, get the 32bit live cd.
You will have to mount the hdd partition, so the corresponding filesystem should be supported by the live cd. It maybe necessary to have the mdadm tool so as to be able to mount RAID disks.
One solution maybe to use apt-get on the livecd, but it is better if the live-cd image already supports your filesystem setup.
Now open a terminal and do the following:
[ suppose we have /dev/sda1 : boot, /dev/sda2 : / (root) ]
mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot
mount -rbind /proc /mnt/proc
mount -rbind /sys /mnt/sys
mount -rbind /dev /mnt/dev
Once all the above have been completed we chroot /mnt and run :
sudo grub-install /dev/sda
sudo update-grup
That’s all.
(PS: it maybe necessary to use fdisk to make the boot partition active)