Thursday, 18 July 2013

Centos 6/RHEL re-installing the boot loader

Sometimes the boot loader on your Centos 6/RHEL box gets corrupted and you are forced to repair it, this can be done with the installation disc using rescue mode. A few simple steps is all that is required, so first get the disc and boot from it.

Press return key to proceed on all steps.

1. In the main menu choose Rescue Installed System
 

2. On the Language Selection screen, use the Up/Down arrow keys to highlight the preferred language.
 

3. On the Keyboard selection screen, use the up/down arrow keys to select the preferred keyboard setting.

4. On the Rescue Method screen, use the Up and down arrow keys to select Local/DVD as the source.

5.On the Setup Networking screen, use the Up and Down arrow keys to select the preferred keyboard setting.

6.Now we have entered the Rescue screens which includes various confirmation sub-screens. To begin this section, Use the Left and Right arrow keys to choose.

7.On the first sub-screen, choose OK.

8.In the following sub-screen choose OK.

9.On the next screen, choose Start Shell and by using the Tab key, highlight OK.

10.By completing the preceding steps, you will launch a Shell session. You will notice this at the bottom of your display. The current status of the Shell session will read as follow

Starting shell
bash-4.1#

11.At the prompt, type the following 


# chroot /mnt/sysimage

12.Now type the following.

# cd /boot/grub

13. We will now use the fdisk command to find the name of all the current partition. To do this, type the following


# fdisk -l

14. Look for the * symbol in the fdisk listing under boot, and assuming that your boot disk is on/dev/sda1 (change to suit)

# grub-install /dev/sda1

15. If no error is reported the console should respond as follows:

# this device map was generated by anaconda (hd0) /dev/sda
 

16.This message has confirmed that GRUB has now been successfully restored.

# exit
 

reboot