Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to restore Linux after reinstalling Windows?

Status
Not open for further replies.

amihomo

Full Member level 5
Joined
Jan 9, 2007
Messages
287
Helped
66
Reputation
132
Reaction score
43
Trophy points
1,318
Location
PERSIAN Gulf
Activity points
3,115
Hi,
This may be an old question ,but i ask it again:

the problem is when you have linux and Windows on the same hard disk , if you have to re-install widows , you cannot access to your linux OS.
that's because when installing windows , it rewrites the boot data on the MBR of the hard disks and boot information about linux will be erased.
I've read in forums that linux can be restored by re-installing the boot loader (e.g. GRUB in linux fedora core3) using a rescue disk , but i couldn't do that . can anyone teach me how to do that?
 

Ok here it comes:
get knoppix or another live distro and follow these steps from the novell cool solution:

Problem:

Configuring dual boot (SUSE linux, Windows) systems. After installing Windows on a SUSE Linux machine, the MBR will be overwritten and the GRUB screen will not be displayed on booting the system. This article explains how to rescue the system and configure dual boot in SUSE linux 10.1.
Solution:

1. Insert the bootable SUSE 10.1 CD/DVD into the drive and boot the system from the CD. If your system does not boot from the CD, you have to make modifications to the priority of your CD drive in your system's bios boot settings.

2. On booting from the CD, choose the "Rescue System" option. Now image from the CD will be loaded to give you a rescue shell.

3. On the "Rescue login:" prompt enter "root". Now the rescue shell is ready for repair.

4. Run "fdisk -l" to display all the partitions in your harddisk(s). From this you can know on which partition you have installed linux and windows. Suppose if you have connected your harddisk as primary master then all its partition entries will be listed as /dev/hda*. Refer to Notes(1) if your harddisk configuration is different. If you have installed windows on primary partition of your harddisk then you would find an entry like --

"/dev/hda1 * 1 1216 9767488+ c W95 FAT32 (LBA)"

If you have installed SUSE Linux on first logical partition then you would find an entry like --

"/dev/hda5 1217 2432 9767488+ 83 Linux"

5. After determining the partition on which SUSE linux is installed(in this case /dev/hda5), mount the partition.

mount /dev/hda5 /mnt

Now contents of the /mnt directory will correspond to the / directory of your installed SUSE Linux.

6. Open the GRUB's menu file(GRUB is the boot loader, which provides a choice for selecting the OS to boot into when your system is powered on)

vim /mnt/boot/grub/menu.lst

7. Go to the end of this file and add the following entry for windows

title Windows XP
rootnoverify (hd0,0)
chainloader +1(hd0,0)

Save the modifications and close the file. You may get the following Warning message, which can be safely ignored

"Can't write viminfo file /root/.viminfo".

This is because while rescuing we have booted into the readonly filesystem in the CD.

8. Open the device map file of grub and make sure an entry for your hard disk is listed there.

vim /mnt/boot/grub/device.map

In this case you should find the following entry listed:

"(hd0) /dev/hda"

9. Now we are ready for the final step - installing grub. Run the following command:

grub-install --root-directory=/mnt/ /dev/hda

You may have to modify the above command if your hard disk configuration is different. Refer to Notes (1) for details.

On successful installation you should get the following message:

"Installation finished. No error reported"

10. Now we are done with the rescue. Remove the CD from the drive and reboot the system to get GRUB with newly added entries.

Notes:

1. Hard disk configuration to device name mapping:
* Primary Master: /dev/hda
* Primary Slave: /dev/hdb
* Secondary Master: /dev/hdc
* Secondary Slave: /dev/hdd


2. Partition numbers:
* Usually a hard disk is divided into one primary partition and one extended partition. The extended partition is then divided among one or more logical partitions.
* Primary partition of a disk is numbered 1. (like hda1)
* Extended partition of a disk is numbered 2. (like hda2)
* Logical partitions of a disk are numbered starting from 5. (like hda5,hda6)

Environment:

* SUSE Linux 10.1
* Windows

all tho this is for suse linux it shuld work with eny other distro, you can even use knoppix or ubuntu wich include grub.
 

    amihomo

    Points: 2
    Helpful Answer Positive Rating
You could simply re-install the Linux distribution without reformat the Linux partition. Then you get a dual-boot system.
 

Why reinstalling the entire linux os, wich culd take days in order to set up just the way you like it, and you'd need to back up your home directory, and what about rebuilding and installing software that didn't come with your distro via ./configure and make, personaly I'd hate to recompile ns2 wich takes about 20 minuts on my system when reinstalling grub takes 3 minuts?
All you need is to reinstall grub wich can be done from a linux console from eny install media or from a live linux cd like knoppix, ubuntu etc. (when you do this from knoppix or ubuntu you'd need root priveliges, now this is well known but for u gues and gals who don't read manuels to get a root console under these live Debian clones you need to start a console and for knoppix just type su without specyfing a password, and for ubuntu - kubuntu - xbuntu - edubunty use the commande sudo without specifying a root password)
You can even use a suse install cd to reinstall grub for fedora or debian or whatever. ;)
 

hi ,
i think III is right , because re-installing the entire linux takes a long time , and this was my only way to have my linux back , but it took so much time.
if III's method is applicable , it would be very useful and time-saving.
 

I faced the same problem... but i forgot the exact way of how i corrected the problem.... :(
 

Hi
I re-installed my windows XP and used the Fedora Rescue CD to try the III's method described above to restore my linux back . The method worked well by typing a single line command :
grub-install --root-directory=/mnt/ /dev/hda

thanks a lot
 

amihomo said:
if you have to re-install widows , you cannot access to your linux OS.

**broken link removed**

summary:

Have you ever downloaded a whole lot of files under Linux, but when you boot back into Windows you realise that you forgot to copy them onto your NT Drive? Well I did, so I wrote an explorer like program that will allow you to save files from any ext2 or ext3 partition.

**broken link removed**
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top