How To Install Windows 10 Alongside Existing Ubuntu (Step By Step)
On the internet there are a lot of really great articles on how to install Linux(Ubuntu) alongside Windows 10 when you have installed Windows now. Believe or not, but it is much harder to install Windows 10 next to existing Ubuntu than the other way around. That is because during installing Linux Ubuntu, you can select “install Ubuntu alongside Windows” and almost everything will be done for you. Unfortunately, Windows is not as helpful as Ubuntu so part of things should be done by the user. In the given tutorial, I am going to show a step-by-step tutorial on how to install Windows alongside existing Ubuntu.
Details
I have 2 disks: SSD (240GB) and HDD(1TB). My target was to left for Ubuntu whole SSD and 600GB of HDD and create on Windows C: and D: partitions with 200GB each.
Requirements
- 2x USB sticks (recommended at least 8GB, 4GB should be fine)
or
- 1x USB stick (recommended at least 8GB, 4GB should be fine) if you use the approach I from step 1.
Tutorial
1. Create bootable USB sticks
Firstly, of course, you want to have a bootable stick for Windows.
- Attach one of the sticks
- ctrl+alt+t to open a terminal, run GParted. If you don’t have installed, type
sudo apt install gparted
- Find your USB (i.e. by looking at size)
- Be sure to have saved all important files from your sticks because we are gonna format them.
- Mark your stick’s partition, right-click and ‘unmount’. Apply changes to proceed with them.
- Now after right-click you can format it to NTFS file system. Apply changes.
- Remove and attach again stick to mount it.
Great! Now you have prepared stick for Windows 10!
You should have .iso for that system.
- Download .iso for windows 10 from the Microsoft website.
- Install WoeUSB — a program for creating a bootable USB stick.
- Create a bootable USB using straight-forward GUI from WoeUSB.
It can take ~10–20 minutes to finish.
Finished? Great! You have Windows on your USB stick! Now we can move forward.
2. Prepare space for Windows
Now we must resize 1TB partition for Windows space. Generally, there are 2 options:
I) Resizing partition runtime. For details, see:
https://askubuntu.com/questions/24027/how-can-i-resize-an-ext-root-partition-at-runtime
II) Using an additional Linux stick which will be used to resizing.
I will describe the second approach.
- Go to https://xubuntu.org/download/
- Download Xubuntu (why Xubuntu? Because it is a small distribution and there is no need for larger).
Now we are going to install Xubuntu on the second stick so again:
- ctrl+alt+t to open the terminal, run GParted.
- Find your USB (i.e. by looking at size)
- Be sure to have saved all important files from your stick because we are gonna format them.
- Mark your stick, right-click and ‘unmount’.
- Now after the right-click you can format it to the EXT4 file system.
- Remove and attach again stick to mount it.
For creating bootable Linux distributions I really recommend unetbootin.
- Go to https://unetbootin.github.io/.
- Download unetbootin (follow the instruction on the website).
- Create a bootable USB using straight-forward GUI from unetbootin.
- Remove and attach again stick to mount it.
Ok. Now there will be a real roller-coaster ride.
- Be sure you have attached a stick with Xubuntu.
- Find out how to run BIOS on your computer. The most common is to reboot the computer, then pressing `DEL` or `F12` key during turning on but it depends on your machine.
- Run BIOS.
- And now again it depends on your BIOS layout, but you have to find something like BOOT ORDER, find your USB and put that onto first place. Then you can save changes and reboot.
- Now your machine should start booting for USB.
- You will see some Xubuntu icons and options like ‘Install Xubuntu’, ‘Try Xubuntu without installing’ etc. Click on ‘Try Xubuntu without installing’.
- Run terminal (ctrl+alt+t).
- Run GParted.
- Find your partition which you want to resize (in my case HDD 1TB: /dev/sda)
- Right-click, unmount that. Apply changes to proceed with them.
- Again right-click, resize and again apply. It will take some time to finish.
- Now you can mount your old partition again.
- Select unallocated space, create new partition in NTFS file system. Apply.
- Close GParted.
- Type in terminal shutdown 0 to turn off your machine.
- Remove your Linux stick.
3. Installing Windows
If you are here, you have half of the path done!
- Put your Windows stick to your machine.
- Again, go into BIOS, change the boot order so that your Windows USB will be first.
- Save changes and reboot.
- Now, you will see the Windows installation. Proceed with that but stop when asked about type installation.
- Select advanced installation.
- Find your partition. In my case, it was almost empty 400GB.
- Select that and try to install it.
- If fine, just proceed with the installation. But there you could get an error:
Windows cannot be installed to this disk. The selected disk is not of the GPT partition style
If so, follow step 4.
4. (optional) Solving “Windows cannot be installed to this disk.”
You have just got given error:
Windows cannot be installed to this disk. The selected disk is not of the GPT partition style
Don’t panic, solving that is quite easy but costs some work.
- Cancel installation of Windows.
- Remove windows stick.
- Turn on the machine again, now for your old Linux.
- Open terminal (ctrl+alt+t).
- Type sudo gdisk <your problematic space>, in my case it was
sudo gdisk /dev/sda.
- Follow the instruction to make the GPT partition style. Most probably you will have to press w to make GPT and press y to confirm changes.
- Close terminal, open again. Type again
gdisk /dev/sda
- You should see something like that:
usr@usrpc2:~$ sudo gdisk /dev/sda[sudo] password for usr:
GPT fdisk (gdisk) version 1.0.3Partition table scan:MBR: protective
BSD: not present
APM: not present
GPT: presentFound valid GPT with protective MBR; using GPT.
If so, it is great, you have solved the problem!
- Turn off the machine, put your Windows stick and run Windows installation again.
5. Windows configuration
Ok, now you have installed Windows. If you want, it is time to divide your large partition into smaller ones. To do so:
- Use the disk management program from Windows 10.
- Select your partition, shrink that (in my case to 200 GB).
- Select unallocated space, right-click and create a new partition (in my case it was 200GB and D:).
6. GRUB
But what now? Currently, if you reboot your machine… you won’t see Ubuntu! That’s why Microsoft Windows boot manager replaced the BIOS boot order with your old Ubuntu! Of course, each time you want to use system X (Ubuntu or Win10), you can change that order. But there are smarter solutions! Let me introduce you to a GRUB.
What is GRUB? According to Wiki:
GNU GRUB (short for GNU GRand Unified Bootloader, commonly referred to as GRUB) is a boot loader package from the GNU Project, (…) which provides a user the choice to boot one of multiple operating systems installed on a computer or select a specific kernel configuration available on a particular operating system’s partitions.
In other terms, in the use of grub, you will be able to choose whether you want to run Linux or Windows.
And there is some magic. As I said before when you install Ubuntu next to existing Windows, the “install Ubuntu alongside Windows” will do the job for you. In our situation, we have to configure on our own. But it will be quite straightforward because we have a beautiful tool `boot-repair`.
- Turn off machine
- Turn on and go into BIOS.
- Change the boot order to Ubuntu first
- Run your old Ubuntu
- Open terminal, install boot-reapir:
sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get updatesudo apt-get install -y boot-repair && boot-repair
- Run recommended repair.
If successful, you can reboot your machine. Now you will see a GRUB. The list of available options (Windows, Ubuntu, some specials) will be available to choose from.
Congratulations, you can enjoy two systems at the same time!