Installing Windows After Ubuntu

The main purpose of this article is to show how to install Linux first and then Windows for obtaining a dual boot configuration and avoiding the downsides of the easier and more common way which is having Windows installed first and then Linux (downsides which are briefly described in the chapter The classic way - Install Windows first and then Linux). The steps presented in this article can also be used when we have to reinstall Windows on a system which has Linux installed also, without losing access to the Linux installation.

Having both operating systems requires a bootloader that allows the user to choose which operating system he may want to run. A bootloader is made of a set of instructions which are run before starting to load any operating system. This small program detects what operating systems are available on the computer, which one to load (depending on the user's selection, if there are more operating systems present) and from what location (which partition) should the loading begin. Both operating systems – Linux and Windows – have bootloaders, but the one used by Windows is not that flexible and most probably it will not recognize other operating systems other than Windows type ones.

To obtain a dual boot configuration with Linux and Windows there are two options:

  1. The classic way - Install Windows first and then Linux
  2. Install Linux first and then install Windows.

The classic way - Install Windows first and then Linux

This is the classic way and the simplest way to achieve the purpose of having both operating systems on the same computer, especially with newer versions of Linux like Ubuntu (which will be used in this article, more exactly Ubuntu 13.10). This is due to the fact that when installing Ubuntu after having a version of Windows installed, it will install its own bootloader. The Linux bootloader installed by Ubuntu is more flexible and can detect the Windows operating system immediately after Ubuntu has been installed. The user will have the option to choose between Ubuntu and Windows.

But, this option has 2 downsides:

  • the first downside is that if at some point in time we need to reinstall Windows, in the process of reinstalling it, it is most probably that we will lose the bootloader set by Ubuntu as it will be overwritten by Windows' bootloader. So we would lose access to Ubuntu.
  • The second downside (which is more geeky and it is more visible on computers with slow hard drives) is that, because Windows will be installed at the beginning of the hard disk, Ubuntu will be installed in the partitions at the end or from the middle to the end of the disk. This will require a slightly higher time to access files and load the Linux system and this is not nice if we are Linux users and we only need Windows for a few tasks which can not be done with Linux. (Probably now Linux users will ask “what is there that can't be done in Linux?” The answer is that unfortunately there still are devices for which the manufacturer did not write Linux drivers. For example a CCD camera which has drivers only for Windows and cannot be used in Ubuntu, or not in a easy way, without the user having to write his own driver or recompile the kernel. It's not impossible, but it's not trivial).

So, to avoid the above mentioned downsides, the solution would be option number 2: installing Linux first and then installing Windows. Further in the article it will be shown, step by step, how that can be done easily.

Install Linux first and then install Windows

Important: Whichever of the steps you may decide to use, do not forget to BACK UP your important data! The steps presented below have been tested on a system but there is no guarantee that they will work flawless on all systems and in all conditions. So, because it's better to be safe than sorry, it is highly recommended to backup all your data before proceeding.

Also, if you already had a dual boot system (containing Linux Ubuntu and Windows) and recently reinstalled Windows and you cannot access Ubuntu anymore, you can skip to step 3 and try to repair your bootloader.

For this demonstration we will use Ubuntu 13.10 (as mentioned above already) and Windows 7.

The main steps of this strategy are the following:

  1. Installing Ubuntu 13.10 normally using the on-screen instructions
  2. Installing Windows 7 on a partition at the end of the drive using the on-screen steps
  3. Repair the bootloader, as the Windows installation has overwritten our bootloader installed by Ubuntu

1. Installing Ubuntu 13.10 normally using the on-screen instructions

We will need to pay some attention to the creation of the partitions to be sure we have enough space for both operating systems and that we do not run out of primary partitions. Windows 7 will require at least 2 primary partitions for installing (one as the main partition and one system partition which will be around 100 MB and which will be automatically created by the installer).

When prompted to chose the modality to install Ubuntu, we will choose the option “Something else”. This will display a partition manager from where we will be able to create the needed partitions. There are many partition schemes possible when setting up the partitions in Linux. On this subject there can be a lot of debate, so, here we will present one scheme without considering it the best.

  • create a primary partition and map it as the root partition (/);
  • create a logical partition and map it as the boot partition (/boot). This is not strictly necessary, but in this article we will include it in the steps. It should work the same way without a separate boot partition, but that case is not covered up now. Around 500 MB should be enough for this partition;
  • create a logical partition and map it as the home partition (/home). This step is also optional. If we decide not to have a /home partition, the home directory will reside in the / (root) partition together with all the rest of the information. Having a separate /home partition may be useful if we'll ever reinstall Ubuntu because we won't lose our personal data, movies, pictures and whatever we decide to put in the /home partition;
  • create another logical partition and set it as swap. The general rule for swap partitions is to have the size at least equal to the size of the RAM memory installed on the computer. (If the RAM size is very large, the swap could be smaller, but then you might not be able to use some features like hibernation).

These partitions should be enough for installing Ubuntu 13.10. The sizes of the partitions (where not mentioned) are left for the user to be decided taking in consideration his needs.

After these steps we should get something like this:

We have left some free space at the end of the disk which is not partitioned. This space we will use for installing Windows. It does not need to be formatted at this time as it will be formatted by the Windows installer later.

As it can be seen, we have used only 2 primary partitions out of 4 available on a hard disk. The first one is used for the / (root) partition, And the second one is used to create logical partitions inside (sda5, sda6 and sda7 are logical partitions which reside within a primary partition, sda2 which is not visible here). Unfortunately, Ubuntu doesn't seem to allow us to install (set the root partition) in a logical one, and that's why we needed a separate primary partition for the root.

After setting up the partitions, we will continue with the normal installation of Ubuntu (following the steps on-screen) and then go to step 2 for installing Windows.

2. Installing Windows 7 on a partition at the end of the drive using the on-screen steps

After finishing installing Ubuntu 13.10, we will insert the Windows 7 bootable CD / DVD, boot from it, and start installing it. When prompted for what installing option to use we will choose “Custom / Advanced”.

When we get at the partition manager, we will have to create a new partition in the remaining space (choose “New”, and enter the size of the partition). This will be the partition where Windows 7 will be installed. This will also be a primary partition, because the partition manager provided by the Windows 7 installer does not allow us to create logical partitions. Also, Windows 7 may require to be installed in a primary partition as well as Ubuntu does. This partition can use all the free space left on the hard disk. Before creating this partition, you will be prompted to allow Windows to create a System partition of about 100 MB. This will be considered also a primary partition.

So, after this step, we have added 2 more primary partitions to the hard disk and we have used all the available primary partitions (that's why it was important not to spread Ubuntu on too many primary partitions).

Next, we'll continue with installing Windows 7 normally, and after that, go to step 3.

3. Repair the bootloader, as the Windows installation has overwritten our bootloader installed by Ubuntu

This will be done very easy using the Ubuntu Live CD. We will insert again the Ubuntu 13.10 CD and boot from it. It is important to use as a Live CD the same version of Ubuntu as the one that we want to fix, to avoid potential differences between versions. We'll select the option “Try Ubuntu” when prompted to either install or try Ubuntu. After loading, we should follow the next steps:

  • install the boot-repair application which will fix our boot loader:

    we'll open a terminal (by searching for “Terminal” in the Ubuntu search box or by using CTRL + ALT + T), and insert the following simple instructions to download the boot-repair program (an internet connection is required):

	sudo add-apt-repository ppa:yannubuntu/boot-repair

this command will add the “yannubuntu” repository from which we will download the “boot-repair” application.

We will press ENTER and we will continue with the following commands:

	sudo apt-get update

we have got the updates from the repository and we are ready to install the boot-repair.

	sudo apt-get install boot-repair

We will press Y to confirm the installation and wait for it to complete.

  • run boot-repair (either type in the terminal “boot-repair &” (without quotes), or from the system. A GUI application will start.

Because we have chosen to use a separate boot partition, the boot-repair application has detected it, and it informs us that we have some more options from which to choose for the repairing process. But, we will go with the defaults as they are enough for what we want to achieve. We will click OK and move to the next step.

  • in the new opened window we will be able to choose between the options “Recommended Repair” and “Advanced Options” (like in the picture below). We'll choose the first option and then follow the on-screen instructions.

After selecting “Recommended repair”, the repairing process will take several minutes depending of the speed of the system.

  • when finished, we will be prompted with a message informing us that the process has completed and restarting the system will be necessary for changes to take effect. We will also be provided with an URL to refer any potential issues to the fixing team by mail.

After rebooting the computer, a screen like the one below should be visible allowing us to select one of the installed operating systems: Ubuntu 13.10 or Windows 7:

From here, if we choose the first option we will boot in Ubuntu 13.10. This is also the default option if we do not choose anything for 10 seconds. For Windows 7 we can choose either one of the 2 options below saying Windows 7 (loader) (there are 2 options because of Windows' system partition which also contains a loader, but they both point to the same Windows installation).

We have finished the steps needed to obtain what we have proposed in the beginning of the article, and if nothing has gone wrong, we have now Linux Ubuntu 13.10 installed first and Windows 7 after.

Computing | How To | Systems

QR Code
QR Code installing_windows_after_ubuntu (generated for current page)