Many of us have dual-boot system which have Linux and Windows( or any other, say, Mac OSX etc… ) both installed. We have a operating-system-choice screen just after BIOS gets checked, by which we can choose, which OS to load in a session.
This is the Boot Loader (usually GRUB or LiLo). It has some commands (editable) by which it just gets the control from Master Boot Record (MBR) and chainloads the volume boot record (VBR) of the active (primary) partition where the bootable system image resides.
During Linux installation, we have GRUB installed in our system, so it can directly detects the other already installed operating systems in the HDD. Thus it produces the OS-Choice screen at the startup and we can choose which OS to load.
But the problem arises, if we have to reinstall/repair the previous OS in the same partition it was before.
i.e : s’ppose, windows was in C:\ and we’re trying to reinstall windows again on same partition C:\
During installation, every OS overwrites the MBR and keeps it’s fresh copy. So, if you have previously installed the Bootloader (e.g : GRUB ), then it’ll dessapear and you’ll not be able to boot into Linux. After startup, system will directly boot into Windows.
Now, get one point clear that the Linux OS is still intact. you just have lost the pointer how and from where to load it. Because, it was the job of your bootloader installed in MBR and you’ve overwritten the MBR, your bootloader is now history! 😛
Clearly, the solution is to install the bootloader once again so that it can detect both ( even more than 2 ) the OS and give you the sweet OS-Choice screen once again! 😀
Here’s how to do it :
step 1) put your Linux CD/DVD and boot from it in restore mode. After that, if all goes right, it’ll give you a command console.
step 2) type
it loads the system image and present the root console.
step 3) reinstall GRUB into your MBR by typing
/sbin/grub-install /dev/hda (for ATA hard drive )
/sbin/grub-install /dev/sda (for SATA harddrives )
After this reboot the system and you’re done! 😀
NOTE : I have a complication regarding the correct partition of the system images of Linux. I solved it by correcting the GRUB command. Here’s how I did it. 🙂
I went into edit command. there I saw 3 commands. The first command was for selecting the proper partition, the second was for lading the system image, and the third was initrd command.
The first command looked like,
I just edited it to
and everything fell perfectly into place. 🙂
One more thing… The above mentioned procedure will not work if you install windows in any other partitions other than the previous partition in which it originally was. in that case, GRUB will not be able to detect that. 😛
Hope you’ll find this tutorial useful. Wishing you people a smooth sail.
Be wise, Use Linux