Skip to content

how to recover grub in redhat linux?

Friends !
If your windows boot-loader Get corrupted you can use the windows boot disk to boot your system in recovery console and can run the command
# fixboot
#fixmbr
To repair your windows boot loader. The same i am here going to tell you about linux.

First Thing i am going to corrupt my linux grub. by typing the command.

# dd if=/dev/zero of=/dev/sda bs=1 count=446
— Now what the meaning of the line ?

This is actually a typical dd backup command. well /dev/zero is a special file in Unix-like operating systems that provides as many null characters (ASCII NUL, 0x00) as are read from it. One of the typical uses is to provide a character stream for initializing data storage.
what i did with this command?, i fill null characters in my bootloader where blocksize=1 and it counts in a loop till 446.
so my grub and even MBR both get corrupted and i am able to see the massage ” operating system not found” on my after POST screen when i reboot the system.

Now — 🙂
just insert the RHEL boot disk in your dvd rom and type ‘ linux-rescue’ this will take you in rescue mode and you will find the single mode ‘recovery’ prompt #,
Now one message just above to the # displayed and is saying that :yoursystem is mounted under the /mnt/sysimage directry ‘
so type the command
# chroot /mnt/sysimage
and
#grub-install /dev/sda

a message will tell you about successfully installed and no error found.
simple exit reboot and ………….
chearzzzz :)………………………………….

Leave a Reply

Your email address will not be published. Required fields are marked *