Installing Windows After Ubuntu

Of cource you will never need this article.. Because you installed in the right order and put Windows in First then Ubuntu … Right?? 


Me too!! 

This was quite a challenge to a newbie like me. 

After using Ubuntu for a good amount of time I was persuaded to put windows on too for gaming. There are two ways of doing this. I initially tried a virtual machine. Virtual machines we will come back to next time. What I decided to go with eventually was a duel boot system. Because I had installed Ubuntu first I ran into a few problems. I will outline how i fixed them here. 


If you are following this for real Back Up Everything before you start. As ever we accept no responsibility for data loss. Pop the stuff you care about on a USB or burn it to CD. I’ve learnt the hard way that OS are easy to replace. Personel Documents and Photo’s are not.  


The first thing i did was opened GParted. I am not sure if that’s still part of the Ubuntu default so you may need to install it (Ubuntu Software Center). I Shrunk Ubuntu and gave what would be Windows some hard disk space. Remember how big the partition you wish to install is because  then it’s easier to find inside the Windows installer. 


I put the windows XP CD in and allowed the questions to install Windows into the unallocated space (it’s easy to recognise at it wil be the number of GB you allocated in Gparted later.


Without doubt once Windows has installed.. You won’t be able to reload Ubuntu. Windows tends to write over Grub the bootloader needed to determine if you are loading Ubuntu or Windows. What we need to do is repair the boot loader.


Remember the Ubuntu Installation CD. Pop him in and wait.


1st way (Seems easier wish I had tried it)

Thanks to Ask Ubuntu, Open up a terminal (press Ctrl, Alt T) and copy in the following

sudo add-apt-repository -y ppa:yannubuntu/boot-repair; \ sudo apt-get update; \ sudo apt-get install -y boot-repair && boot-repair 

Note: You copy and run them all at once. If you want to run them individually just remove the trailing “; \“.


Here’s how to reinstall Grub  Something i’ve done for various reasons a few times. This way always seems to repair the bootloader. 

The following thanks to with my (i would like to think) more Human description


sudo mount /dev/sdXY /mnt

– SDXY is the hard drive that you want to reinstall Grub to. On a normal install it’s more often then not sda1


Now bind the directories that grub needs access to to detect other operating systems, like so.

– I don’t know but it seems to mke it see the other OS

sudo mount –bind /dev /mnt/dev &&
sudo mount –bind /dev/pts /mnt/dev/pts &&
sudo mount –bind /proc /mnt/proc &&
sudo mount –bind /sys /mnt/sys

Now we jump into that using chroot.

– This is giving the Live CD Root axcess to your install 

Now install, check, and update grub.

This time you only need to add the drive letter (usually a) to replace X, for example: grub-install /dev/sda,grub-install –recheck /dev/sda.

grub-install /dev/sdXgrub-install --recheck /dev/sdX

Now grub is back, all that is left is to exit the chrooted system and unmount everything.

exit &&
sudo umount /mnt/sys &&
sudo umount /mnt/proc &&
sudo umount /mnt/dev/pts &&
sudo umount /mnt/dev &&
sudo umount /mnt


I’ve used this one a few times (usually when cloning machines if Grub gets trampled on) and am forever in the debt of for this information. 


Next time.. We take a look at the virtual machine..