How to reinstall windows after installing linux

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

  1. First you installed windows XP.
  2. Then installed Linux flavor like Fedora or Ubuntu.
  3. XP corrupted due to virus or any other reason.
  4. Now you have problem reinstalling XP, yet you don’t want to format your any of the Linux partition.

Material required

  1. 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.
  2. Windows XP installation CD (which you want to install).
  3. Windows 98 bootable CD (needed to boot the computer).

Procedure to follow

  1. Backup all your data, [ NOTE : this is the most important step].
  2. Backup your boot loader configuration, ex: “menu.lst” in case of GRUB.
  3. 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].
  4. Boot your Linux, you can also use Ubuntu live CD’s (last time I used Ubuntu 8.10).
  5. 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.
  6. Insert the windows XP installation CD into the computer, and copy the “I386” folder to your newly formatted partition.
  7. Copy the smartdrv.exe to the same partition.
  8. Now insert the windows 98 installation CD and reboot the PC with this CD.
  9. Go to the newly formatted partition and run the “smartdrv.exe” on the command line.
  10. Change directory to “I386” directory.
  11. Now run the “winnt.exe” from command line.
  12. An installation of windows XP will begin in 16 bit mode.
  13. You will be asked to choose some settings, most of which are already in correct form.
  14. Start the installation.
  15. After the installation is over in 16 bit mode (which is essentially copying of files), you will be asked to reboot the computer again.
  16. Reboot the pc this time without the windows 98 CD.
  17. Windows XP installation in 32 bit mode will begin (as normal way that we experience when installing from CD).
  18. Reboot your PC to a fresh installed XP.
  19. 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…

View Comments

  • 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.

Share
Published by
Vimal Patel
Tags: fedora General linux Operating System ubuntu windows windows xp

Recent Posts

  • Java

Java URL Encoder/Decoder Example

Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…

5 years ago
  • General

How to Show Multiple Examples in OpenAPI Spec

Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…

5 years ago
  • General

How to Run Local WordPress using Docker

Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…

5 years ago
  • Java

Create and Validate JWT Token in Java using JJWT

1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…

5 years ago
  • Spring Boot

Spring Boot GraphQL Subscription Realtime API

GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…

5 years ago
  • Spring Boot

Spring Boot DynamoDB Integration Test using Testcontainers

1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…

5 years ago