Dual booting Ubuntu and Windows will provide you the best of both worlds without having to virtualize either of them. This means you get the full to use the full potential of both operating systems without any compromise.
1. Backup Your data
It is very important that you backup your system before you do anything. Even though the process is pretty straightforward and harmless, there is a possibility for something to go wrong so having a backup of your files will ensure you do not lose anything when something does go wrong. So backup your files to an external drive.
2. Have a Windows recovery CD/DVD available
If something does go wrong, you may need to reinstall your Windows OS again. Microsoft does provide a tool to download and make a bootable drive. You may also use the recovery partition most OEMs.
There are two ways of setting up your dual boot –
Install Ubuntu after Windows 10
From my experience, this is the best approach to dual-boot Windows 10 and Ubuntu. Windows installation does not really play nice with existing Linux installations but your Ubuntu will handle your existing installation of Windows very well.
Follow the following steps to dual boot Windows 10 –
- Make sure you have Windows 10 installed and running on your PC.
- [OPTIONAL] You can prepare your disk by making available a free partition for your Ubuntu. You may use the Disk management tool on Windows to do this or employ a third-party app such as Paragon Partition Manager or EaseUS Partition Manager. You need at least 10GB of free space.
3. Download the version and flavor of Ubuntu you want to install.
4. Make a bootable USB or disc of the Ubuntu iso you have downloaded. You can use Rufus tool on windows or you can use the Startup Disk Creator if you have an existing Ubuntu or Linux installation.
5. Reboot your PC with the bootable USB or disc.
6. Proceed with the installation until you get to Installation type. If you created a partition already (Step 2), then choose it at your target install and continue the process. If you skipped Step 2, choose one of the followings –
a. Choose the option which says “Install Ubuntu alongside them” and then specify your partition size by dragging the slider at the bottom.
b. Choose “Something else”. Select the partition you want to resize and enter the Size in GB and then press Enter to shrink your existing partition. You need at least 10GB of space for Ubuntu and then another 4-8GB for SWAP. Use your installed RAM as a guide for SWAP. Create a partition for your Ubuntu and then set the rest of free space as SWAP. Select “Finish partitioning and write changes to disk”.
7. Continue and then finish your Ubuntu Installation.
8. Your grub installation will automatically look for other installed operating systems and hence will discover your existing Windows 10. Upon boot up, you will be presented with the option to select your OS of choice.
Install Windows After Ubuntu
So you can go the other way round and install your Ubuntu first before installing Windows. The problem with this is that the Master Boot Record will override your Grub installation from Ubuntu.
EasyBCD is a nifty tool that will help you add your Ubuntu installation to your Windows boot menu. Get it from here.
2. Recovering GRUB after reinstalling Windows
- Insert Ubuntu installation media and boot from it
- Select Ubuntu Live/Try mode (do not install)
- Search and run “Gparted” from the Ubuntu dash
- Determine the name of your Linux partition (/dev/sdXY) – you should be able to identify it by recognising its format (most likely ext4) and size (number of GB)
- Enter the following command via terminal
(i). sudo mount /dev/sdXY /mnt [where sdXY has previously been identified using gparted] for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
(ii). sudo chroot /mnt
(iii). sudo grub-install /dev/sdX [note this is sdX not sdXY!]
- Restart PC and remove Ubuntu installation media.
There you go. You now have a dual boot setup of Windows 10 and Ubuntu.
Contributors to the Ubuntu documentation wiki.