In a GNU/Linux installed system, the default boot record is handled by GRand Unified Boot Loader or GRUB. Originally written by Erich Boleyn, Grub is considered as one of the best boot loaders available. In many circumstances, a boot record can be changed, i.e., another OS installation is one among them. For example, if you install /upgrade Windows 7 in a GNU/Linux installed machine, the GRub will be replaced by Windows' own boot record. From that point you will not be able to load GNU/Linux from your system. Because Windows' boot loader will never load another OS. However, you can easily recover your grub with only two or three lines of commands. It's very easy, it's not so techy. All you need is to have is a Live CD/DVD of GNU/Linux such as Knoppix. Here is the way to recover your grub.
Note: This weblog is written for Debian based text mode GRub recovery
1. Boot the system with Knoppix
2. type fdisk -l Hit enter to get a rough idea about your partitions and corresponding file systems. And just note down the Linux file systmes in a piece of paper.
3. Type grub
4. Type find /boot/grub/stage1 Hit enter
Note: If you get error message (Error 15: File not found) try another location as,
find /grub/stage1 Hit enter You'll probably get a reply from either of these commands just like (hd0,6)
Note: (hd0,6) is an example. hd0 is the drive; ,6 is the partition.
5. Type setup (hd0) Hit enter
Note: you only give drive number only; not the device number
6. You'll see some lines of codes like
Checking if "/boot/grub/stage1" exists ... no
Checking if "/grub/stage1" exists ... yes
Checking if "/grub/stage2" exists ... yes
Checking if "/boot/e2fs/stage1-5" exists ... yes
Checking if "/boot/e2fs/stage1-5 (hd0)" exists ...
17 sectors embedded succeeded
Running "install /grub/stage1 (hd0)(hd0)1+17P (hd0,6) /grub/stage2 /grub/menu.lst"..
succeeded
Done
IF you can read this message, your grub has recovered.
Now reboot your system.
Remove Knoppix CD.
Boot your hard disk.
Congratulations.
You have recovered your GRand Unified Boot Loader.
Note: This weblog is written for Debian based text mode GRub recovery
1. Boot the system with Knoppix
2. type fdisk -l Hit enter
3. Type grub
4. Type find /boot/grub/stage1 Hit enter
Note: If you get error message (Error 15: File not found) try another location as,
find /grub/stage1
Note: (hd0,6) is an example. hd0 is the drive; ,6 is the partition.
5. Type setup (hd0)
Note: you only give drive number only; not the device number
6. You'll see some lines of codes like
Checking if "/boot/grub/stage1" exists ... no
Checking if "/grub/stage1" exists ... yes
Checking if "/grub/stage2" exists ... yes
Checking if "/boot/e2fs/stage1-5" exists ... yes
Checking if "/boot/e2fs/stage1-5 (hd0)" exists ...
17 sectors embedded succeeded
Running "install /grub/stage1 (hd0)(hd0)1+17P (hd0,6) /grub/stage2 /grub/menu.lst"..
succeeded
Done
IF you can read this message, your grub has recovered.
Now reboot your system.
Remove Knoppix CD.
Boot your hard disk.
Congratulations.
You have recovered your GRand Unified Boot Loader.