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> 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
There are no attachments for this article.
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
ZFS: Remove an existing zfs filesystem
Viewed 582 times since Sun, Jun 3, 2018
How to automate SSH login with password? ssh autologin
Viewed 468 times since Fri, Jun 8, 2018
Viewed 578 times since Fri, Nov 30, 2018
BIND for the Small LAN
Viewed 1131 times since Sun, May 20, 2018
Set Up SSH Tunneling on a Linux / Unix / BSD Server To Bypass NAT
Viewed 87 times since Fri, May 15, 2020
Linux - How to get network speed and statistic of ethernet adapter in Linux
Viewed 497 times since Fri, Jun 8, 2018
Manage SSH Key File With Passphrase
Viewed 536 times since Tue, Mar 5, 2019
Yum Update: DB_RUNRECOVERY Fatal error, run database recovery
Viewed 279 times since Fri, Jan 17, 2020
linux-training.be gives you books for free to study Linux
Viewed 708 times since Sat, Jun 2, 2018
linux manual tools
Viewed 531 times since Fri, Sep 28, 2018