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
RHEL: Route network packets to go out via the same interface they came in
Viewed 2666 times since Sat, Jun 2, 2018
How to remove CTRL-M (^M) characters from a file in Linux
Viewed 2076 times since Thu, Feb 7, 2019
Linux: Disks diagnostic using smartctl
Viewed 14272 times since Wed, Jul 25, 2018
RHEL: Change system’s hostname
Viewed 3039 times since Sun, May 27, 2018
List usernames instead of uids with the ps command for long usernames
Viewed 2033 times since Wed, Jul 25, 2018
RHEL: ACLs basics
Viewed 5759 times since Sun, May 27, 2018
How to disable SSH cipher/ MAC algorithms for Linux and Unix
Viewed 42941 times since Fri, Aug 21, 2020
RHEL7: Create and configure LUKS-encrypted partitions and logical volumes to prompt for password and mount a decrypted file system at boot.
Viewed 10856 times since Mon, Aug 6, 2018
Top 25 Best Linux Performance Monitoring and Debugging Tools
Viewed 6585 times since Sun, Sep 30, 2018
Linux Linux Network Statistics Tools / Commands
Viewed 8705 times since Mon, Sep 21, 2020