メインコンテンツまでスキップ

Remove Ubuntu from Dual-Boot System

This comprehensive guide explains how to safely remove Ubuntu from a Windows dual-boot system, clean up partitions, and restore the Windows bootloader. Follow these steps carefully to avoid data loss and system issues.

Data Loss Warning

Removing Ubuntu involves deleting partitions and modifying system boot files. Always backup important data before proceeding. Incorrect execution can make your system unbootable.

Overview

When Ubuntu is installed alongside Windows in a dual-boot configuration, it typically:

  • Creates Linux partitions (root, swap, sometimes home)
  • Installs GRUB bootloader to manage boot options
  • Adds EFI entries for Linux boot process
  • Modifies system boot sequence

Proper removal requires:

  1. Backing up important data
  2. Removing Ubuntu EFI entries
  3. Deleting Ubuntu partitions
  4. Restoring Windows bootloader
  5. Reclaiming disk space

Prerequisites

Required Access

  • Windows Administrator privileges
  • Physical access to the computer
  • Windows installation media (for recovery if needed)
  • Complete data backup of important files
  • Create Windows recovery drive
  • Document current partition layout
  • Note Ubuntu version and installation details

System Requirements

  • UEFI-based system (most modern computers)
  • Windows 10/11 with Disk Management tools
  • Stable power supply during the process

Understanding Your Current Setup

Identify Dual-Boot Configuration

Before proceeding, understand your current setup:

# Open Command Prompt as Administrator
# Check current boot configuration
bcdedit /enum firmware

# Check disk configuration
diskpart
list disk
list partition

Common Dual-Boot Layouts

Typical UEFI Dual-Boot Setup:

Disk 0:
├── EFI System Partition (ESP) - 100-500MB FAT32
│ ├── /EFI/Microsoft/ (Windows boot files)
│ └── /EFI/ubuntu/ (Ubuntu boot files)
├── Windows C: Drive - NTFS
├── Ubuntu Root (/) - ext4
├── Ubuntu Swap - linux-swap
└── Ubuntu Home (/home) - ext4 (optional)

Check Current Partitions

  1. Open Disk Management:

    • Right-click "This PC" → "Manage" → "Disk Management"
    • Or press Win + X → "Disk Management"
  2. Identify Ubuntu partitions:

    • Look for partitions without drive letters
    • Usually shows as "Healthy (Primary Partition)"
    • May show file system types like "ext4" or "linux-swap"

Step 1: Backup Important Data

# If Ubuntu is still bootable, backup data first
# Boot into Ubuntu and copy important files to external storage
sudo rsync -av /home/username/ /media/backup/

Step 2: Remove Ubuntu EFI Entries

Access EFI System Partition

  1. Open Command Prompt as Administrator
  2. Launch Diskpart:
diskpart
  1. List and select the disk:
# Display all disks
list disk

# Select disk containing Windows (usually disk 0)
select disk 0
  1. List and select EFI partition:
# Display partitions
list partition

# Select EFI System Partition (usually partition 1, ~100-500MB)
select partition 1

# Assign temporary drive letter
assign letter=Z

Remove Ubuntu EFI Files

  1. Open File Explorer as Administrator:

    • Right-click File Explorer → "Run as administrator"
  2. Navigate to EFI partition:

    • Go to Z:\EFI\
    • You should see folders like Microsoft, ubuntu, Boot
  3. Delete Ubuntu folder:

    • Right-click ubuntu folder → "Delete"
    • Confirm deletion

Clean Up Drive Letter

Return to Diskpart:

# Remove the assigned drive letter
remove letter=Z

# Exit diskpart
exit

Step 3: Remove Ubuntu Partitions

Using Disk Management (GUI Method)

  1. Open Disk Management:

    • Press Win + X → "Disk Management"
  2. Identify Ubuntu partitions:

    • Look for partitions without drive letters
    • Usually appear as "Healthy (Primary Partition)"
    • Common sizes: 20GB+ for root, 2-8GB for swap
  3. Delete Ubuntu partitions:

    • Right-click each Ubuntu partition
    • Select "Delete Volume"
    • Confirm deletion
    • Partitions become "Unallocated"

Using Diskpart (Command Line Method)

# Open diskpart as administrator
diskpart

# List and select disk
list disk
select disk 0

# List partitions
list partition

# Delete Ubuntu partitions (replace X with partition number)
select partition X
delete partition

# Repeat for all Ubuntu partitions

Step 4: Extend Windows Partition

  1. In Disk Management:

    • Right-click Windows C: drive
    • Select "Extend Volume"
    • Follow wizard to use unallocated space
  2. Alternative using Diskpart:

diskpart
list disk
select disk 0
list partition
select partition 2 # Windows partition
extend # Uses all available space

Step 5: Restore Windows Boot Manager

Update Boot Configuration

# Open Command Prompt as Administrator

# Rebuild BCD store
bcdedit /export C:\BCD_Backup
bcdboot C:\Windows /s C: /f UEFI

# Remove any remaining Ubuntu entries
bcdedit /enum firmware
# Note the identifier of Ubuntu entries
bcdedit /delete {ubuntu-identifier}

Verify Boot Configuration

# Check current boot options
bcdedit /enum firmware

# Set Windows as default
bcdedit /default {current}

# Set boot timeout
bcdedit /timeout 5

Method 2: Emergency Removal

If Ubuntu is corrupted or unbootable:

Step 1: Boot from Windows Recovery

  1. Create Windows Recovery Drive (if not already available)
  2. Boot from recovery media
  3. Access Command Prompt from recovery options

Step 2: Emergency EFI Cleanup

# In recovery command prompt
diskpart
list disk
select disk 0
list partition
select partition 1 # EFI partition
assign letter=Z
exit

# Navigate and delete Ubuntu files
Z:
cd EFI
dir
rmdir /s ubuntu

# Remove drive letter
diskpart
select disk 0
select partition 1
remove letter=Z
exit

Step 3: Repair Windows Boot

# Repair Windows boot files
bootrec /fixmbr
bootrec /fixboot
bootrec /scanos
bootrec /rebuildbcd

# Alternative method
bcdboot C:\Windows /s C: /f UEFI

Advanced Scenarios

Multiple Linux Distributions

If you have multiple Linux distributions:

# List all EFI entries
bcdedit /enum firmware

# Remove specific entries
bcdedit /delete {linux-entry-id}

# In EFI partition, check folders
Z:\EFI\
├── Microsoft\
├── ubuntu\
├── fedora\
└── arch\

Encrypted Ubuntu Installation

For encrypted Ubuntu (LUKS):

  1. Ubuntu partitions may not be visible in Windows
  2. Use Linux live USB to decrypt and backup data first
  3. Proceed with normal removal steps
  4. Encrypted partitions appear as regular partitions to Windows

Custom GRUB Configuration

If GRUB was customized:

# Check for custom boot entries
bcdedit /enum all

# Remove custom entries
bcdedit /delete {custom-id}

# Reset to Windows default
bcdedit /set {fwbootmgr} displayorder {bootmgr}

Troubleshooting

Boot Issues After Removal

System Won't Boot

Solution 1: Windows Recovery

# Boot from Windows installation media
# Choose "Repair your computer"
# Select "Troubleshoot" → "Advanced options" → "Command Prompt"

bootrec /fixmbr
bootrec /fixboot
bootrec /rebuildbcd

Solution 2: UEFI Boot Repair

# In recovery command prompt
bcdboot C:\Windows /s C: /f UEFI

# If EFI partition needs repair
diskpart
select disk 0
select partition 1
format fs=fat32 quick
assign letter=Z
exit

bcdboot C:\Windows /s Z: /f UEFI

GRUB Still Appears

If GRUB bootloader still appears:

# Check EFI boot order
bcdedit /enum firmware

# Set Windows as first boot option
bcdedit /set {fwbootmgr} displayorder {bootmgr} {other-entries}

# Access BIOS/UEFI settings
# Set Windows Boot Manager as first boot option

Partition Issues

Can't Delete Ubuntu Partitions

Possible causes:

  • Partitions are mounted or in use
  • System protection is enabled
  • Third-party software interference

Solutions:

# Force delete in diskpart
diskpart
select disk 0
select partition X
inactive # If partition is active
delete partition override

# Use third-party tools if needed
# - GParted Live USB
# - EaseUS Partition Master
# - MiniTool Partition Wizard

Unallocated Space Can't Be Extended

Common issue: Unallocated space not adjacent to Windows partition

Solution:

  1. Use third-party partition manager
  2. Move partitions to make space adjacent
  3. Then extend Windows partition

Data Recovery

Accidentally Deleted Wrong Partition

Immediate actions:

  1. Stop using the computer immediately
  2. Boot from external media only
  3. Use data recovery tools:
    • TestDisk & PhotoRec
    • R-Studio
    • Recuva
# Using TestDisk (from Linux Live USB)
sudo apt install testdisk
sudo testdisk

# Follow prompts to recover partition table

Verification and Cleanup

Verify Complete Removal

  1. Check Disk Management:

    • No unrecognized partitions
    • All space allocated to Windows
  2. Check Boot Configuration:

    bcdedit /enum firmware
    # Should only show Windows entries
  3. Check EFI Partition:

    # Temporarily assign drive letter
    diskpart
    select disk 0
    select partition 1
    assign letter=Z

    # Check EFI folder contents
    dir Z:\EFI\
    # Should only contain Microsoft and Boot folders

    # Remove drive letter
    remove letter=Z

System Optimization

After removal:

  1. Run Disk Cleanup:

    • Remove temporary files
    • Clean system files
  2. Defragment Hard Drive (if using HDD):

    defrag C: /O
  3. Check System Files:

    sfc /scannow
    DISM /Online /Cleanup-Image /RestoreHealth

Update System

# Check for Windows updates
# Settings → Update & Security → Windows Update

# Update drivers
# Device Manager → Check for hardware changes

Prevention and Best Practices

Before Installing Linux Again

  1. Use Virtual Machines for testing:

    • VMware Workstation
    • VirtualBox
    • Hyper-V
  2. Use Windows Subsystem for Linux (WSL):

    wsl --install
    wsl --install -d Ubuntu
  3. Use portable Linux:

    • Live USB with persistence
    • Portable installations

Backup Strategies

  1. Regular System Images:

    # Create system image
    wbadmin start backup -backupTarget:E: -include:C: -allCritical
  2. EFI Partition Backup:

    # Backup EFI partition
    xcopy Z:\EFI\ E:\EFI_Backup\ /E /H /C /I

Documentation

Keep records of:

  • Partition layouts before changes
  • Boot configuration exports
  • Installation procedures used
  • Custom configurations applied

Alternative Solutions

Keep Ubuntu in Virtual Machine

Instead of dual-boot, consider:

# Install VirtualBox
# Download Ubuntu ISO
# Create VM with adequate resources:
# - 4GB+ RAM
# - 20GB+ storage
# - Enable virtualization features

Windows Subsystem for Linux

For development needs:

# Enable WSL feature
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

# Install Ubuntu
wsl --install -d Ubuntu-22.04

# Access Ubuntu
wsl

Portable Linux Solutions

  • Ventoy: Multi-boot USB with multiple ISOs
  • Rufus: Create persistent live USBs
  • Universal USB Installer: Easy Linux USB creation

Resources and References

Safety First
  • Always backup important data before modifying partitions
  • Create Windows recovery media before starting
  • Test the process on a virtual machine first if possible
  • Keep Linux live USB available for emergency data recovery
Critical Points
  • Never delete partitions without confirming their contents
  • Always assign temporary drive letters to access EFI partitions safely
  • Remove drive letter assignments after completing tasks
  • Verify Windows boots correctly before considering the process complete
Quick Recovery

If something goes wrong:

  1. Boot from Windows installation media
  2. Choose "Repair your computer"
  3. Use Command Prompt to run bootrec /rebuildbcd
  4. Restore from system backup if available