Regain linux installation


Apr 15, 2004
Installed fedora core 2 a few weeks back on my raptor. Last night I installed xp pro on 40 gig ide and now cant access linux. When it came time to install windows I thought it would be ok since it was on another disk and I could just choose which drive to boot to first through my bios, but when booting from the raptor I get "error loading operating system" so im I'm assuming linux installed the bootloader on the ide drive which was then overwritten by windows. Is there any way getting back to linux short of reinstalling? Thanks.


Elite Member
Jul 4, 2002
It could be that you moved your drives around... In linux the drive names are determined by their relationships to one another.

primary master = /dev/hda
primary slave = /dev/hdb
secondary master = /dev/hdc
secondary slave = /dev/hdd

Then partition names are their number added on to the end of the drive's device name. So, for example, the 3rd partition on secondary master HD would be /dev/hdc3

Then your boot loader is going to have to be fixed, too. Since fedora2 uses the "grub" bootloader by default you will have to deal with that. In grub it's naming sceme goes hd0,1 would be the second partition on the first drive. It's confusing at first, but remember that programmers count starting at zero, not 1. So the first is zero, the second is one, the third of whatever would be 2. Kinda stupid, eh?

So to rescue a non-bootable linux distribution it's pretty simple.

You boot up with a Linux CD. Either a install CD, or a live CD like knoppix, or a rescue CD like trinity (I recommend this, it's only 50 megs or so and has a lot of usefull tools like ntfs partition rescue and undelete options. And can reset admin passwords for Windows and such)

Once you get it booted up you have to switch to a virtual terminal. If your in knoppix or whatever you can use a Xterm, but if your using the install cd you can get to a terminal (like any Linux installation) buy going ctrl-alt-F# were F# = F1-F6. However some install CD's only setup F1 or F2 for you to use.

Then once you get the terminal and are logged in then there are some commands:

mkdir /harddrive
mount /dev/hdb1 /harddrive #to mount the harddrive with your Linux install. The mnt directory on a CD is often used by other stuff...
mount -t proc proc /harddrive/proc
cd /harddrive/
chroot ./

That last bit is the chroot command. Basicly you change root over to the OS on the hard disk. So basicly your sorta running that OS now instead of the one on the CD. That way you can run programs and edit files as if you were booted up in that OS.

You would need to edit the /etc/fstab file to make the harddrive changes known. /etc/fstab is were you get all your information on mount points and what is what. Just change the /dev/hd** names to reflect the changes.

Now to fix grub, I am not completely sure.

I think you may have to run the grub installer program like such.

/sbin/grub-install /dev/hda

This will install grub in the boot record of /dev/hda. Change it to whatever you want to use.

Then edit your grub.conf file. It's located in /boot/grub directory.

In it will be lines like this:

# blah blah blah blah
title Fedora Core (2.6.5-1.358)
root (hd0,0)
kernel blah blah blah
blah blah blah

Change the (hd0,0) stuff to reflect the changes.


All this stuff may not be nessicary if you can get to the grub menu when you boot up (that is when you try to boot up without the cdrom stuff).

You see grub has a command line you can access and has editing features so you can specify the kernel and stuff.

So if you can get to grub when you boot, then hit "e" and that will be the edit mode. Select the Fedora Core entry if that comes up and hit "e" again. (not sure if that will pop up if you only have one entry.)

Then that will put you in editing and then you select the line you want to edit and hit "e" again and change that line to the correct setup. Once it is changed then hit enter, and then when your back to the line selector screen hit "b" to too boot up.

Hope that helps. Even if it isn't the harddrive swapping or moving that caused the issue then you can still have the chroot stuff to get into the OS and change stuff around to try to fix the problem.