Saturday, August 29, 2009

How to Recover Grub Boot Loader in Linux

Grub Config File

/boot/grub/grub.conf (redhat)
/boot/grub/menu.1st (SuSe)
How to install Grub Boot Loader in Linux

First you need to check partition
List partition using fdisk -l

[root@bg-qa-45 ~]#fdisk -l

Disk /dev/sda: 440.0 GB, 440076861440 bytes
255 heads, 63 sectors/track, 53502 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 7395 59395072 7 HPFS/NTFS
/dev/sda2 7395 11219 30720000 6 FAT16
/dev/sda3 11220 13769 20482875 83 Linux
/dev/sda4 13770 53502 319155322+ 5 Extended
/dev/sda5 13770 14279 4096543+ 82 Linux swap / Solaris

root@bg-qa-45 ~]#grub-install /dev/sda (it will install and i will automatically added to Grub.conf file)
How to Recover Grub Boot Loader in Rescue Mode

Put Linux Boot CD In System and boot from CD
and type Linux Prompt

root@bg-qa-45 ~]Linux rescue

It will ask start networking Yes or No Choose no and continue to Image
change Prompt to
root@bg-qa-45 ~]chroot /mnt/sysimage
[root@bg-qa-45 ~]# fdisk -l
Disk /dev/sda: 440.0 GB, 440076861440 bytes
255 heads, 63 sectors/track, 53502 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 7395 59395072 7 HPFS/NTFS
/dev/sda2 7395 11219 30720000 6 FAT16
/dev/sda3 11220 13769 20482875 83 Linux
/dev/sda4 13770 53502 319155322+ 5 Extended
/dev/sda5 13770 14279 4096543+ 82 Linux swap / Solaris

root@bg-qa-45 ~]grub-install /dev/sda
it will recover Boot loader and you should able to boot OS.

No comments:

Post a Comment