Installing Windows After Ubuntu
Normally when Windows is installed after Ubuntu the “Master Boot Record”, MBR, will be overwritten. You can bootup off a LiveCD and repair the MBR. However, there are 2 different approaches:
1. Recovering GRUB after reinstalling Windows
With the normal default Grub2 this guide should help
The older Grub, sometimes called Grub-legacy or Grub1 was used up until Ubuntu 9.10. The default for 9.10 was Grub1 but installs would drift over to Grub2 without users being aware of the change. With any current Ubuntu install is is wise to install, or re-install Grub2 as shown in the link above.
If you run an older Ubuntu or had any trouble with Grub2 then Grub1 & Lilo are still available. To fix the MBR with an older LiveCD to access a Grub command-line:
1. Boot into a LiveCD
2. Open a terminal
3. Open the GRUB Command-line utility by typing
4. Find where Grub is. If this gives a few different answers then you will need to find the correct one, perhaps by trial-and-error.
5. Tell GRUB which partition to tell the MBR your Grub is on by entering
The coordinates A,B are where ‘A’ is the hard-drive number, starting at 0, and ‘B’ is the partition number, starting at 0. For example, if Ubuntu was installed on the second partition of the first hard-drive, the command should be
6. Tell GRUB which drive’s MBR to fix
Replace 0 only in the extremely unlikely event that your bios does not use the first hard-drive as the boot device. Typically Ubuntu might be on any drive but the bios will almost always go to the first drive’s MBR to find out where to find the boot-loader.
7. Leave the GRUB Command line
2. Master Boot Record backup and re-replacement
Back-up the existing MBR, install Windows, replace your backup overwriting the Windows boot code:
1. Create an NTFS partition for windows (using fdisk, GPartEd or whatever tool you are familiar with)
2. Backup the MBR e.g. dd if=/dev/sda of=/mbr.bin bs=446 count=1
3. Install windows
4. Boot into a LiveCD
5. Mount your root partition in the LiveCD
6. Restore the MBR e.g. dd if=/media/sda/mbr.bin of=/dev/sda bs=446 count=1
7. Restart and Ubuntu will boot
8. Setup grub to boot windows
Issues with Windows XP and NTFS
The Ubuntu installer has included support for resizing NTFS partitions since Ubuntu 5.10 (Breezy Badger) was released way back in 2005. Very few problems have been reported relative to the huge number of times that the installer has been used. If you tried the above procedure and have had no luck, it might be that there is a pre-existing problem either in the file system, in the partition table or the hard disk.
First you should try running CHKDSK before trying again to resize the partition, and if you are using the Alternate CD, defragging might help. It is recommended that you run CHKDSK once again after resizing your NTFS partition.
Also, try the following alternative methods:
Using QtParted from the System Rescue CD
1. Boot into Windows and backup any valuable documents/photos etc onto removable media such as CD-R/DVD-R.
2. Run the Windows disk check tool (Error-checking) on C: a couple of times (the results can be seen in the Administrative Tools > Event Viewer > Application under a “Winlogon” entry).
3. Run the Windows defragmentation tool on C:
4. Download the System Rescue CD ISO image (100 MB; has several very useful software tools).
5. Burn the ISO image to a CD.
6. Boot from the CD and hit Enter when you see the message “Boot:”.
7. When you get a command prompt, enter:
1. Select your disk on the graphical screen (most likely /dev/hda).
2. Select your NTFS partition to be resized (most likely /dev/hda1).
3. Right click with the mouse and choose Resize.
4. Set the new partition size.
5. Commit your changes in the File -> Commit menu. If your keyboard and mouse stop responding during resizing then please just be patient.
6. Once your changes are saved, remove the System Rescue CD and insert your Ubuntu installation CD.
7. Reboot and install Ubuntu into the free space.
Using GParted from UNetbootin-PartedMagic
Another approach to resizing partitions, which does not require a CD, is to load PartedMagic from Windows via the UNetbootin PartedMagic Loader:
1. Download and install the Windows (.exe) file, then reboot.
2. Select the UNetbootin-partedmagic entry after rebooting, and wait as PartedMagic boots up.
3. Start the partition manager by clicking the GParted icon on the the panel.
4. Select your disk (probably /dev/sda) via the drop-down menu on the top-right corner of the interface.
5. Right-click the NTFS partition to be resized (probably /dev/sda1), and select the “resize” option.
6. Drag the slider to specify the new size the NTFS partition should be resized to, then press OK.
7. Press the “Apply” button to resize the disk, then reboot once done.
8. Upon the next Windows boot, click OK when prompted to remove UNetbootin-partedmagic to remove its boot menu entry.
Installing Windows After Ubuntu