Repair Broken Grub

shape
shape
shape
shape
shape
shape
shape
shape

It is possible to use the grub command to install the boot loader, but not the Grub files in /boot/grub. This can be useful to repair a Grub installation if the boot loader was overwritten or damaged.

  1. Do grub.
  2. Optionally, do find /boot/grub/stage1 to find which partitions have the required Grub files in /boot/grub. If you have a separate partition for /boot, do find /grub/stage1 instead.
  3. Do root [partition using Grub convention] to indicate the partition which has the Grub files in /boot/grub and the /boot/grub/grub.conf configuration file.
  4. Install the boot loader using setup [location of boot loader using Grub convention].
  5. Do quit to leave the Grub program.
 GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename.]

grub> find /boot/grub/stage1
 (hd0,5)
 (hd0,9)

grub> root (hd0,5)
 Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  15 sectors are embedded.
succeeded
 Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p
(hd0,5)/boot/grub/stage2
/boot/grub/grub.conf"... succeeded
Done.

grub> quit

That’s it.

Leave a Reply

Your email address will not be published. Required fields are marked *