Linux Tutorials

Dual Boot Windows 7 And Ubuntu

dual boot windows and ubuntu

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. Also, read – How To Dual Boot Windows 8/8.1/10 And Ubuntu Step by Step tutorial

Prerequisites

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 7

From my experience, this is the best approach to dual-boot Windows 7 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 7 –

  1. Make sure you have Windows 7 installed and running on your PC.
  2. [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.
partition disc in disc management
partition disc in disc management

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.

rufus make ubuntu bootable
rufus make ubuntu bootable

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.

install ubuntu alongside windows
install ubuntu alongside windows

 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”.

partition disc to dual boot windows and ubuntu
partition disc to dual boot windows and ubuntu

7. Continue and then finish your Ubuntu Installation​.

ubuntu is installing
ubuntu is installing

8. Your grub installation will automatically look for other installed operating systems and hence will discover your existing Windows 7. Upon boot up, you will be presented with the option to select your OS of choice.

dual boot grub menu
dual boot grub menu

Installing 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.

1. EasyBCD

EasyBCD is a nifty tool that will help you add your Ubuntu installation to your Windows boot menu. Get it from here.

easybcd to edit grub
easybcd to edit grub

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!]
(iv). update-grub
(v). Exit

  • Restart PC and remove Ubuntu installation media.

​There you go. You now have a dual boot setup of Windows 7 and Ubuntu.

Credit
Contributors to the Ubuntu documentation wiki.

Our sponsor - Deploy your server within 3 minutes


2 comments

Danuta August 18, 2019 at 9:30 pm

I’m basic user, so please, write for me the first command you’ve written step by step, because it didn’t work.

Reply
Gman March 12, 2020 at 8:37 am

Have windows 10 and recently dualboot installed Ubuntu Studio.
Now i want to add Windows 7 (triplebooting)…
Should i follow option 1, option 2 or anything else ?

Reply

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More