Fried your Master Boot Record?

No worries! You are using GRUB (GRand Unified Bootloader) aren't you?

You should atleast know where your "/boot" partition is installed.

  1. Here is my drive setup and "/boot" is setup in "hda3".
    # df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-LogVol00
                           18G  4.3G   13G  26% /
    /dev/hda3              99M   19M   76M  20% /boot
    none                  506M     0  506M   0% /dev/shm
    
    # fdisk -l
    
    Disk /dev/hda: 60.0 GB, 60011642880 bytes
    255 heads, 63 sectors/track, 7296 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/hda1               1        1044     8385898+   7  HPFS/NTFS
    /dev/hda2            1045        4699    29358787+  83  Linux
    /dev/hda3            4700        4712      104422+  83  Linux
    /dev/hda4            4713        7296    20755980    5  Extended
    /dev/hda5            4713        7296    20755948+  8e  Linux LVM
    
  2. Boot up your handy knoppix and run the below commands [ notes ].
    # su -                    [ root shell ]
    # grub                    [ grub shell ]
    grub> root (hd0,2)        [ specify where /boot partition resides ]
                              [ 3rd primary partition of the 1st HDD ]
                              [ hint: start count from 0 ]
    grub> setup (hd0)         [ install grub in MBR ]
    grub> quit                [ exit the grub shell ]
    # shutdown -r now
    
  3. Here's a one line that will do the same automatically.
    # grub-install hd0
    

    You should now have a shiny new MBR.

Related Reading:

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

find in grub shell

You can also use the find command in grub shell to locate where /boot is located.

grub> find /grub/menu.lst

Once it's located it can also be read via:

grub> cat (hd0,2)/grub/menu.lst

Note: Grub shell also features tab completion just like in a bash shell.

Comment