How to restore GRUB to a partition or MBR with an Ubuntu Live CD

One of the most annoying thing about re-install Windows XP in my dual-boot laptop is that MBR is overwritten. In other words, GRUB is lost and I cannot boot my beloved Ubuntu. So, I have to restore it with a few easy steps as follows:

  1. Boot the computer with Ubuntu Live CD.
  2. Once the booting process is finished and you reach the Desktop, open "Terminal"
  3. At the command prompt, enter the command below to load the GRUB shell.
    $ sudo grub
  4. Then, the GRUB shell appears ("grub>"). Now, we have to find out which partition contains GRUB's files. We can do so by enter the following command at the GRUB shell.
    grub> find /boot/grub/stage1

    This command will print the list of partitions which contains the file. In my case, the file exists only in "hd(0,3)".

  5. Now, we have to tell GRUB where the files needed for setup are. So, we execute the "root" command with the partition name from the previous step.
    grub> root (hd0,3)
  6. Run the following command to install GRUB to MBR.
    grub> setup (hd0)
  7. Finally, we have to quit the GRUB shell by executing "quit" command.
    grub> quit
  8. Restart your computer and you will see the GRUB menu again. \@/

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><img> <object> <embed> <param>
  • Lines and paragraphs break automatically.
  • Images can be added to this post.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.
ญาณรักข์ วรรณสาย