HoundSec

How to Dual Boot Any OS with Windows

· Monazir Muhammad Doha · 4 min read

How to Dual Boot Any OS with Windows

In this article, we will learn how to dual-boot or multi-boot operating systems (OS) on your PC or Laptop. Instead of learning OS-specific steps, we will understand the concept. So that we can dual-boot or triple-boot any OS.

Prerequisites

Before you start with this tutorial, make sure you have a Basic understanding of the following:

  • Basic knowledge of Disk Partitions
  • Familiar with Creating Bootable USB from ISO
  • Familiar with Bios and Boot Drive

If you are not familiar with any of these prerequisites, consider reviewing the associated documentation or tutorials to ensure a smooth learning experience.

How OS Installation Works

This guide is for UEFI, which is what current PCs use. The operating systems share one EFI partition. That partition holds the bootloaders. It does not hold the whole OS.

Each OS still needs its own main partition:

  1. One shared EFI Partition
  2. A main partition. On Linux this is mounted at /. On Windows this is the (C) Drive.

The main partition is where the OS stores the software you install and the files you have stored.

Linux can also use swap as virtual memory when the physical RAM is fully utilized. A swap partition is optional. Installers usually create a swap file instead. Make a swap partition only if you want one, and make it at least as big as your RAM if you want hibernation. Windows uses a page file for the same job. The page file is automatically created and handled.

Partitions

Windows Partitions

A typical Windows installation creates these partitions on your selected disk. These are,

  1. An EFI Partition
  2. A small hidden Microsoft Reserved Partition
  3. (C) Drive
  4. A Recovery Partition (this is WinRE, not a backup of your files)

Linux Partitions

Likewise, a linux installation needs to have

  1. The existing EFI Partition (do not create a second one)
  2. A Root Partition, mounted at /
  3. A Swap Partition (Optional. A swap file is enough. If you do make one, mark it as swap. It is not a mount point like /. Size it to your RAM if you want hibernation.)

Two Cases

There is one of two ways you can go,

  1. You have Windows installed and you want to install Linux Distro alongside it.
  2. You have a Linux Distro installed, and you want to install Windows alongside it.

Linux alongside Windows

If you open Disk Management, you will see the partitions we talked about. To install Linux, you have to shrink the (C) Drive to get some unallocated space. You can find out the minimum space required for your Linux distro by doing a Google search. Once you have your desired amount of unallocated space, you can proceed with installing a linux distro from the bootable USB.

While installing your distro make sure to choose manual mode when it comes to creating partitions. Use only that unallocated space. Do not format the EFI partition Windows already made. Formatting it, or creating a second EFI partition, is how Windows stops booting.

  1. EFI Partition - select the one Windows already created and set the mount point as /boot/efi. Do not format it.
  2. SWAP Partition - optional. Mark it as swap, not as a mount point. Skip it and let the installer use a swap file, unless you want hibernation, in which case make it at least as big as your RAM.
  3. Root Partition - set the mount point as / (however much of the unallocated space you have left).

And proceed with the installation. Once you are done with the installation, the boot menu may ask which OS you want. Many distros only list Windows when os-prober is enabled. Some, such as Pop!_OS, use systemd-boot instead of GRUB. If the menu does not show both, use the firmware boot menu. 

Windows alongside Linux

If you have a Linux Distro already installed and you want to install Windows alongside it, you are at risk. Windows does not usually erase the Linux partitions. It replaces the Linux bootloader with Windows Boot Manager, so the PC then boots only Windows.

Turn off Windows Fast Startup before you start, so Windows does not leave the disk half-hibernated. If the drive uses BitLocker, keep the recovery key. Windows may ask for it after the boot chain changes.

The process is fairly similar. Shrink the Linux partition with GParted first. Windows Disk Management cannot shrink ext4. You create unallocated space and select that space for Windows installation. This time, you don't have to manually create the partitions yourself.

When Windows is installed, boot a Linux live USB and restore the Linux bootloader. Until you do that, the machine will boot straight into Windows.