Getting Linux back after Windows reinstallation

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
chroot /mnt/sysimage
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 )
or
/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,
root (hd0,1)
I just edited it to
root (hd0,2)
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

Advertisements

2 thoughts on “Getting Linux back after Windows reinstallation

  1. I was in the midst of trouble to reboot into linux after using WinXP on different partition. Now i just found the answer, the boot loader. Thanks for the command tips for the Sweet OS-Choice.

    R S Nepao

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s