Dual Boot Linux with Windows

Overview

Dual booting lets you choose between Windows and Linux at startup. This guide covers preparing your Windows system, shrinking partitions, installing Linux alongside Windows, and configuring the bootloader.

Warning: Partition modifications carry risk. Back up important data before proceeding.

What You Need

Step 1: Prepare Windows

Disable Fast Startup

  1. Open Control Panel → Power Options → Choose what the power buttons do
  2. Click "Change settings that are currently unavailable"
  3. Uncheck "Turn on fast startup" and save

This prevents Windows from locking the disk, which can cause Linux filesystem corruption.

Disable Secure Boot (If Needed)

  1. Restart → Enter BIOS/UEFI (usually F2, Del, or F12)
  2. Find "Secure Boot" and disable it
  3. Note: Ubuntu 20.04+ supports Secure Boot — you may not need to disable it

Shrink Windows Partition

  1. Right-click Start → Disk Management
  2. Right-click your C: drive → "Shrink Volume"
  3. Enter amount to shrink (e.g., 50000 MB for 50GB)
  4. Click Shrink — you'll see "Unallocated" space

Step 2: Install Linux

  1. Insert the bootable USB and restart
  2. Press F12 (or your boot menu key) to select USB boot
  3. Choose "Try or Install" then proceed with installation
  4. Installation type: Select "Install alongside Windows Boot Manager"
  5. If not available, choose "Something else" for manual partitioning

Manual Partitioning (Advanced)

In the unallocated space, create:

Bootloader Location

Ensure GRUB installs to the correct disk (not partition):

# For UEFI: /dev/nvme0n1p1 (the EFI partition)
# For Legacy BIOS: /dev/sda (the whole disk, no partition number)

Step 3: Post-Installation

Fix Windows Boot Entry

If Windows doesn't appear in GRUB menu:

sudo update-grub          # Ubuntu/Debian
sudo grub-mkconfig -o /boot/grub/grub.cfg   # Fedora/RHEL

Adjust GRUB Timeout

sudo nano /etc/default/grub

# Change:
GRUB_TIMEOUT=10       # Seconds to show menu
GRUB_DEFAULT=0        # 0 = first entry, 1 = second, etc.

# Apply changes:
sudo update-grub

Share Files Between Windows and Linux

Mount the NTFS partition:

# Find the Windows partition
sudo fdisk -l

# Create mount point and mount
sudo mkdir /mnt/windows
sudo ntfs-3g /dev/nvme0n1p3 /mnt/windows

# For automatic mounting, add to /etc/fstab:
/dev/nvme0n1p3 /mnt/windows ntfs-3g defaults,windows_names,locale=en_US.UTF8 0 0

Synchronize Clock

Linux and Windows handle hardware clock differently. Set Linux to use local time:

timedatectl set-local-rtc 1 --adjust-system-clock

Troubleshooting

Repair GRUB from Live USB

# Boot from Linux live USB
sudo mount /dev/nvme0n1pX /mnt        # Replace with your root partition
sudo mount /dev/nvme0n1p1 /mnt/boot/efi  # EFI partition (UEFI only)
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/nvme0n1             # Or /dev/sda for BIOS
update-grub
exit
sudo reboot