[How To] Fix MBR after installing/uninstalling Windows/Linux in a dual boot 13

Many, who do a dual boot with any Linux and Windows will face the problem of Master Boot Record (MBR). In easier words, one of them (Windows or Linux) wont boot after installing/uninstalling the other. This is a small guide I hope many would find it useful.

FIXING WINDOWS BOOT AFTER UNINSTALLING LINUX

For Windows XP: Boot the installation CD and select repair. Enter your windows installation drive number (shown there) and enter Administrative Password. Now run these two commands there one after the other  — “fixmbr” and “fixboot”. Optionally some people also run “bootcfg /rebuild”. You’re Done.

For Windows Vista: Boot from the installation CD/DVD and enter “Repair Windows” link at the left hand bottom of the dialog. Then go to command prompt . There run “bootrec /fixmbr” and “bootrec /fixboot” commands one after the other. That does it.

FIXING GRUB AFTER INSTALLING WINDOWS

1.Boot from a LiveCD and open the terminal..

2.There enter sudo grub to enter GRUB prompt.

3.Type find /boot/grub/stage1 to find out your Linux partition.

4.Then use the device name that was output in the next command, say (hd0,1). Then the command would be root (hd0,1).

5. After this, say setup (hd0). Replace hd0 with your hard drive.

Now your GRUB should be installed fine. However, your windows’ boot entry may not be in GRUB. You may choose to restore it while still being in your LiveCD or after booting into your hard-drive installed Linux.

To restore it:

1. Open /boot/grub/menu.lst of your Linux partition, in a text editor and get to the bottom where all the list of options to boot are found.

2. Add the following lines with your Windows name in the title and replace (hd0,0) with your own hard drive and partition:

title   Windows 95/98/NT/2000
root   (hd0,0)
makeactive
chainloader+1

3. Save and reboot.

EDIT:

ADDING WINDOWS XP (AND OLDER) OPTIONS TO VISTA’S BOOT LOADER

After installing Windows XP after Windows Vista and after restoring Vista’s bootloader one may find that xp or older windows’ options will not be there. For this please make use of a software called EasyBCD. The installation and operation are self-explainatory. Just click on Add/Remove Entries and add your OS entry. You may also add your linux and mac entries to it. Also there is an option for having a common bootloader using NeoGrub.

If you enjoyed this post, make sure you subscribe to my RSS feed!

13 thoughts on “[How To] Fix MBR after installing/uninstalling Windows/Linux in a dual boot

  1. Reply TheCruisemaniac Oct 29,2008 11:18 am

    Hey Sathya,

    Nice post. Learnt the Unix side of the equation.

    For restoring Windows MBR, I generally dont use fixmbr as I havent yet found it on any of the OEM CD’s that I’ve used ;-).

    Instead, I use a tool called MBRFIX. However, there is a catch, you must be able to boot into the windows partition. And this guy is pretty brute-force in the way it works… :)

    Check it out here: http://www.sysint.no/Download/tabid/162/language/en-US/Default.aspx

  2. Reply Sathya Oct 29,2008 12:51 pm

    Hey Cruise! Bharath’s the author of this post, so credits to him. The catch seems more like Catch-22 as if you are likely to Fix MBR, then your Windows partition isn’t booting, and to use this utility, your Windows must be booting ;-)
    Thanks for the comment!

  3. Reply Reeteshinator Dec 16,2008 8:00 pm

    Hey By “Your linux partition”Do you mean that I should mount my linux partition (say hda3) and then go to the mounted locations /boot etcetc?

  4. Reply Bharath Ram Dec 18,2008 7:01 pm

    @ Reeteshinator

    Your linux partition = the partition where u installed ur linux and wanna restore it

    and s u shud mount it else how else can u access /boot/etcetc ????

  5. Pingback: Linux Switchover Guide

  6. Reply Reeteshinator Dec 23,2008 9:38 pm

    Hmm.. ok, it seems the second step is not required itself.. installing the Grub automatically detects all other installations and adds them.

    i.e a simple grub re-install and restart is more than enough to get the windows things in the list too :D

    • Reply Bharath Ram Dec 25,2008 8:21 am

      I think the second step is required……….
      GRUB install doesnt identify and add other installations…….
      it may detect during linux install but not this way………..

    • Reply Sathya Dec 25,2008 9:40 am

      Don’t know, it depends I guess. Grub has always detected my Windows and existing Linux partitions so I never had to do the second step.

  7. Reply manish Oct 23,2009 3:09 am

    hey awesome trick to repair mbr,also i have a problem i am not able to use my inbuilt bluetooth device in linux becoz i donn’t know how to activate it.i have installed gnome* package it shows bluetooth icon bt by clicking there is nothing response…also how to connect internet using bluetooth in linux help me

  8. Pingback: Blue screen when booting up - partition issue?

  9. Pingback: unostar

  10. Pingback: Please urgent rply needed, booting error

Leave a Reply