[nmglug] Restoring MBR

Mars DeLapp jmdelapp at delapp.com
Tue Sep 27 11:10:48 PDT 2005


William D. Nystrom wrote:
> I recently went through the following scenario.
> 
> 1.  Formatted partitions on a new hard drive and installed Fedora Core 3.
> 
> 2.  Installed Windows XP on one of the partitions which clobbered my MBR.
> 
> 3.  Reinstalled Fedora Core 3 because I could not figure out another way
>     to restore my MBR.  I tried the Rescue disk but perhaps I did not know
>     what I was doing.
> 
> Is there an easy way to restore the MBR if it has been clobbered by a
> Windows install?  I'm using grub as my boot loader.
> 
> Thanks,
> 

I just went through this with one of my machines. Here is how I restored the mater boot record (MBR)

Boot with a Knoppix disk or other system rescue disk.

get a root prompt and run grub

	# grub

then set the GRUB's root device to the partition containing the boot directory

	grub> root (hd0,0)

Once you've set the root device correctly, run the command setup

	grub> setup (hd0)

I spent many hours trying to figure this out. For some reason, grub-install would not install grub in the MBR. It is 
supposed to work. I don't know why it would not.
For details see
http://www.gnu.org/software/grub/manual/grub.html#Installing-GRUB-natively

After you get the MBR restored, you might still need to update /boot/grub/menu.lst.
Mount your root partition
	# mkdir /mnt/hda1
	# mount /dev/hda1 /mnt/hda1 -O rw
If boot is on a separate partition, mount it now
	# mount /dev/hda2 /mnt/hda1/boot -O rw
chroot to the root directory
	# chroot /dev/hda1
run update-grub
	# update-grub

All the above assumes your root partition is hda1. Make adjustments as needed.

Mars

-- 
=============================================================
J. Marsden DeLapp, PE
President
DeLapp & Associates, Inc. dba DeLapp Engineering
Providing lighting and power planning, design and analysis services
for commercial, industrial and large residential facilities.
1300 Luisa St Ste 23
Santa Fe NM 87505
(505) 983-5557
http://DeLapp.com
=============================================================





More information about the nmglug mailing list