how-to_reinstall_grub

Revision 4 as of 2006-02-11 10:21:00

Clear message

Task name: Re-install GRUB on the MBR

Description: After installing another OS I lost the mbr on my HD (hda with ubuntu on hda7), here is the solution that I found to work.

Procedure:

  • Boot the Ubuntu LIVE CD
  • open a console, and change to user root with

su root
  • Make a temp dir to mount the ubuntu partition with :

mkdir /mnt/hda7
  • Mount the drive with :

mount -t ext2 /dev/hda7 /hda7
  • Chroot to the mounted system with :

chroot /dev/hda7
  • Run grub, then :

grub> root (<tab>

where <tab> is an actual TAB which returns the hd that grub recognises, in my case hd0 hd1 hd2 then :

grub> root (hd0,5)

# in my case the hda7 partition is recognized by grub as (hd0,5)

grub> setup (hd0,5)

grub> exit

then reboot and it works...