Reinstalling a Ubuntu Hardy/ MS Windows XP Dual-Boot system

June 2009


So we want to know whether it can be done: create a dual boot system with Ubuntu Hardy and Windows XP, and then reinstall boot the Ubuntu and the XP unattendedly, each time without harming the other OS...

  1. Preparations

    1. The machine

      We have a PC with a 64-bit CPU, 80GB harddisk, and one NIC.

    2. Installing

      See to figure out how to install a dual boot system.

  2. Reinstalling XP

    After ensuring that both Windows and Linux work, reboot into the XP installer. Start it, and after logging in confirm that you do indeed want to reinstall. The installer will complain that it needs a FAT32 partition instead of the available NTFS[34]. Assure the installer that you do want to replace the existing NTFS with FAT32. It will then warn that a primary partition already exists, and whether you want to create an additional one. You do. What Windows calls the D:-drive is a primary partition, and it should leave that one alone. The installer will make the requested changes and reboot.

    Boot into the XP installer once again, and issue an install again. This time, it should start.

  3. Testing the half-reinstalled system

    Let the system boot into XP and see whether that works. In my case, it did. Also check whether Windows is indeed on the first primary partition of the system, and whether nothing but System Volume INformation is on the second primary partition. In my case, it was, and ther wasn't. Then proceed to Linux.

    The XP installer overwrites the bootsector, and when it installs the bootloader config it doesn't consider the possibility that anyone might ever want to boot anything but XP! Oh well. We can still boot into Linux if we reinstall GRUB.

  4. Installing to the wrong partition

    Reinstalling Windows again didn't change the picture. Converting the second partition to NTFS and reinstalling didn't change the picture. Reinstalling again didn't.

    Now let's see if we can deliberately make the XP installer fail by giving the wrong answers...

    1. Repartitioning again.

      While using the repartition.sh script before reinstalling Linux, have a FAT32 FS created on the second partition.

    2. Formatting D:

      Boot into Windows and reformat D: with FAT32.

    3. Fail to recreate the C:-partition

      Reboot into the XP installer, start the installer, and when it asks REMOVE the NTFS (C:\) Partition to CREATE a FAT-32 Partition? (Y/N), answer Y.

      Now after a while, GDisk will ask: GDISK (Q) A primary DOS partition already exists. Create another? [Y/N]. This happens because the second primary partition, the so-called D:-drive, is a FAT32 partition. If it had been NTFS, the installer wouldn't have asked the question. Apparently, a FAT32 partition qualifies as a DOS partition.

      Now, the sensible thing would be to answer Y here, because we would want to create another primary FAT32 partition: the C:-drive in the first slot. The sensible thing for GDisk to do would have been to just alter the type of that partition, instead of deleting it and then recreating. But it didn't, perhaps because GDisk and Windows as a whole has creating partitions and putting filesystems on them mixed up in terribly convoluted ways. Anyway, let's give the wrong answer here, and see what happens...

      Type N.

      The system will reboot. Make it boot into the XP installer.

    4. Telling the installer that it is ok to install on D:

      This time the system complains that at least 17GB of free disk space is required, even though there is 20GB free on the FAT32 D:-drive, as well as 20GB of unpartitioned free space at the beginning of the disk.

      So press <CTRL><C>, and terminate the batch job, which drops you into a DOS shell without logging you off. Now label D: as the disk to install to by typing: label D: XPINST

      The reinstall the installer by typing: xpinst GO

      [Note]Note

      That does it. Windows will now be installed on the partition in the second slot.

    5. Reinstall Linux to be able to boot Windows

      In order to boot into Windows, Linux can be reinstalled.

So yes, the XP installer can be tricked into installing in the 'wrong' place. It installs into the first primary partition of type Windows FAT32 with a FAT32 filesystem on it that is labelled as XPINST. Which usually, but not always, happens to be the first primary partition. If you expect Windows to be on the first primary partition, make sure that the first primary partition complies with those specs. If you want Windows to be installed on the first partition always, make a script that just puts it there.



[34] Is the D:-drive FAT32 or NTFS?