How To Dual Boot Linux

How To Dual Boot Linux

Reading time1 min
#Linux#DualBoot#OperatingSystems#Ubuntu#Partitioning#GRUB

Dual Boot Linux with Windows: Practical Guide for Engineers

Setting up a dual-boot environment with Linux and Windows can be straightforward—provided you approach it with disciplined partition management and attention to bootloader configuration. The benefit: cost-effective hardware utilization and maximal flexibility for development, security, or testing. Common pitfalls (data loss, system boot loops, broken EFI/NVRAM entries) are avoidable. This guide assumes a UEFI system with Secure Boot present.


Prerequisites

  • Windows 10 or 11 already installed (on bare-metal, not VM)
  • USB 3.0 flash drive, ≥8GB
  • Linux ISO (Ubuntu 22.04 LTS recommended; Mint 21.2 also acceptable)
  • ~40GB of available disk space (20GB is a bare minimum)
  • Disk backup (external SSD, cloud snapshot, or Time Machine equivalent)
  • Internet access, a second device for reference is useful during recovery

1. Data Backup & Disaster Preparation

Production systems go down; laptops get bricked. Clone the device or back up C:\Users\<yourname> and, critically, any custom partitions using tools like Macrium Reflect (free edition suffices). Include EFI system partition if possible. Verifying backup integrity is not optional.


2. Acquire and Verify ISO

Download the release ISO from the official source:

Always validate the download:

sha256sum ubuntu-22.04.4-desktop-amd64.iso

Hash mismatch? Redownload. Integrity matters.


3. Build a Bootable USB

Rufus (Windows):

  1. Download from https://rufus.ie/
  2. Insert USB, run Rufus as admin.
  3. Parameters:
    • Device: (your USB)
    • Boot selection: Linux ISO
    • Partition scheme: GPT
    • File system: FAT32

Enable “Write in DD Image mode” if prompted; prevents EFI/boot issues on some motherboards.

Alternative: Balena Etcher for macOS/Linux.


4. Windows: Prepare Disk for Linux

Shrinking Windows’s primary partition safely requires:

  1. diskmgmt.msc → right-click C: → Shrink Volume.
  2. 40GB for serious work; minimum 20GB.
  3. Do not create a new partition—leave as “Unallocated”.
  4. If shrinking fails:
    • Disable hibernation via powercfg /hibernate off
    • Turn off System Restore
    • Defragment drive
    • Reboot, try again

Known issue: BitLocker drive encryption complicates resizing; decrypt first if necessary.


5. BIOS/UEFI: Configure Boot Order

  • Insert USB.
  • Reboot, enter BIOS (F2, DEL, or as vendor specifies).
  • Set USB as primary boot device.
  • Disable Secure Boot for maximum compatibility (re-enable Secure Boot post-install if distro supports signed shim).

Side note: Some Lenovo and HP hardware will refuse unsigned EFI boot—if so, use a distribution with signed bootloaders.


6. Start Linux Installer: Partitioning Approach

Boot into the installer from USB. Do not use “Erase disk and install Linux”—data loss is permanent.

Standard Option:
Select “Install Ubuntu alongside Windows Boot Manager”. This uses the unallocated space.

Manual Option (when above is missing):

  • Choose "Something else".
  • Find unallocated space, create:
    • / (root, ext4), mount at /, size: all but 2–4GB of available space
    • swap (optional; if <8GB RAM, make swap = RAM size)
  • On UEFI systems, confirm you do not alter existing EFI (usually a 100MB FAT32 partition, labeled “EFI System Partition” or /dev/nvme0n1p1).

Diagram: Partition Table Example

---------------------------------------------------------------
|EFI  | WinRE |    C: Windows  | Unallocated | - Linux Root - |
|100M | 800M  |   350GB        |   40GB      |    37GB ext4   |
---------------------------------------------------------------

7. Bootloader: GRUB Configuration

By default, the installer places GRUB on the EFI partition. On UEFI machines, confirm target is /dev/sda or the NVMe equivalent, not a partition (not /dev/sda1).
Non-obvious tip: With multi-disk setups, install GRUB on the same disk as Windows to ensure firmware boot order matters—not which disk is present.


8. Finalizing Install & First Boot

  • Complete the install.
  • Remove USB when the installer requests.
  • Upon reboot, expect a GRUB menu offering:
    • Ubuntu (default)
    • Windows Boot Manager

If the system boots directly into Windows:

  • Enter BIOS boot menu
  • Select “ubuntu” or similar EFI entry manually
  • If missing, boot from USB, open terminal and execute:
sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu
sudo update-grub

9. Post-Install Considerations

  • Fast Startup: In Windows, disable via Control Panel → Power Options → System Settings to prevent partition locking.
  • File Sharing: Use an NTFS partition for bidirectional file access. Linux can read/write NTFS natively (ntfs-3g).
  • Windows Updates: Some “feature updates” overwrite boot order or EFI entries; keep Linux live USB handy for recovery.
  • Backup: Periodically clone the EFI partition; accidental deletions are common during upgrades.

Example: Access Windows Volume from Linux

sudo apt install ntfs-3g
sudo mkdir /mnt/windows
sudo mount -t ntfs3 /dev/nvme0n1p3 /mnt/windows
# Replace device path with your system’s actual Windows partition

Common Issues (and Fast Recovery)

SymptomReasonFix
No GRUB menu, boots straight to WindowsNVRAM/EFI entry missingUse efibootmgr or GRUB repair above
“The shrink size is limited…” errorImmovable files or hibernationDisable hibernation, defrag, reboot
Windows partition not visible in installerIntel RST enabledDisable RST in BIOS (AHCI mode)

Known Gotchas

  • BitLocker frequently re-encrypts after disk changes; ensure you have the recovery key.
  • Some consumer laptops “forget” custom EFI entries after battery loss. Document your GRUB/Windows NVRAM order and keep a rescue USB ready.

By adhering to careful partition handling and validating each change, you avoid the classic mistakes that make new dual-booters wary. Linux and Windows will reliably co-exist—until the next major Windows update, at least.

For advanced scenarios (encrypted LUKS root, multi-booting with other OSes), consider seeking reference docs; this workflow covers the 95% case.