Windows Boot Repair Guide
Introduction
Windows boot issues can prevent your system from starting correctly, often due to corrupted boot files, misconfigured partitions, or firmware settings. This guide provides step-by-step instructions to repair Windows boot problems for both UEFI and MBR/Legacy systems using the Windows Recovery Environment (WinRE) command prompt. It covers partition setup, boot configuration rebuilding, and troubleshooting common issues.
Prerequisites
- A Windows installation USB or DVD with the same version as your system.
- Access to the Windows Recovery Environment (WinRE) by booting from the installation media and selecting “Repair your computer.”
- Basic familiarity with the Command Prompt.
- Administrative privileges in the recovery environment.
Critical Warning: Verify Partitions Before Formatting
diskpart’s list disk and list part commands to verify that you are selecting the correct disk and partition (e.g., the EFI System Partition or system partition). Formatting the wrong partition can erase your Windows data or other critical files. Always double-check the disk and partition layout to ensure you are not deleting your data drive.Windows Boot Repair
UEFI Boot Repair
UEFI systems use an EFI System Partition (ESP) to store boot files. If the ESP is missing, corrupted, or misconfigured, Windows may fail to boot.
Partition Setup
To prepare or repair the ESP and Windows partition:
diskpart
list disk
sel disk 0 # Verify this is the correct disk
list part # Confirm partition layout (ESP is typically 100-300 MB, FAT32)
# Select EFI System Partition (ESP) - FAT32
sel part 1 # Verify this is the ESP
format quick fs=fat32
assign letter=s
# Select Windows Partition
sel part 3 # Verify this is the Windows partition
assign letter=c
exit
- Explanation:
diskpart: Launches the disk partitioning tool.list disk: Lists all disks to confirm the correct disk number.sel disk 0: Selects the primary disk (replace0with the correct disk number).list part: Displays partitions to identify the ESP (typically 100-300 MB, FAT32) and Windows partition.sel part 1: Selects the ESP (verify it’s the correct partition).format quick fs=fat32: Formats the ESP as FAT32 (only if necessary).assign letter=s: Assigns a drive letter for access.sel part 3: Selects the Windows partition (verify withlist part).assign letter=c: Assigns a drive letter to the Windows partition.exit: Exits diskpart.
Boot Configuration
To rebuild the UEFI boot configuration:
bcdboot c:\Windows /s S: /f UEFI
- Explanation:
bcdboot: Copies boot files from the Windows partition (c:\Windows) to the ESP (S:)./f UEFI: Specifies UEFI firmware type to ensure compatibility.
Manual EFI Partition Creation
If the ESP is missing, create one:
diskpart
list disk
sel disk 0 # Verify this is the correct disk
# Create EFI partition (100MB)
create partition efi size=100 offset=1
format quick fs=fat32 label="System"
assign letter=S
# Create Microsoft Reserved (MSR) partition (128MB)
create partition msr size=128 offset=103424
exit
- Explanation:
list disk: Confirms the correct disk.create partition efi size=100 offset=1: Creates a 100 MB EFI partition with a 1 KB offset for alignment.format quick fs=fat32 label="System": Formats the partition as FAT32 with a “System” label.create partition msr size=128 offset=103424: Creates a 128 MB Microsoft Reserved partition (required for UEFI).- Use
bcdboot c:\Windows /s S: /f UEFIafterward to populate the ESP.
MBR/Legacy Boot Repair
MBR/Legacy systems use a different boot process, relying on the Master Boot Record and boot sector.
Standard Boot Repair Commands
Run these commands in the WinRE Command Prompt:
bootrec /fixmbr
bootrec /fixboot
bootrec /scanos
bootrec /rebuildbcd
- Explanation:
bootrec /fixmbr: Repairs the Master Boot Record to fix boot loader issues.bootrec /fixboot: Writes a new boot sector to the system partition.bootrec /scanos: Scans for Windows installations not listed in the Boot Configuration Data (BCD).bootrec /rebuildbcd: Rebuilds the BCD store to include detected Windows installations.
Alternative Method (if bootrec /fixboot fails with “access denied”)
If bootrec /fixboot fails, use this method:
diskpart
list disk
sel disk 0 # Verify this is the correct disk
list part # Confirm partition layout (system partition is typically 100-500 MB)
# System partition - FAT32 or NTFS
sel part 1 # Verify this is the system partition
format quick fs=fat32
assign letter=s
# Windows partition
sel part 3 # Verify this is the Windows partition
assign letter=c
exit
# Rebuild boot configuration for all firmware types
bcdboot C:\Windows /s S: /f ALL
- Explanation:
list diskandlist part: Verify the disk and partition layout to avoid formatting the data drive.- Formats the system partition (typically 100-500 MB) as FAT32 or NTFS (only if necessary).
- Assigns drive letters to access the system and Windows partitions.
bcdboot /f ALL: Creates boot files compatible with both UEFI and BIOS firmware.
Tips and Troubleshooting
Common Issues
- "
bootrec /fixbootaccess denied":- Use the alternative
bcdbootmethod shown above. - Ensure the system partition is active (
activecommand indiskpartfor MBR) or formatted correctly (FAT32 for UEFI).
- Use the alternative
- VHD Compatibility:
- When creating partitions for virtual hard disks (VHDs), use
subformat=fixed,force_sizeindiskpartfor better compatibility:create vdisk file="C:\path\to\disk.vhd" maximum=50000 type=fixed attach vdisk create partition efi size=100 offset=1 subformat=fixed,force_size
- When creating partitions for virtual hard disks (VHDs), use
- Partition Alignment:
- Use proper offsets (e.g.,
offset=1for EFI,offset=103424for MSR) to align partitions for optimal performance. - Verify alignment with
list partindiskpart.
- Use proper offsets (e.g.,
- Missing Windows Installation:
- If
bootrec /scanosdoesn’t detect Windows, ensure the Windows partition is assigned a letter and containsWindows\System32.
- If
- UEFI vs. BIOS Mismatch:
- Check your system’s firmware settings in the BIOS/UEFI setup to ensure the correct boot mode (UEFI or Legacy).
- Use
/f UEFIfor UEFI systems or/f BIOSfor Legacy systems withbcdboot.
- Data Loss from Formatting:
- Always use
list diskandlist partto confirm you are formatting the correct partition (e.g., ESP or system partition). - Incorrectly formatting the Windows or data partition will result in data loss. Back up critical data before proceeding.
- Always use
Additional Tips
- Backup BCD: Before modifying the BCD, export it:
bcdedit /export C:\BCD_Backup - Verify Disk Layout: Use
diskpart’slist diskandlist partto confirm the correct disk and partition layout before any changes. - Test Boot: After repairs, reboot and test. If issues persist, check firmware settings or re-run
bootreccommands.
Next Steps
In future tutorials, we’ll explore:
- Advanced BCD editing with
bcdedit. - Windows recovery using System Restore and Safe Mode.
- Automating Windows repairs with PowerShell scripts.
Resources
Practice these commands in a test environment to master Windows boot repair, and always verify partitions to avoid data loss!