How to install Linux and Windows Operating Systems on the same drive (Selective boot)


Selective Startup Dual Boot setup

Installing a second OS on a drive allows the user to select which OS to boot into on startup. This method has less of a performance overhead when compared to booting an OS and virtually running another OS on top of that, With the drawback being that to change to another OS, a reboot is required.

Ubuntu and Windows 10 are used for the installation steps as examples but should cover most versions of windows and Linux.

Installations were performed on VMware for screen capture purposes.

It is recommended to start with windows installed, or installing Windows first, as installing windows over Linux does not update the GRUB Boot Loader automatically. GRUB will have to be manually updated via boot repair.

1. With an OS already installed

1.1) With Windows already installed:

1)      Create a new unallocated partition on disk with enough space for new Linux OS by shrinking active windows install partition via diskmgmt.msc or another 3rd party application.

 Disk Management window with newly created unallocated partition

2)      Boot into Linux installation media.

3)      Change installation type to “something else”. Installing alongside Windows 10 will automatically select partitions & install location, which we do not want.

4)      Create a new partition on the free space as an Ext4 with a mounting point as the “root” (/).

Install/Partition window with format and mounting point
 

5)      Normal Installation continues from this point.

Once you restart, you’ll have both your chosen Linux Distro and Windows (as well as other enabled boot options) to choose to boot from.

GRUB window with boot options 

 

1.2) With Linux already installed

1)      Install gparted (sudo get-apt install gparted)

2)      Create a new unallocated partition on disk with enough space for new Windows OS by shrinking active Linux partition.

Gparted window with newly created partition 

3)      Boot into Windows installation media

4)      Select “custom install”.

5)      Allocate space on unused partition.

WIndows Install window drive partitioned 

6)      Install windows in newly created partition.

7)      Follow installation as normal.

8)      Restart and boot into Linux.

9)      From the GRUB menu select “Advanced options” (if GRUB menu doesn’t appear, see troubleshoot 1)

 GRUB window selection

10)   On the Grub menu select “recovery mode”.

 GRUB window selection

11)   Select update GRUB bootloader.

GRUB recovery window selection 

Once you restart, you’ll have both your chose Linux Distro and Windows (as well as other enabled boot options) to boot from.

 GRUB with boot options

 

2. Without any OS installed

2.1) Installing Linux First

1)      Boot into Linux install utility.

2)      Create a new partition table, then create a 2nd partition with enough space for Linux Install, Ext4 format with root (/) mounting point.

Linux install window with partition table and primary partition created with ext4 format and root mount point 

3)      Continue installation as normal.

4)      After Linux installation, boot into Windows installation media.

5)      Select “Custom install”.

6)      Allocate space on unused partition.

Windows setup window before free space allocated to new partition 

7)      Install windows in newly created partition.

8)      Follow installation as normal.

9)      Restart and boot into Linux.

10)   From the GRUB menu select “Advanced options” (if GRUB menu doesn’t appear, see troubleshoot 1)

GRUB window selection

11)   On the Grub menu select “recovery mode”.

 GRUB window selection

12)   Select “update GRUB bootloader”.

 GRUB recovery window selection

You should now have both your chosen Linux Distro and Windows (as well as other enabled boot options) to boot from.

 GRUB with boot options

2.2) Installing Windows First

1)      Boot into Windows installation media.

2)      Select “Custom Install”.

3)      Partition the unallocated space so that enough space is left to create a Linux partition after installing Windows.

Windows installation window after partition created with extra unallocated space 

4)      Install Windows as normal.

5)      Boot into chosen Linux Distro installation media.

6)      Change installation type to “something else”.

7)      Allocate free space to primary partition, Ext4 format, with root (/) mounting point.

 Linux install window with partition table and primary partition created with ext4 format and root mount point

8)      Continue installation as normal.

Once you restart, you’ll have both your chosen Linux Distro and Windows (as well as other enabled boot options) to boot from.

 GRUB with boot options

3. Troubleshooting

3.1) There is no GRUB menu after installation

Some versions of Ubuntu and Ubuntu based distros disable GRUB after installations. GRUB will have to be reactivated.

1)      Boot into a live session (Linux install utility, try Ubuntu).

2)    In Terminal, mount Partition containing GRUB: (you can find the partition using lsblk)

sudo mount /dev/sdXX /mnt (where XX is the disk id)

3)      Mount the Virtual file systems:

sudo mount --bind /dev /mnt/dev

sudo mount --bind /proc /mnt/proc

sudo mount --bind /sys /mnt/sys

sudo mount --bind /usr /mnt/usr

4)      Change the root file system:

            sudo chroot /mnt

5)      Make your changes to /etc/default/grub using nano:

Sudo nano /etc/default/grub

6)      Find the line "GRUB-TIMEOUT_STYLE=" and put “menu” after the =

         Change GRUB_TIMEOUT=0 to GRUB_TIMEOUT=10

Terminal highlighting the location and the changes made to the GRUB config 

7)      Exit nano, saving your changes

8)      Run the updater:

update-grub

9)      Exit chroot (CTRL-D)

10)   Unmount virtual file systems:

sudo umount /mnt/dev

sudo umount /mnt/proc

sudo umount /mnt/sys

sudo umount /mnt/usr

sudo umount /mnt

sudo reboot

3.2) Windows / Linux automatically starts

Ensure you repair the GRUB bootloader after installing windows (Section 2.1 – Step 9)

Tags: Linux, Operating System, Terminal, UBUNTU, Windows, Windows 10
Last update:
23-09-2021 03:31
Author:
Johan Mulder
Revision:
1.2
Average rating: 5 (1 Vote)