No one here needs to be reminded how virus prone windows environment is, and in case if you face a situation where you have corrupted your C: partition, then first solution that comes to mind is format active partition and reinstalling the windows.
But if you had already installed Linux after installing windows. and wish to reinstall XP then you are in a hang, as windows XP installation CD will not boot up properly with Linux installed on same system.
I have faced this situation many times; the XP installation will just hang after displaying
“Detecting your hardware configuration”…
A work around to this problem dose exists.
Now I will just jot out the materials and steps required to reinstall XP in a hard disk with a Linux already installed.
Problem
- First you installed windows XP.
- Then installed Linux flavor like Fedora or Ubuntu.
- XP corrupted due to virus or any other reason.
- Now you have problem reinstalling XP, yet you don’t want to format your any of the Linux partition.
Material required
- Smartdrv.exe (you can find this in the windows 98 installation CD or download it from internet). This is a driver that will enable fast copying of data in 16 bit mode.
- Windows XP installation CD (which you want to install).
- Windows 98 bootable CD (needed to boot the computer).
Procedure to follow
- Backup all your data, [ NOTE : this is the most important step].
- Backup your boot loader configuration, ex: “menu.lst” in case of GRUB.
- Find out how to recover a boot loader for your flavor of Linux, this example considers Fedora & Ubuntu installed along with a corrupt XP [NOTE: step 2 & 3 are second most important steps].
- Boot your Linux, you can also use Ubuntu live CD’s (last time I used Ubuntu 8.10).
- Format the corrupted/virus effected partition with fat32 file system. You can do this easily using Parted or Gparted which is a GUI front end to Parted.
- Insert the windows XP installation CD into the computer, and copy the “I386” folder to your newly formatted partition.
- Copy the smartdrv.exe to the same partition.
- Now insert the windows 98 installation CD and reboot the PC with this CD.
- Go to the newly formatted partition and run the “smartdrv.exe” on the command line.
- Change directory to “I386” directory.
- Now run the “winnt.exe” from command line.
- An installation of windows XP will begin in 16 bit mode.
- You will be asked to choose some settings, most of which are already in correct form.
- Start the installation.
- After the installation is over in 16 bit mode (which is essentially copying of files), you will be asked to reboot the computer again.
- Reboot the pc this time without the windows 98 CD.
- Windows XP installation in 32 bit mode will begin (as normal way that we experience when installing from CD).
- Reboot your PC to a fresh installed XP.
- Now to get your GRUB boot loader back you can use the Ubuntu live CD or Fedora installation DVD to upgrade the currently installed fedora (which ever your Linux version be, there is usually some method to recover a boot loader in the installation media).
Voila…
Wow… amazing post.. Really.
We would have never done that much R&D to install XP..!! Really appreciate your effort in writing the post.
NOTE: during installation please don’t format the whole drive, choose option that says “leave the file system intact”
WOW! Thanks a lot for this useful info.
After searching all kinds of phrases in Google, I finally landed on ur blog. I was having the same problem, and now i have a solution — Thanks to you.
I have just 1 question? Will this method work if i have an ntfs partition on C: ? Will the win98 bootable cd recognize my ntfs C drive?
I installed XP on a second harddisk with a NTFS partition. First I made a backup of the MBR from the bootdisk with dd if=/dev/hda of=/boot/boot.MBR bs=512 count=1
I copied the boot.MBR to the second disk as a backup. Then I Installed xp with a xp install cd because I installed xp on the second drive which was not the bootdrive xp insisted a system partition on the bootdrive so I temporarely deleted the swap partition and created a 8 MB system partition for XP. After XP installation I booted with a Gparted live cd. Reinstalled the MBR on the bootdrive. Through mounting of the ntfs partion on the second drive with XP and the backup of the MBR I also could have mounted my linux partition or put the MBR on a floppy or usb stick. dd if=/home/disk/boot.MBR of=/dev/hda bs=512 count=1. and I recreated my swap partition. I use lilo so I added to lilo
Other=/dev/sda1
Label=windows
table=/dev/sda
and then rerun lilo et voila linux on disk 1 and xp on disk 2
There is a error in the message above. When you recreate the swap partition you can’t boot windows anymore. A workaround. After xp installation copy ntldr ,boot.ini and ntdetect.com from the system partition on the boot disk to the partition with xp. edit boot.ini and change rdisk(1) to rdisk(0) in both lines. Add to lilo
Other=/dev/sda1
Label=windows
boot-as=0x80
recreate your swap partition and rerun lilo now it should work.