Page 1 of 5 123 ... LastLast
Results 1 to 10 of 44

Thread: HOWTO: Restore GRUB (if your MBR is messed up)

  1. #1
    arnieboy Guest

    HOWTO: Restore GRUB (if your MBR is messed up)

    Written by vnbuddy2002

    Restoring GRUB is quite simple in Ubuntu. Instead of going through all the "gain root access" and playing with shell commands, you can use the Ubuntu installation CD to restore it without going through all kinds of hassles.

    Here are the steps:

    1. Boot your computer up with Ubuntu CD
    2. Go through all the process until you reach "[!!!] Disk Partition"
    3. Select Manual Partition
    4. Mount your appropriate linux partions

    /
    /boot
    swap
    .....

    5. DO NOT FORMAT THEM.
    6. Finish the manual partition
    7. Say "Yes" when it asks you to save the changes
    8. It will give you errors saying that "the system couldn't install ....." after that
    9. Ignore them, keep select "continue" until you get back to the Ubuntu installation menu
    10. Jump to "Install Grub ...."
    11. Once it is finished, just restart your computer

    Good luck!.
    Last edited by arnieboy; June 5th, 2006 at 11:18 PM.

  2. #2
    Join Date
    Aug 2005
    Beans
    211

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    Just an alternative: you can put Grub on floppy.

    I used the method above when something went wrong during my first install (hoary hedgehog). This made me very careful, so at point 10 I choose to put Grub on floppy.

    Edit: I tried this in Breezy and it didnt work for me (dont know why, it could be me, the hardware, or even breezy). This method did work in Breezy:

    Boot from install CD, at the boot promt type: rescue
    Follow some simple instructions (such as type the host name of your computer) and you wil get a menu where you can choose to a partition to mount.

    The root partition of ubuntu is the first partition on my second hard disk, so I choose /dev/discs/disc1/part1.

    At the prompt (sh-3.00#) I typed: ls
    This produced a list of directories, such as boot, that convinced me that I mounted the right partition.

    Mount the floppy disk: mount /dev/fd0
    Install Grub on the floppy disk: sudo grub-install "(fd0)"
    including the qoute signs.

    Note: you can also chose the appropiate partition of your hard disk in case you want to restore your mbr.

    The response was:
    contents device map /bot/grub/device.map
    (fd0) /dev/fd0
    (hd0) /dev/sda
    (hd1) /dev/sdb
    asking if this was correct.
    I typed exit at the prompt because this was correct: ubuntu is on the 2nd sata disk (/dev/sdb).

    In the BIOS I put floppy as first boot device and could boot from foppy again.

    Note: if you need to edit device.map you need a different tutorial. My floppy was already formatted.

    This tutorial looks solid:
    http://www.yolinux.com/TUTORIALS/Lin...sk.html#RESCUE

    I still am booting from floppy because, if necessary, I can reinstall windows and it wont overwrite grub.

    This setup survived a dist-upgrade from hoary to Breezy; the entries for Breezy were added to the floppy automatically.

    I have two hard disks, one for windows and one for Ubuntu, but this should work with one hard disk as well. I suppose you can also use a bootable memory stick.

    Windows wants to be one the first partition on the first hard disk. I did not have to edit grub with the map option to make the windows think it is on the first disk. Windows is on the first hard disk because that is the sequence set in the BIOS. (When you boot from floppy it must be first in the BIOS boot sequence.)

    Note that this setup is not necessary for security, I just find it convienient.
    Last edited by yesplease; October 20th, 2005 at 05:37 PM.

  3. #3
    Join Date
    Aug 2005
    Beans
    428
    Distro
    Hardy Heron (Ubuntu Development)

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    Would you explain how to put grub on a floppy?

  4. #4
    Join Date
    Aug 2005
    Beans
    211

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    Quote Originally Posted by cbudden
    Would you explain how to put grub on a floppy?
    I edited the 2nd post in this tread to include this.
    Last edited by yesplease; October 19th, 2005 at 10:25 PM.

  5. #5
    Join Date
    May 2005
    Location
    Va, USA
    Beans
    428

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    After reinstallign Windows, GRUB is gone. I tried following your instructions, but I cannot get past step 4. How do you mount the partitions? If I go to the Install Grub part of the menu, it just puts me back to the partition manager, and if I hit enter, save changes after selecting my ubuntu partition, it says that it can't find root file system and won't let me continue. How do I put GRUB back?

  6. #6
    arnieboy Guest

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    Quote Originally Posted by Curlydave
    After reinstallign Windows, GRUB is gone. I tried following your instructions, but I cannot get past step 4. How do you mount the partitions? If I go to the Install Grub part of the menu, it just puts me back to the partition manager, and if I hit enter, save changes after selecting my ubuntu partition, it says that it can't find root file system and won't let me continue. How do I put GRUB back?
    u have to set your ubuntu partition as "/" (or the root partition ---> please dont confuse this with /root which is the directory for the root user)

  7. #7
    Join Date
    Feb 2005
    Beans
    209

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    Yes, but how do you mount your partition like that? Tell us how you do that from the partitioning menu.

  8. #8
    Join Date
    Aug 2005
    Beans
    211

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    When you step through the instructions, you will arrive at the partition manager. There you will see that all partitions got general names like /media/hda1, or something like that. Now you have to mount those partitions.

    Select a partition and go to the partition description table (by pressing enter, I think). Select each line in this table and select the correct entry. For example: my root partition is used as ext3, mount point is / and bootable flag must be on. Be sure that you leave the data on the partition (there is an entry for that). Do this for all partitions. (I have / , swap and /home, and you may also have a NTFS partition for WinXP.)

    During this proces nothing is changed, so you can always abort if you are not sure.

  9. #9
    Join Date
    May 2005
    Location
    Va, USA
    Beans
    428

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    Hmm, still can't get it mounted or figureu out how to set it up as "/". If I hit enter on a partition, I get some basic settings, like the option for a boot flag, to wipe it or not etc, but there is no mount or place to put "/". If i hit save after that I get the no root file system error and I can't put on GRUB. Let's say I'm a computer nub who needs basic step-by-step instructions. How do I get from the partition manager to the install-grub section without erasing my partition. (I know how to do it that way, but I can't get it working this way while saving the partition.)

  10. #10
    Join Date
    Aug 2005
    Beans
    211

    Re: HOWTO: Restore GRUB (if your MBR is messed up)

    @ Curlydave: Select the partition where / should be, and go to the 'basic settings'. Select the entry 'mount point' and select '/'. Perhaps you should scroll up or down to see it?

    From my notes: root partition; use as Ext3, format no, mount point /, mount options default, bootable flag on, size x GB.

    Swap partition; use as swap, bootable flag off, size (less than 2 GB). It doesnt matter when swap gets formatted.


    home partition; no notes, there is only one way to do it.

    Remark: /usr is not a user partition.

Page 1 of 5 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •