Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora Resources > Guides & Solutions (No Questions)
FedoraForum Search

Forgot Password? Join Us!

Guides & Solutions (No Questions) Post your guides here (No links to Blogs accepted). You can also append your comments/questions to a guide, but don't start a new thread to ask a question. Use another forum for that.

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 23rd September 2007, 11:46 PM
stoat Offline
Registered User
 
Join Date: Jun 2006
Posts: 7,550
HOWTO Reinstall XP Without Destroying Fedora When the XP CD Balks

UPDATE 4/27/2011: Since writing this HOWTO several years ago, I've learned how easy it is to backup and restore an entire Fedora system in various ways. It now seems to me that the simplest way to deal with this issue (until XP goes away) is to backup the Fedora system, delete its partitions, re-install XP, and restore the Fedora system from the backup. I am not motivated to test the idea, but I feel certain it would work. Anyway, the original ideas (for the record)...

In a system that dual boots XP and Linux, the XP CD sometimes will not boot when the reinstallation of XP is attempted. XP Setup may halt immediately after displaying "Setup is inspecting your computer's hardware configuration...". This doesn't always happen when Linux partitions are present in the system. But when it does happen, Linux partitions always seem to be present. And removing the Linux partitions universally "cures" the problem. The usual remedies for this well-known but poorly-understood situation include completely wiping all data from the hard drive, destroying the master boot record, or deleting the Linux partitions. Those procedures do work to allow the XP CD to boot again, but what can be done about this problem when destroying a Fedora system is undesirable?

I conducted many tests of various ideas. Below are at least a few of the ideas that worked for me in the limited scenarios in which I was able to make my XP CD balk. I am omitting from here what did not work and what I could not test. The tests that I conducted were always done with Fedora 7 installed with its boot partition as /dev/sda1 on the first drive in the BIOS boot order. XP was either in a partition also on sda or on a separate drive. That is the only way that I can make my XP CD balk. This can happen in the real world when people use a partition manager to create space for Fedora "in front of" an existing XP partition. From reading many posts on this subject, I know that there are other partition layouts in which this problem can happen. But I cannot test every partition scenario that can make an XP CD balk. Therefore these solutions may not work for you.

IMPORTANT: Some of the methods described below require somewhat advanced tweaking abilities and an understanding of both GRUB and NTLoader. The level of detail in the instructions will not suit a complete newbie. Proceed with caution and at your own risk. No promises. No guarantees. I cannot be expected to assist in repairing a system busted by anything here.

WARNING: Some of the procedures described below involve utilities and commands that have the potential to ruin your operating systems and hard drive data. Do not use them unless you thoroughly understand what you are doing or can accept the risk of completely destroying your systems and data.


The Things I Tested for the Balking XP CD


Code:
      The XP CD Setup program halts after
      inspecting the hardware configuration
      and a Linux system is present.
                     |
                     |
                     |
             Is the Linux system
             to  be  preserved?
             /                 \
           No                  Yes
           /                     \
Delete all of the          Are XP and Linux 
Linux partitions.          on the same drive?
Reinstall XP. See          /                \
Note 1.                  Yes                 No 
                         /                    \
             Can  another  drive         Make the XP drive first
             without Linux partitions    in the BIOS boot order.
             be  made  first  in         Reinstall XP. Restore
             the BIOS boot order?        the BIOS boot order.
             /                 \         
           Yes                  No
           /                     \
Make any drive without     Is /dev/sda1 the
Linux partitions first     Linux boot partition?
in the BIOS boot order.    /                \
Reinstall XP. Restore     No                Yes
the BIOS boot order.     /                    \
See Note 2.            ???               Delete the boot partition.
                   Not tested.           Reinstall XP. Restore the
                                         boot partition. See Note 3.
Note 1: Delete all of the Linux partitions. If nothing on the drive needs to be preserved, you may clear the drive by any means including DBAN and destroying the master boot record with zeroes using dd. If only the Linux partitions are to be removed leaving other partitions, use a partition manager such as the GParted LiveCD or fdisk in linux rescue. If LVM physical volumes need to be removed, use fdisk in linux rescue.

Note 2: Make any drive without Linux partitions first in the BIOS boot order. The drive that you make first in the BIOS boot order can be any other drive in the system or even a temporarily installed drive. XP Setup requires that the drive that is first in the BIOS boot order have a compatible active primary partition (NTFS or FAT) for the XP boot loader files. It cannot use a logical partition for this. If a compatible active primary partition is not present when Setup starts, it will stop and require you to make one using its "disk druid". It can be as small as 8MB. If there is no room for a new partition, XP Setup can delete an existing partition to make room, but it cannot resize partitions. When a compatible active primary partition is either found or created on the drive that is now first in the BIOS boot order, XP Setup will copy ntldr, ntdetect.com and boot.ini to the root directory of it. XP Setup will also write new boot code in the master boot record. After reinstalling XP but before you remove the temporary drive or restore the drive boot order, you must copy ntldr, ntdetect.com, and boot.ini to the XP partition. You must also edit the boot.ini file and change the drive number (rdisk value) so that XP will boot when the temporary drive is removed or the drive boot order is restored. All of that file copying and editing work can be done in the newly installed XP system. Then the normal drive order can be restored and the computer rebooted. If you botched any of that file copying and editing work causing XP not to boot, you can access those files from Fedora to fix things.

Note 3: Delete the Fedora boot partition (do not confuse with /boot directory). That allowed the XP CD to boot normally in my tests when the boot partition was /dev/sda1. After XP is reinstalled, the Fedora boot partition can be restored. Moving the boot partition to another drive with a partition manager also worked, but just moving it elsewhere on the same drive did not. I finally found that deleting the Fedora boot partition followed by restoring it after XP was reinstalled was easier than moving the boot partition with a partition manager. The method that I tested is described below. The ext3 Fedora boot partition was /dev/sda1, the NTFS XP partition was /dev/sda2, and the ext3 Fedora root partition was /dev/sda3. I cannot know how this method will work in other scenarios and situations that I did not test. I leave it to you to know whether or not this method is appropriate for you to try. Your partition scenario may require some adjustments to what I did.
  1. Delete the Fedora boot partition using fdisk in linux rescue. IMPORTANT: Write down the Start and End cylinders of the partition as reported by fdisk before deleting the partition.

    Note 3.1: I made an Acronis backup image of the boot partition but didn't need it. I recommend making a backup of your boot partition with imaging software or with dd before deleting it.

  2. Reinstall XP in its same partition.

  3. When XP boots, edit boot.ini to change the partition number so XP will boot when the Fedora boot partition is restored to its original place "in front of" the XP partition. If you botch this causing XP not to boot later when the boot partition is restored, you can access boot.ini from Fedora to fix it.

  4. Reboot into linux rescue.

  5. Restore the Fedora boot partition using fdisk "add a new partition" and using the same first and last cylinders.

    Note 3.2: If the partitions are now renumbered, you will have to use whichever primary partition number is now available (see how to deal with this in the next step). But you must use the same first and last cylinders for the boot partition files to be restored.

  6. Still in fdisk, I used the extra functionality menu of fdisk and "fix partition order" to return my partitions to "disk order". After fixing the partition order, the boot partition was sda1 again. The other partitions were back to their original numbers. WARNING: If you started out with your fdisk partition table entries "not in disk order", using fdisk "fix partition order" now to correct the boot partition after installing XP could "misnumber" the other partitions causing some additional tweaking to be needed.

    Note 3.3: An alternative to fixing the order of the partitions is to leave them that way and instead edit /boot/grub/grub.conf and /etc/fstab for the shifted partitions. I tested this and it works. But I had to edit boot.ini again to change the partition for XP to boot.

  7. Save the fdisk partition table changes with "write table to disk and exit".

  8. Exit linux rescue but reboot right back into linux rescue for the system to use the new partition table.

    Note 3.4: After a reboot back into linux rescue, the files and folders were back in the boot partition since it was restored using the original first and last cylinders. As long as the new partition is created using the same cylinders which were not damaged or changed in the meantime, the boot partition files sort of "auto-restore". I could see them with ls /boot. I confirmed their partition location with the GRUB shell command find /grub/stage1. I did not have to use my Acronis backup image of the partition, but it is still a good idea to make a backup.

  9. Reinstall GRUB in the master boot record if it was there before reinstalling XP.

  10. Exit linux rescue and reboot the computer.

Last edited by stoat; 30th July 2008 at 01:16 AM.
  #2  
Old 24th September 2007, 01:04 AM
FriedChips Offline
Registered User
 
Join Date: Jul 2007
Location: Indiana USA
Posts: 1,715
very nicely laid out and well researched, your effort is well appreciated.
__________________
The answer to all of lifes questions are buried somewhere in the Google search engine.

Code:
[Stephen@localhost ~]$ whatis this?
this?: nothing appropriate
  #3  
Old 24th September 2007, 01:38 AM
Seve Offline
Retired Community Manager
 
Join Date: Oct 2004
Location: The GTA, Ontario, Canada
Age: 56
Posts: 12,371
Hello stoat:
Nice work

Thanks

Seve
__________________
Registered Linux User: #384977
.................................................. ............
See the Links below for more Help and those much wanted extras ... :)
  #4  
Old 24th September 2007, 02:06 AM
leigh123linux
Guest
 
Posts: n/a
Quote:
Originally Posted by Seve
Hello stoat:
Nice work

Thanks

Seve
Hi Seve,

Why don't you give it a sticky

Leigh
  #5  
Old 24th September 2007, 02:42 AM
Seve Offline
Retired Community Manager
 
Join Date: Oct 2004
Location: The GTA, Ontario, Canada
Age: 56
Posts: 12,371
Hello Leigh:
Once I figure out what constitutes a sticky I will get back to you

Seve
__________________
Registered Linux User: #384977
.................................................. ............
See the Links below for more Help and those much wanted extras ... :)
  #6  
Old 24th September 2007, 02:45 AM
leigh123linux
Guest
 
Posts: n/a
Quote:
Originally Posted by Seve
Hello Leigh:
Once I figure out what constitutes a sticky I will get back to you

Seve
A sticky keeps the post at the top of the list in this section ( makes it easier to find )
  #7  
Old 24th September 2007, 02:50 AM
bob Offline
Administrator (yeah, back again)
 
Join Date: Jul 2004
Location: Colton, NY; Junction of Heaven & Earth (also Routes 56 & 68).
Age: 69
Posts: 22,207
(Seve, it's under Thread Tools - "Stick Thread") - I did it, btw.
__________________
Linux & Beer - That TOTALLY Computes!
Registered Linux User #362651


Don't use any of my solutions on working computers or near small children.
  #8  
Old 24th September 2007, 03:34 AM
Seve Offline
Retired Community Manager
 
Join Date: Oct 2004
Location: The GTA, Ontario, Canada
Age: 56
Posts: 12,371
Hello:
Thanks Bob

Leigh:
I probably should have phrased it differently, as I was just was wondering ( to myself) what "merits" a sticky.

Seve
__________________
Registered Linux User: #384977
.................................................. ............
See the Links below for more Help and those much wanted extras ... :)
  #9  
Old 24th September 2007, 04:07 AM
bob Offline
Administrator (yeah, back again)
 
Join Date: Jul 2004
Location: Colton, NY; Junction of Heaven & Earth (also Routes 56 & 68).
Age: 69
Posts: 22,207
A 'sticky' is a thread that would be useful to most people searching the particular Forum and one that's not likely to be out-dated in the next version. It should also be a good tutorial and pretty complete so that it covers most situations. This one fits the bill perfectly.
__________________
Linux & Beer - That TOTALLY Computes!
Registered Linux User #362651


Don't use any of my solutions on working computers or near small children.
  #10  
Old 24th September 2007, 12:27 PM
jonathonp Offline
Registered User
 
Join Date: Oct 2006
Location: Melbourne
Age: 43
Posts: 538
Thanks stoat for your detailed 'how to'! I have been trying to solve this problem for over one year now. I gave up eventually and decided it was best to create a local repository with all extra programs and their dependencies in case i had to reinstall fedora due to this win xp reinstall scenario. At one stage i thought by making the /boot partition a'logical' type would solve the problem. No luck!

I also tried copying the boot partition using 'Acronis Disc Director Suite' to an external USB hard drive making sure the partition that i copy is of the same type eg primary to primary when i copy it back. I had no success with this one after many attempts.I'm not sure creating an image of the /boot will work and i would suggest the other option that you have to be the way to go.

If you could clarify a few points for me please:

Creating the /boot partition with the original first and last cylinders will allow 'linux rescue' to reinstall the missing files.

What about if i just reformat the /boot partition and then reinstall win xp. This way it is not necessary to delete the /boot partition so the partition table should be OK. I know from experience that reformatting the /boot will allow me to reinstall win xp. Now if simply reformatting the /boot partition avoids the possibility of partition table errors then i just need to recreate or 'auto-restore' the /boot files? If you could list the EXACT process here i'm sure a lot of people would really appreciate it.

1. Boot cd/dvd
2. Type at the prompt: linux rescue
3. What happens next?

Installation notes that might be helpful when duel booting Windows Vista, XP and Linux:

http://forums.fedoraforum.org/forum/...943#post873943

johnny

Last edited by jonathonp; 1st October 2007 at 12:36 PM.
  #11  
Old 24th September 2007, 07:59 PM
stoat Offline
Registered User
 
Join Date: Jun 2006
Posts: 7,550
Quote:
Originally Posted by johnnylinux

What about if i just reformat the /boot partition and then reinstall win xp. This way it is not necessary to delete the /boot partition so the partition table should be OK. I know from experience that reformatting the /boot will allow me to reinstall win xp. Now if simply reformatting the /boot partition avoids the possibility of partition table errors then i just need to recreate or 'auto-restore' the /boot files?
The magical "auto-restore" thing I described is meant to apply only to using fdisk to delete the Fedora boot partition and using it again later to create a new partition in the same cylinders without anything occurring to harm the data sitting there while you install XP in the meantime. If you do it that way, the boot partition is magically restored. But if you reformat the boot partition, the data there is gone.

I repeated the experiment on my A31 Thinkpad (sda1=boot, sda2=root, sda3=FAT32, sda4=XP). Deleting the Fedora boot partition was again all that I had to do to get the XP CD to boot and install XP. However, cottsay reported that just deleting the boot partition did not make the XP CD boot in his/her situation. cottsay found that creating an NTFS partition in the place where the boot partition had been resulted in the XP CD booting. But that also will destroy the data there. cottsay did not try restoring the boot partition because no backup was made. cottsay only wanted the XP CD to boot again.

In those two situations (your reformatting the Fedora boot partition and cottsay's creating a new partition in its place) the XP CD may work again, but you must restore the boot partition from a dd backup or a disk image. I tested restoring it from a dd backup. It worked with Fedora booting normally and is only a little more trouble than the magical "auto-restore" trick.

Example of me creating the backup before deleting my sda1 Fedora boot partition:
Code:
dd if=/dev/sda1 of=/mnt/fat32/boot.bin
Example of me restoring from the backup after installing XP and recreating the same sda1 partition:
Code:
dd if=/mnt/fat32/boot.bin of=/dev/sda1

Last edited by stoat; 8th October 2008 at 03:29 PM.
  #12  
Old 1st October 2007, 12:11 PM
jonathonp Offline
Registered User
 
Join Date: Oct 2006
Location: Melbourne
Age: 43
Posts: 538
Thanks for your help and putting me on to 'Acronis true image'. Acronis True Image is an excellent tool and works well. The 'Backup' wizard enables you to select your archive to create an image of the partition or file and copy to your source which in my case was an external USB hard drive . The 'Recovery' wizard allows you to restore the image to the partition. As a result it is just a matter of reformatting the /boot partition, reinstall win XP and restoring the 'acronis image' with the 'acronis rescue media' if you like. This works well if you have multiple Linux systems.

i would prefer though to use the 'dd - convert and copy a file' command as you suggested since the dd command tool enables one to create an exact image of a drive or partition and is open source. The command has many other options as well and is quiet an amazing tool. Here is very good link for the dd command.

http://www.linuxquestions.org/questi...d.php?t=362506

It's a good idea to read carefully as this command has many options and has the potential to trash your system.

By the way the windows XP reinstall scenario doesn't occur with windows XP 64 bit edition and windows vista. It only occurs with the windows XP 32 bit edition.
  #13  
Old 2nd November 2007, 10:47 PM
whiphubley Offline
Registered User
 
Join Date: Jan 2006
Location: UK
Posts: 46
Hi there.

Thanks very much indeed for the info. I'm in this position, but am a tad confused.

My scenario is thus...

I have a box with two IDE drives - hda and hdb.

I originally installed Windows on hda, and then Linux on hdb.

Grub handled everything just fine, and allowed me to dual-boot between the two.

Grub is installed on the MBR of hda.

Here's the problem...

For reasons entirely of my own doing, Windows does not exist anymore and needs to be re-installed onto hda.

I'm fairly sure this will cause problems, and I will no longer be able to boot into Linux.

Now, according to the above, I should make the Windows drive first in the BIOS boot order, reinstall Windows, then restore the BIOS boot order.

But hda is already first in the BIOS boot order, because the MBR of hda already contains stage1 of grub.

This then directs to stage2 - the Linux /boot partition on hdb - which presents the usual grub splash screen, allowing you to boot into either Windows or Linux.

I'm thinking the solution might be this...

1. Save the MBR with "dd if=/dev/hda of=MBRhda.bin bs=512 count=1"

2. Install Windows onto hda.

3. Boot into a Linux rescue / live cd.

4. Restore the MBR with "dd if=MBRhda.bin of=/dev/hda bs=512 count=1"

Does this seem a resonable solution?

Thanks very much.
  #14  
Old 2nd November 2007, 11:27 PM
stoat Offline
Registered User
 
Join Date: Jun 2006
Posts: 7,550
Quote:
Originally Posted by whiphubley

I'm fairly sure this will cause problems, and I will no longer be able to boot into Linux.
Hello whiphubley,

Your words make it sound like you haven't yet tried to reinstall Windows. I would try it first. You may not encounter the problem of your XP CD not booting. As I noted in the first post, it doesn't always happen.

And you are right about problems with your dual boot setup after reinstalling XP. XP Setup will rewrite the boot code in the master boot record of your hard drive causing only XP to boot. But that is a different and unrelated issue from the subject of this thread. For that I recommend that you just proceed with reinstalling XP and let it rewrite the MBR boot code. Then simply reinstall GRUB in the master boot record using your Fedora installation disk and linux rescue. That subject is well documented.

Last edited by stoat; 3rd November 2007 at 02:32 PM.
  #15  
Old 3rd December 2007, 10:31 PM
dancingdog777 Offline
Registered User
 
Join Date: Nov 2007
Location: Bournemouth, Deepest Darkest Dorset.
Posts: 55
There is another way Stoat. Install XP to run IN Linux using Win4Lin.

Thing I don't understand though, is it necessary to still run an anti virus program even though it's within Linux (Fedora in our case)?

Last edited by dancingdog777; 3rd December 2007 at 10:38 PM.
Closed Thread

Tags
balks, destroying, fedora, howto, reinstall

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora (and Linux) Destroying it self shadowen Alpha, Beta & Snapshots Discussions (Fedora 11 Only) 6 11th May 2009 04:11 PM
howto reinstall grub ( after delete vista ) carlainz Using Fedora 1 6th August 2007 12:26 PM
Howto reinstall Grub(boot loader) khunmyo Installation, Upgrades and Live Media 5 10th March 2007 10:00 AM
HowTo Reinstall Windows after loading FC5 pparks1 Guides & Solutions (No Questions) 6 22nd February 2007 11:48 PM


Current GMT-time: 12:16 (Friday, 28-11-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Lyman Orchards Instagram Photos - Restoranas-bravoras PRIE KATEDROS - Hotel Sporting - Vico Equense (Na)