For reasons above my paygrade, Windows likes to tuck away boot files on your second hard drive whenever you install Windows and there are two hard drives present.
When the second hard drive goes missing or is corrupted, your computer won’t boot, or your computer can become very sluggish, particularly during login.
Before we begin, it’s best to remove extra hard drives so as to eliminate the possibility of human error, and to reduce the number of possible corrupt drives down to as few moving parts as possible.
Preceding this guide, we have already burned Windows Installer onto a USB using the Microsoft Media Creation Tool. That is to say, we clicked the “Download Now” button located under “Create Windows 11 Installation Media”. Don’t worry, the Media Creation Tool also allow you to download Windows 11 as part of its wizard, so you don’t need to download the .ISO separately (but you can if you’re feeling fancy, or perhaps you just want a copy lying around in case the world ends here shortly).
Use the entirety of this guide at your own risk, and remember to always back up your data, as some of these operations are a bit sketch.
We Begin
Prompt: how do I enter command prompt when booting from a windows usb flash drive
To open Command Prompt when booting from a Windows USB flash drive, press Shift + F10 on the initial Windows Setup screen (or Shift + Fn + F10 on some laptops).
Method 1: Keyboard Shortcut (Fastest)
- Boot your PC from the Windows USB drive until you reach the purple/blue Windows Setup screen asking for your language and keyboard layout.
- Press
Shift + F10(if your laptop’s function keys default to media/brightness controls, pressShift + Fn + F10). - An Administrator Command Prompt window (
X:\Sources>) will open immediately.
Method 2: Through the Repair Menu
If the keyboard shortcut does not respond:
- On the initial Windows Setup screen, click Next.
- Click Repair your computer in the bottom-left corner (do not click Install now).
- Select Troubleshoot.
- Select Command Prompt.
Important Tip When Running Commands from USB
When you boot from a USB drive, Windows runs inside a temporary recovery environment (X:\Sources>), and your normal Windows drive may not be assigned the letter C:.
Before running repair commands like sfc, DISM, or chkdsk, find your actual Windows drive letter:
- Type
diskpartand press Enter. - Type
list volumeand press Enter. - Look for the large partition where Windows is installed (check its size and label) and note its drive letter (for example,
D:). - Type
exitand press Enter to return to Command Prompt.
(Use that drive letter in offline repair commands, such as sfc /scannow /offbootdir=D:\ /offwindir=D:\Windows or DISM /Image:D:\ /Cleanup-Image /RestoreHealth.)
Would you like the exact offline DISM and sfc commands formatted for using the Windows USB itself as the clean repair source?
ok, and remind me the command to repair boot?
To repair the Windows bootloader from the USB Command Prompt, use the bootrec commands followed by bcdboot if needed.
- Standard Bootrec Commands
Run these commands in order inside the Command Prompt (X:\Sources>):
bootrec /fixmbr— Writes a new Master Boot Record to the system partition.bootrec /fixboot— Writes a new boot sector to the system partition.bootrec /scanos— Scans all disks for Windows installations not currently in the Boot Configuration Data (BCD).bootrec /rebuildbcd— Rebuilds the BCD store; press Y (or A for All) if it prompts you to add an installation to the boot list.
- If
bootrec /fixbootSays “Access is Denied” (Common on UEFI/GPT Systems)
On modern UEFI systems, bootrec /fixboot frequently returns an Access is denied error. Instead, recreate the boot files directly using bcdboot:
- Find your Windows drive letter (e.g.,
C:orD:) usingdiskpart→list volume→exit. - Run
bcdbootpointing to your Windows folder (replaceC:\Windowswith your actual Windows drive letter if different):
cmd
bcdboot C:\Windows
Use code with caution.
3.(If bcdboot C:\Windows fails to locate the EFI partition automatically, use diskpart to assign a drive letter like S: to the small ~100MB FAT32 EFI System Partition, exit diskpart, and run bcdboot C:\Windows /s S: /f UEFI.)*
- Restart
Once complete, type exit, unplug the USB flash drive, and restart your PC.
If you get an “Access is denied” error or no Windows installations found, let me know the exact output from list volume in diskpart and I can give you the exact bcdboot command for your partition layout.
bcdboot C:\Windows failure when attempting to copy boot files
The “Failure when attempting to copy boot files” error happens because either C:\Windows is not your actual Windows drive letter in the recovery environment, or bcdboot cannot locate/write to your hidden EFI System Partition (ESP).
Follow these steps to verify your drive letters, manually mount the EFI partition, and rebuild the boot files.
-
Identify Your Partitions in Diskpart
-
Type
diskpartand press Enter. -
Type
list diskand press Enter (note whether there is an asterisk*under the Gpt column for your main drive—almost all modern Windows 10/11 PCs are GPT/UEFI). -
Type
select disk 0(replace0with your main Windows disk number if you have multiple drives) and press Enter. -
Type
list volumeand press Enter.
Look at the output and identify two specific volumes:
- Your Windows OS Partition: The large NTFS partition (usually hundreds of GBs). Note its Ltr (drive letter)—it is often
D:orE:in WinRE instead ofC:. - Your EFI System Partition: A small FAT32 partition, typically 100 MB to 500 MB in size, usually labeled
Systemor having no drive letter. Note its Volume ###.
- Assign a Drive Letter to the EFI Partition
Still inside diskpart:
-
Type
select volume X(replaceXwith the volume number of the small FAT32 EFI partition) and press Enter. -
Type
assign letter=S:and press Enter. -
Type
exitand press Enter. -
Run
bcdbootExplicitly
Now run bcdboot specifying both your actual Windows drive letter and the S: EFI partition (replace D: below if your Windows volume had a different letter):
cmd
bcdboot D:\Windows /s S: /f UEFI
Use code with caution.
You should see: Boot files successfully created.
(Note: If you checked list disk earlier and your drive did not have an asterisk under Gpt, your system uses Legacy BIOS/MBR instead—use /f BIOS instead of /f UEFI, pointing /s to your small “System Reserved” NTFS partition.)
- If It Still Fails (Corrupted EFI File System)
If bcdboot still fails after assigning S:, the FAT32 file system on the EFI partition itself may be corrupted. You can reformat just that small EFI partition (assuming S: is confirmed to be the ~100MB–500MB FAT32 partition):
- Run
format S: /FS:FAT32and press Y to confirm. - Re-run
bcdboot D:\Windows /s S: /f UEFI.
Once it succeeds, type exit, remove the USB drive, and reboot.
If you’re still getting an error, paste or type the output of list volume from diskpart and I’ll give you the exact commands for your specific drive letters.
no efi is listed
If no EFI partition is listed in diskpart, either your drive uses Legacy BIOS/MBR instead of UEFI/GPT, or the EFI partition was deleted/is RAW.
Check your disk layout in diskpart to determine which situation applies and fix it accordingly.
- Check Partition Style & Partition List
Run these commands in Command Prompt:
diskpartlist disk— Look at the far-right Gpt column for your Windows drive:
- No asterisk (
*) under Gpt: Your drive is MBR (Legacy BIOS), which does not use an EFI partition. Skip to Scenario A. - Asterisk (
*) under Gpt: Your drive is GPT (UEFI), meaning the EFI partition is either formatted as RAW or missing. Skip to Scenario B.
select disk 0(replace0with your main Windows disk number)list partition— Check all partitions on the disk, even those hidden fromlist volume.
Scenario A: Your Drive is MBR (No * under Gpt)
On Legacy/MBR disks, Windows uses a small NTFS “System Reserved” partition (typically 50 MB–500 MB) instead of FAT32/EFI, or boots directly from the main C:/D: Windows partition.
- In
diskpart, runlist volumeand note the drive letter of your Windows partition (e.g.,D:) and any small System Reserved NTFS partition. - If there is a small System Reserved partition without a letter, select it (
select volume X) and runassign letter=S:. - Type
exitto leavediskpart. - Run
bcdboottargeting BIOS instead of UEFI (replaceD:with your Windows letter, andS:with your System Reserved letter—or useD:for both if no System Reserved partition exists):
cmd
bcdboot D:\Windows /s S: /f BIOS
Use code with caution.
Scenario B: Your Drive is GPT (* under Gpt), but EFI is Missing or RAW
Look at the list partition output from Step 1:
Case 1: A ~100 MB–500 MB “System” or “Unknown” partition exists, but showed as RAW or didn’t show in list volume
Its FAT32 file system is corrupted, so list volume hides it or marks it RAW.
- In
diskpart, select that ~100 MB–500 MB partition:select partition X(replaceXwith its partition number). - Assign it a letter:
assign letter=S: - Type
exitto leavediskpart. - Format it as FAT32:
format S: /FS:FAT32(press Y to confirm). - Rebuild the boot files:
cmd
bcdboot D:\Windows /s S: /f UEFI
Use code with caution.
6.(Replace D: with your actual Windows OS drive letter.)*
Case 2: No EFI partition exists at all, and you have ~100 MB–260 MB of Unallocated Space
If the EFI partition was accidentally deleted and unallocated space is available on the disk:
- In
diskpart(withdisk 0selected), create and format a new EFI partition:
cmd
create partition efi size=100
format quick fs=fat32 label="System"
assign letter=S:
exit
Use code with caution.
- Rebuild the boot files (replace
D:with your actual Windows drive letter):
cmd
bcdboot D:\Windows /s S: /f UEFI
Use code with caution.
(Note: If your drive is GPT, has no EFI partition, and has 0 MB of unallocated space, you cannot create an EFI partition without shrinking an existing partition first—or you may be looking at the wrong disk number in list disk.)
Could you share the output of list disk and list partition (especially whether Gpt has an asterisk and what partitions appear)? That will let me give you the exact command sequence to run.
the drive originally was mated to another drive at time of installation which is now wished to be stand-alone
That makes complete sense. When Windows is installed while a second drive is connected, the Windows installer often puts the EFI System Partition (bootloader) onto the other drive. Once that original drive is removed, the remaining Windows drive has the OS files (\Windows), but no bootloader partition of its own.
To make this drive standalone, shrink your main Windows partition slightly to create ~100–260 MB of free space, create a new EFI partition on this drive, and copy the boot files to it.
(Assuming your drive is GPT/UEFI, which is standard for Windows 10/11. If list disk showed no * under Gpt, let me know before running this, as MBR uses a slightly different partition command.)
- Shrink the Main Partition & Create a New EFI Partition
Open Command Prompt from the Windows USB (Shift + F10) and run these commands in diskpart:
-
diskpart -
list disk -
select disk 0(confirm0is your standalone Windows drive, not your USB stick) -
list partition— Identify your large Primary Windows partition (e.g.,Partition 1orPartition 2). -
select partition X(replaceXwith your large Windows partition number) -
shrink desired=200 minimum=100— Carves out 200 MB of unallocated space safely without erasing your files. -
create partition efi size=100— Creates a brand-new EFI System Partition in that unallocated space. -
format quick fs=fat32 label="System"— Formats it properly for UEFI boot. -
assign letter=S:— Temporarily mounts it sobcdbootcan write to it. -
list volume— Check the Ltr column to confirm what drive letter your large Windows partition currently has (oftenC:orD:). -
exit -
Install the Standalone Bootloader
Now copy the boot files from your Windows installation onto the newly created S: EFI partition (replace C: below with your actual Windows drive letter from Step 10):
cmd
bcdboot C:\Windows /s S: /f UEFI
Use code with caution.
You should see: Boot files successfully created.
-
Reboot Standalone
-
Type
exitto close Command Prompt. -
Unplug the Windows USB flash drive.
-
Restart your PC—your drive now has its own self-contained bootloader and will boot independently.
If shrink gives an error (such as unmovable files at the end of the volume) or if your drive turned out to be MBR instead of GPT, share the exact message and I’ll walk you through the workaround.
“msr and efi partitions are only supported on GPT disks. Convert the selected disk to GPT and try again.”
Your drive is using MBR (Legacy BIOS) rather than GPT (UEFI). Because the shrink step already succeeded, you have ~200 MB of unallocated space ready—you just need to create a standard MBR primary partition, mark it active, and install the BIOS bootloader instead.
(Note: Do not run convert gpt in diskpart, as that command will erase your entire drive.)
- Create an Active System Partition (MBR)
Inside diskpart (with your standalone Windows disk still selected via select disk 0), run these commands:
-
create partition primary size=100— Uses the unallocated space to create a standard MBR system partition. -
format quick fs=ntfs label="System Reserved"— Formats it as NTFS (required for MBR bootloaders, unlike FAT32 for UEFI). -
active— Marks the partition as bootable for the motherboard BIOS. -
assign letter=S:— Temporarily mounts it sobcdbootcan write to it. -
list volume— Check the Ltr column to confirm your main Windows partition’s drive letter (e.g.,C:orD:). -
exit -
Install the Legacy BIOS Bootloader
Now copy the boot files to S: using the /f BIOS flag (replace C: below with your actual Windows drive letter from Step 5):
cmd
bcdboot C:\Windows /s S: /f BIOS
Use code with caution.
You should see: Boot files successfully created.
(Optional safety step: Run bootsect /nt60 S: /mbr afterward to ensure the Master Boot Record and boot sector code on the drive are completely updated.)
-
Reboot Standalone
-
Type
exitto close Command Prompt. -
Unplug the Windows USB flash drive.
-
Restart your PC. (If your motherboard was previously set to UEFI-only mode, make sure Legacy / CSM boot support is enabled in BIOS so it can boot from an MBR disk.)
If you later decide you want to convert this drive to GPT/UEFI without losing data (for example, if you’re on Windows 11 or want Secure Boot), let me know and I can share the non-destructive mbr2gpt steps once Windows boots.
More Cool Stuff
what commands would repair a system that takes forever to log in / boot into windows?
To repair a system that hangs or takes an unusually long time to boot and log in, run chkdsk, DISM, and sfc /scannow from an Administrator Command Prompt to fix file system delays and corrupted startup services, followed by checking disk health and startup tasks.
(Note: Since you recently separated this drive from another drive, Windows may also be stalling while searching for missing network shares, orphaned drives, or corrupted user profile/boot files.)
- Fix File System & Bad Sector Delays (
chkdsk)
A drive stalling at the spinning dots or login screen is frequently waiting on timed-out read requests from bad sectors or file system errors.
- Open Command Prompt as Administrator (or run from your USB Command Prompt, adjusting
C:to your Windows drive letter). - Run:
cmd
chkdsk C: /f /r
Use code with caution.
-
Press
Ywhen prompted to schedule the scan on the next restart, then reboot and let it finish completely. -
Repair Corrupted Windows Services & System Files (
DISM&sfc)
Corrupted system binaries or broken Windows Update states often cause services to hang during boot and sign-in. Run these in order inside an Administrator Command Prompt:
- Repair the component store:
cmd
DISM /Online /Cleanup-Image /RestoreHealth
Use code with caution.
- Repair protected OS and login files:
cmd
sfc /scannow
Use code with caution.
-
Restart your PC if either command reports repairs.
-
Check Drive Health & Reset Search/Update Caches
If the commands above finish cleanly, run these checks to rule out failing storage or stuck background services:
- Check Drive Status:
cmd
wmic diskdrive get model,status
Use code with caution.
(If Status shows anything other than OK—such as Pred Fail—the drive itself is failing and causing the I/O stalls.)
- Clear Stuck Windows Update & Delivery Optimization Caches:
cmd
net stop wuauserv
net stop bits
rd /s /q C:\Windows\SoftwareDistribution
net start wuauserv
net start bits
Use code with caution.
- Isolate Slow Login vs. Slow Boot
Depending on where the delay happens, check one of these built-in tools once logged in:
- Stalls before the login screen (black screen / spinning dots): Press
Win + R, typemsconfig, go to the Services tab, check Hide all Microsoft services, and click Disable all to test if a third-party driver or background service is hanging during startup. - Stalls after entering your password (“Welcome” screen / black desktop): This points to a corrupted user profile, heavy startup apps (
Ctrl + Shift + Esc→ Startup apps), or mapped drives/shortcuts pointing to the old second drive that was removed.
If you let me know which stage hangs longest (before the login screen, or after entering your password) and whether this is an SSD or HDD, I can give you targeted commands to isolate the exact bottleneck.
I noticed my ssd is getting slammed, it’s always at 100%, and particularly my antimalware is running the most
When an SSD sits at 100% active time with Antimalware Service Executable (MsMpEng.exe) at the top, it usually means Windows Defender is stuck scanning a massive/corrupted file, scanning its own directory, or the SSD is struggling with bad blocks/TRIM/controller stalls.
Run these targeted commands and checks in an Administrator Command Prompt (or PowerShell as Administrator) to stop the scan loop and relieve the disk bottleneck.
- Stop the Defender Self-Scan Loop (PowerShell as Admin)
By default, Windows Defender sometimes repeatedly scans its own folders, causing runaway 100% disk spikes. Open PowerShell as Administrator and add an exclusion for Defender’s own folder:
powershell
Add-MpPreference -ExclusionPath "C:\ProgramData\Microsoft\Windows Defender"
Use code with caution.
(You can also check if a full scan is currently stuck by running Get-MpComputerStatus | Select-Object FullScanAge, QuickScanAge, RealTimeProtectionEnabled.)
- Force TRIM & Optimize the SSD (Command Prompt as Admin)
Because you recently shrank partitions and separated this drive, unmapped blocks or missing TRIM maintenance can cause severe SSD write/read stalls:
cmd
defrag C: /L
Use code with caution.
(The /L flag forces a manual TRIM / Retrim pass on an SSD—it does not defragment it—and clears stalled blocks so the SSD controller can recover speed.)
- Check If Storage Drivers / StorAHCI Bug Are Causing 100% Disk
On some Windows systems, a buggy MSI (Message Signaled Interrupts) mode in the storahci.sys driver causes 100% disk spikes even with very low MB/s transfer rates:
- Open Task Manager (
Ctrl + Shift + Esc) → Performance tab → click your SSD. - Look at Active time vs. Read/Write speed and Average response time:
- 100% Active time with 0–2 MB/s read/write and high response time (>500 ms): Points to a controller/driver stall, full DRAMless SSD cache, or failing SSD hardware.
- 100% Active time with high MB/s read/write (100+ MB/s): Defender is actively scanning large archives, game folders, or virtual machine images.
- Temporarily Pause Real-Time Protection to Confirm
To verify whether Defender is the cause or just a symptom of an overloaded SSD:
- Open Windows Security → Virus & threat protection → Manage settings.
- Toggle Real-time protection Off temporarily (it automatically turns back on later).
- Watch Task Manager for 30 seconds:
- If disk usage drops immediately to 1–5%: Defender is choking on specific files (such as large
.zip/.isofiles, torrent folders, or Steam/game directories—add those folders to Exclusions in Windows Security). - If disk usage stays at 100% even with Defender off: Another process (like
System,SearchIndexer.exe, orTiWorker.exeWindows Update) is pegging the drive, or the SSD is near full / failing.