RHEL: Reinstalling Boot Loader on the Master Boot Record (MBR)

# Tested on RHEL 5 & 6

# In many cases, the GRUB boot loader can mistakenly be deleted, corrupted or replaced.
# We can manually reinstall GRUB on the master boot record, using either "grub-install"
# or the "grub" prompt.

# Ensure the device.map file located in the /boot/grub directory lists all boot devices
# in the same order detected by system ROM.

# grub-install -----------------------------------------------------------------------------

cat device.map
   # this device map was generated by anaconda
   (hd0)     /dev/cciss/c0d0

# Use the 'grub-install' command pointing to the root device.

grub-install /dev/cciss/c0d0


#  --- OR ---


# "grub" utility ---------------------------------------------------------------------------

# Manually set up the MBR and /boot partition from the grub prompt. (hd0) and (hd0,0) should
# coincide with the results from the "find" command. It may be that "find" command will
# fail showing an error message; if that's the case we can continue with the procedure as
# "find" step is not mandatory

grub
   grub> find /boot/grub/stage1
   grub> root (hd0,0)
   grub> setup (hd0)

# ------------------------------------------------------------------------------------------


# If a crash occurred on the server and GRUB boot loader was lost, this may be recovered by
# booting from a rescue CD.

# After the command prompt is displayed, change the root directory to the OS installation
# by typing this command:

chroot </mnt/sysimage>

# Review the /boot/grub/grub.conf file, as additional entries may be needed for GRUB to control
# additional operating systems.

0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Do you Know These 5 Use of V$session View ?
Viewed 160456 times since Thu, Jun 21, 2018
RHCS: Install a two-node basic cluster
Viewed 11568 times since Sun, Jun 3, 2018
SSL HowTo: Decode CSR
Viewed 5926 times since Mon, Feb 18, 2019
How to Clear RAM Memory Cache, Buffer and Swap Space on Linux
Viewed 4344 times since Mon, Nov 23, 2020
How to run command or code in parallel in bash shell under Linux or Unix
Viewed 4439 times since Tue, Aug 6, 2019
How to manage Linux password expiry with the chage command
Viewed 12148 times since Tue, Sep 11, 2018
Szybkie sprawdzenie zewnętrznego adresu IP i hosta
Viewed 4064 times since Thu, May 24, 2018
How to Migrate from RHEL 8 to CentOS 8
Viewed 4269 times since Fri, May 15, 2020
“Too many authentication failures” with SSH
Viewed 7227 times since Mon, May 21, 2018
RHEL7: How to get started with Firewalld.
Viewed 13425 times since Wed, May 22, 2019