Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-13-2004, 02:44 AM   #1
Steve Mading
LQ Newbie
Registered: Oct 2004
Posts: 7

Rep: Reputation: 0
recovering from grub-install /dev/hda1 deleting windows XP boot loader

This is not actually a question. It's a solution. I've gotten so much help over the last few months from google searches that ended up pointing me at, that I thought I'd help give something back by posting a solution to a problem I had. I'm hoping someone else with the same problem ends up benefitting from this in some random google search.

The Problem
Okay, did this ever happen to you?
You're doing a kernel update, and as part of that process you decide to run grub-install,
and you have a dual-boot system with Windows XP on the first partition of the same disk as your linux installation. (for example: windows = /dev/hda1, and linux = /dev/hda2)

And then your stupid habitual fingers, going faster than your brain, make the mistake of typing this:
   grub-install /dev/hda1
when you should have typed this:
   grub-install /dev/hda
And as a result, you've just clobbered your windows XP boot loader. You didn't destroy grub from the MBR, and therefore you still see the grub menu as the first thing when you boot, but now if you pick Windows XP from the menu, nothing happens. It pops you right back to the menu again.

Another symptom of this problem is that you will be unable to mount the windows partition from linux, even if you have the linux ntfs driver in place - the ntfs driver will no longer recognize the partition as being of type ntfs even though it really is.

Well, that's exactly what happened to me. I looked around for a solution but everything I found kept telling me all about the master boot record (MBR) and that's not what I'd clobbered. What I needed to do was put the windows boot loader program back where it was on /dev/hda1.

The Solution

Here is the list of steps that fixed this for me:

0 - Make sure you have both your Windows XP installation CD and your Linux rescue boot CD on hand.

1 - Boot from the Windows XP installation CD. After a few minutes of hardware
discovery, you will get to a menu. Pick "R" - the option to recover an installation.

2 - This dumps you to a recovery C:\> prompt. At this prompt, use BOTH the FIXMBR and FIXBOOT commands (no parameters). Most other online advice just mentions FIXMBR because it is trying to address a simpler problem than what I had.

3 - type
at the recovery prompt - this triggers a reboot - remove the CD and let the machine boot from the hard drive.

4 - Now the system will come up into Windows XP and act as if the Linux partition is not there. Don't worry. It's still there. It's just that the grub boot loader got clobbered. Putting it back is the next step.

5 - After verifying that Windows XP is back again and working, reboot the computer and this time use the linux rescue CD to boot from.

6 - boot into rescue mode (for example, enter "linux rescue" at the boot prompt for redhat or fedora installations.)

7 - mount your linux partition to a temp dir, eg:
mkdir /mnt/my_system
mount -t ext3 /dev/hda2 /mnt/my_system
(Obviously that example assumes your linux partition is /dev/hda2 and that it is of type EXT3. Alter the command appropriately for your system.)

8 - change-root to the system so paths from '/' are on your linux partition and not the rescue CD's ramdisk:
cd /mnt/my_system
chroot /mnt/my_system
9 - Assuming you haven't fiddled with your grub.conf file, it should still be set up correctly the way it was before. To put grub back in charge again instead of Windows' brain-damaged boot loader, re-run grub-install now
grub-install /dev/hda
CAREFUL not to make the same mistake as before by saying /dev/hda1 again. Check, double check, and triple check that you are writing to the device name for the disk as a whole, not to the device name for one of its partitions.

10 - That should do it.
, and give it a try. Your grub menu should be restored as it once was, and if it had an entry for booting into Windows XP that should be working again.
Old 10-13-2004, 05:49 AM   #2
Dark Horizons
LQ Newbie
Registered: Oct 2004
Posts: 6

Rep: Reputation: 0
Ah... methinks he's succeeded in dual boot with NTFS!!

Right if I'm reading this right, you have a dual boot system with the Linux on one partition and yourXP on the other.. the other being NTFS..?

You mention an NTFS far as I knew Linux cant see NTFS in fact the grub Loader on LFRC2 cant see XP if its on a NTFS partition and the formatting used by LFRC2 VFAT cant be seen by windows Xp at boot say the "Linux ntfs driver in place "....There are pages of people here tearing their hair out over this very thing...infact if you look hard enough you notice when you download LFRC2 it says it cant CANT! utilize NTFS partitions or access them ...!!!

I'm not doubting you ...Just do you mind telling every one and their dog here how its done..!

Now I'm ok with the whole master boot thing I guessed that it was the MBR that was the problem... however, I was unable to repair it... I have tried and died on three drives to try to get this right. and you seem to have the solution...Though I'm curious.. when I did it the Loader said other operating sys,, but could not recognize or access it.. I tried recovery in fedora and XP but your right in that respect it screws the MBR. now this is where I have the problem... if there is a NTFS driver available ... does it ship with the core? and why does it not load by default with the loader? thus making every ones problem evaporate? and why does LFRC2 format partitions like its using a combine harvester..!.. it makes a real mess.. one which even if you get your XP working it cant access it?

Can you go thru the sequence of loading LFRC2 onto a Dule boot with the NTFS driver you mention.
with the graphic interface..? if you don't mind. It would solve a lot of peoples problems?
Old 10-13-2004, 02:22 PM   #3
Steve Mading
LQ Newbie
Registered: Oct 2004
Posts: 7

Original Poster
Rep: Reputation: 0
The ntfs driver source code is there, but you need to recompile the kernel to use it.

What the subject says. The kernel that ships with fedora core 2 does have the NTFS driver, but it isn't enabled in the precompiled kernel that installs with the system. You need to build a new kernel to make it work (and coincidentally this is just what I was doing when I issued the incorrect grub-install command that this post is about, although that had nothing to do with the problem).

These exact steps worked for me:
su - root
cd /usr/src/linux-2.6.5-1.358
make menuconfig
    pick: "Code Maturity Level Options"
       set the following flag on (asterisk):
          {*} Prompt for development and/or incomplete code/drivers
       (This might be necessary to get the NTFS option to appear.)
    back the the main menu, pick:
         File Systems ---> DOS/FAT/NT Filesystems ---> 
      Set the following fields this way:
      <M> DOS FAT fs support
      <M>    MSDOS fs support
      <M>    VFAT (Windows-95) fs support
      <M> NTFS file system support
          {*} NTFS debugging support
          {*} NTFS write support
     then exit out and save config.
make clean
make modules
make install
make modules_install
That seemed to be the only thing that worked for me (including all those extra makes to start the build totally clean from scratch. If I did not make clean first, then it didn't seem to work right.

Also, I found out that if you do the above steps, then it turns out you don't need to even run grub-install because the system adds a line to the grub menu for you, for use with your new customized kernel (although after you play with it for a bit to verify it works, you'll still want to alter the default in the grub menu so the new custom kernel is chosen when you timeout the menu (by default it times-out to the previous kernel.)

To verify that it worked, try to look for a file called this:


If you don't see that file after the "make modules_install", then it didn't work.

WARNING: There are numerous warnings all over about how the NTFS driver is unsafe for writing to the disk, and is only safe for reading from the disk. But, these warnings all seem to be referring to much older versions of the driver. I have no idea if it is still true or not. For safety's sake, I am still mounting my ntfs partition as read-only, since that's all I really need it for. (I only use it for copying stuff from windows, like font files, or driver DLL's for use with ndiswrapper.)
Old 10-14-2004, 06:06 AM   #4
Dark Horizons
LQ Newbie
Registered: Oct 2004
Posts: 6

Rep: Reputation: 0
NTFS and networks

OK I think I see what your doing and I suspect I know why its being called unstable Driver. your using VFAT (win95) support hmmm... I think by the look of it , its only going to be good for read only.
Which is why everyones having problems, Its going to take a serious overhaul of the core to read write NTFS. However, Windows 98 I know can read write to XP NTFS drives if its on a network?
I wonder if the same will be for FC2 if its using the same kind of network support ??? with the NTFS driver active. in which case this could be a big problem solver. It may not work for Dual boots to well as a read write but if it can do networking through a NTFS gateway it should be fine...

I'm going to try your solution but on a network see if it will write also. The setup I'm going to use is going to be XPpro as the gateway for the net, and the other computers Linux with the NTFS driver active do one mandrake 10 one FRC2. see which works best...through Ethernet and a hub.

Thanks for posting your solution..I'll let you know how this turns out, now time to get those spare drives
Old 10-14-2004, 03:00 PM   #5
Steve Mading
LQ Newbie
Registered: Oct 2004
Posts: 7

Original Poster
Rep: Reputation: 0
I suspect I know why its being called unstable Driver. your using VFAT (win95) support hmmm... I think by the look of it , its only going to be good for read only.
Not true. I am enabling vfat support in addition to ntfs support. They are two seperately choosable options (for example, it is possible to enable ntfs support without enabling vfat support, and if the ntfs support was through the vfat driver, that shouldn't be possible.)

My reasons for including the other windows filesystems is that I want to be able to read them off of USB keychain "drives". This has nothing to do with trying to read the Windows XP partition.
Old 11-15-2006, 04:18 AM   #6
Ramiro Sánchez
LQ Newbie
Registered: Nov 2006
Posts: 1

Rep: Reputation: 0

I had exactly the same problem described by Steve. Although this is a very old post it made me to recover from my mistake in a few minutes and without losing any of my data that I though it was lost, but I think it can be even easier.

The procedure worked for me only by executing up to the step 2 and running only FIXBOOT, but not FIXMBR, because the execution of grub-install /dev/hda1 should not damage the MBR, only the boot section of the XP installation was damaged.

I suggest to run only FIXBOOT to save even more time to avoid executing the rest of the steps in the proposed solution.
Old 02-22-2010, 07:39 PM   #7
LQ Newbie
Registered: Feb 2010
Posts: 2

Rep: Reputation: 0
I made that mistake, and tried a few other things before I found this fix, including:

Then I tried this fix.
On step 4, instead of windows booting up I get the message:
Windows could not start because of a computer disk hardware configuration problem.
Could not read from the selected boot disk. Check boot path and disk hardware.
Please check the Windows docmuentation about hardware disk configuration and your hardware reference manuals for additional information.

If I could just get to where I can browse files on my ntfs partition to do a backup and then wipe the partition and reinstall that would be satisfactory.
Old 02-22-2010, 07:53 PM   #8
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,981

Rep: Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281
I would suggest you start a new thread rather than resurrecting a cold dead one.
Any modern liveCD should be able to read that NTFS partition if it is valid. If it isn't (valid) you've got some work ahead of you - search LQ for "forensic".


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I add Windows XP to Grub boot loader? LUB997 Linux - Software 29 10-17-2009 11:11 AM
Grub Dual Boot /dev/sda1 /dev/hda1 jono268 Debian 4 01-14-2005 04:54 AM
GRUB boot loader blocking windows boot julienroger Linux - Newbie 3 10-12-2004 01:11 PM
grub-install /dev/hda1 = bad mistake? raedt Linux - General 4 08-17-2003 03:35 AM
How to add a boot record which used to startup windows under my Grub boot loader? yunxiang Linux - Newbie 6 02-01-2003 02:22 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:43 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration