Recover Gnu/Linux Boot loader

Author:

This is to be done when you need to recover the Gnu/Linux boot loader after another OS has erased the previous boot loader

most of the Gnu/Linux distros have rescue mode
lookout for that option when you boot from the 1st Cd of that distro.
you will end up at some shell prompt with some directions about your current system image
you can follow those instructions to recover the Gnu/Linux loader

this document will help you to recover the Gnu/Linux loader for any distro and any version

boot from a Gnu/Linux rescue CD or any Live CD
when you are at the shell prompt

run this

#fdisk -l

you will get some entry like this

?? Device Boot?????
Start????????
End????? Blocks?? Id? System
/dev/hda1??
*??????????
1????????
510???? 4096543+?? b? W95 FAT32
/dev/hda2????????????
511???????
1096???? 4707045?? 83? Gnu/Linux
/dev/hda3???????????
1097???????
1797???? 5630782+? 83? Gnu/Linux
/dev/hda4???????????
1798??????? 4865???
24643710??? f? W95 Ext’d (LBA)
/dev/hda5???????????
1798???????
2243???? 3582463+?? 7? HPFS/NTFS
/dev/hda6???????????
2244???????
2753???? 4096543+?? b? W95 FAT32
/dev/hda7???????????
2754??????? 4347???
12803773+?? b? W95 FAT32
/dev/hda8???????????
4348???????
4865???? 4160803+? 83? Gnu/Linux

since i have multiple Gnu/Linux FS partitions so i have more than one entry here,
this may not be the case for you ,or if it is then you need to identify your root (/) partition

Bow i know that my root(/) for my Gnu/Linux installation is /dev/hda3

so i will make a dir in anywhere ,say in the /tmp directory

# mkdir /tmp/mnt

then mount your Gnu/Linux installation there

# mount /dev/hda3 /tmp/mnt/

then chroot to that partition

if everything is right then you will end up here

# chroot /tmp/mnt/
root@gaurav/ #??

most Gnu/Linux rescue modes will leave you to this stage ,so the below directions are common for all distros.

then if you had grub installed earlier the go for re-installing grub as

# grub-install /dev/hda

or if you have lilo installed
you can check lilo installation by

# lilo -t

this will only check if the lilo boot loader will be installed without any errors and will not install lilo.

and to install lilo
run

#lilo

read
man lilo
for more information on lilo

after this u can exit from the Gnu/Linux rescue mode and go for a reboot .

Leave a Reply

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