All three methods need a live cd of a linux. You need to boot from the live cd and take the terminal and do the following:
- First method is using grub command. We initially go into the grub mode interface using the command
sudo grubThis will get you a "grub>" prompt (i.e. the grub shell). At grub>. enter these commands
find /boot/grub/stage1If the find returned (hd0,1) then you would enter
root (hd0,1)Now the root drive where the boot folder is mounted.Now we needed to setup the drive to boot to show the grub. We do this by
setup (hd0)Finally exit the grub shell
quitAnd then Reboot to and try if you are getting the grub.
If not try the next method.
- If couldn't get grub to find the stage1 file or even recognize the drive. Use this method.
sudo mkdir /mnt/root
sudo mount -t ext3 /dev/sda6 /mnt/root
Then you have to mount the proc subsystem and udev inside /mnt/root also:
sudo mount -t proc none /mnt/root/proc
sudo mount -o bind /dev /mnt/root/dev
Doing this allows grub to discover your drives. Next you have to chroot:
sudo chroot /mnt/root /bin/bash
Now that you're chrooted into your drive as root everything should work.
sudo grubAnd then follow the 1st method to install the grub.
- In lastest Linux you can use the command grub-install.The usage of this command is as
sudo grub-install /dev/sdaIt might be hda if the hard disk is IDE and sda if disk is SATA.