Skyscraper

lunes, 26 de septiembre de 2011

Recovering a CentOS Grub After a Windows Installation

As you well know, the ways that windows uses always rewrite the MBR of the hard drive, I believe that Microsoft do this deliberately. Yesterday I installed a Windows XP in my laptop to do some compatibility test, but after two or three boots I discovered that my Grub is gone.  So I cannot boot CentOS, but not all is lost.

Below I will describe the steps to reinstall the Grub loader in the MBR:

First, boot with the CentOS DVD to access the rescue mode typing "linux rescue" in the command line.


Linux will boot in rescue mode and ask about the read only mode or continue with the rescue mode making changes in the filesystems.  Here is mandatory to select "Continue"


Now, we have a linux command line and the original system mounted under /mnt/sysimage, we need to change the root system with the chroot command to edit and reinstall grub.  In the image I use fdisk, chroot and ls.  The file grub.conf contains all grub texts and target filesystems.


With a simple vi, I added the entry for Windows XP.  In my case Windows resides in /dev/hda1 or (hd0,0)


Save the changes and execute /sbin/grub-install hd0 to install grub in the MBR of the hard disk.


Finally exit the command line or just reboot the system.  After the next boot grub appear (with the changes) as in the next image:



I think the solution also applies to Windows Vista, Windows 7 and I wish that Windows 8 respect the MBR and leave Grub in peace.

1 comentario:

  1. Hello Everyone !

    USA SSN Leads/Fullz available, along with Driving License/ID Number with good connectivity.

    All SSN's are Tested & Verified.

    **DETAILS IN LEADS/FULLZ**

    ->FULL NAME
    ->SSN
    ->DATE OF BIRTH
    ->DRIVING LICENSE NUMBER
    ->ADDRESS WITH ZIP
    ->PHONE NUMBER, EMAIL
    ->EMPLOYEE DETAILS

    *Price for SSN lead $2
    *You can ask for sample before any deal
    *If you buy in bulk, will give you discount
    *Sampling is just for serious buyers

    ->Hope for the long term business
    ->You can buy for your specific states too

    **Contact 24/7**

    Whatsapp > +923172721122

    Email > leads.sellers1212@gmail.com

    Telegram > @leadsupplier

    ICQ > 752822040

    ResponderEliminar