dimanche 17 mai 2009

reinstall grub

Often, when you use windows you will have to format you system because of virus and spyware.

If you are using linux in dual boot with windows, then, grub will be erased and you will not be able to boot to linux.

Fortunately, it is easy to reinstall grub if such situation happens. Just follow these steps:

1. Boot with the installation media (CD/DVD)
2. Choose rescue existing system
3. The system existing will be mounted on /mnt/sysimage
then, execute the following commands

chroot /mnt/sysimage

and then

grub-install /dev/sda

assuming the your fedora system is installed on /dev/sda. You can check this with fdisk -l.



good luck

7 commentaires:

  1. this will install the grub on MBR
    there is also a another method,

    root (hdx,y)
    setup (hdx,y) or (hdx)

    RépondreSupprimer
  2. doesn't seem to be working for me, keep getting "grub-install: command not found" thanks anyhow

    RépondreSupprimer
  3. boot from (almost) any live cd
    # su
    # grub
    grub> device (hd0) /dev/sda (or whatever your disk is)
    grub> root (hd0, 0) (tell it which partition to use)
    grub> setup (hd0)
    grub> quit
    #

    RépondreSupprimer
  4. Ce commentaire a été supprimé par l'auteur.

    RépondreSupprimer
  5. i install centos on existing fedora machine...
    after finish the machine automatically open centos..
    how i want to recover the fedora grub so i have choice to choose fedora or centos (bootlooader)..

    RépondreSupprimer
  6. I suggest you to edit /boot/grub/grub.conf and to put the right entry in default parameter. it is quite easy, juste make a deep look at that file ....

    RépondreSupprimer
  7. tq linuxien..
    i already copy /boot/grub/grub.conf fedora after finish install fedora..

    after that i install centos and paste /boot/grub/grub.conf into centos /boot/grub/grub.conf and restart..

    after restart i have choice either fedora or centos in grub but when i choose fedora got and error 'error 2 : bad file or directory type'.

    RépondreSupprimer