Showing posts with label MBR. Show all posts
Showing posts with label MBR. Show all posts

Wednesday, August 21, 2013

WinPE / BCDBOOT: Failure when attempting to copy boot files. (Solution)

From time to time, when repairing an MBR or just applying BCDBOOT for a new image, you may occasionally get this error: Failure when attempting to copy boot files.

When this happens, your new image or computer will not boot from hard drive.

Some may have investigated that even further and discovered you can "force" BCDBOOT with /S command to your drive and it works correctly.  When this happens, your new image still may not boot!  Why?

Sometimes it will work and sometimes it won't work seemingly random.  It isn't necessarily the same machine, not necessarily the same OS, or OS version.  What gives? I have finally discovered for myself what the hell is wrong with this thing.

The trick I found out was HOW I was getting into WinPE or PXE.  If I am doing a LEGACY boot of the USB (WINPE), BCDBOOT would work successfully.  If I am doing a UEFI/EFI boot WinPE environment, it would not work!  Puzzling, but at least I know how to fix this!

Basically what happens:
If you boot your WinPE drive via UEFI interface / options, BCDBOOT will default to try working with GPT and EFI firmware.  With an EFI reserve partition missing because it wasn't created you get: Failure when attempting to copy boot files.

If you boot your WinPE drive via BIOS / LEGACY options, BCDBOOT will default to try working with MBR and BIOS firmware.

That's okay if you can't or don't want to run LEGACY!

The EXTRA commands need to be thus for generating the old MBR style drive!

Step One:
Your Windows partition is still active.  We will call it W:\

Step Two:
Your System partition exists!  We will call it S:\

Step Three:
You have applied your image (or the location of Windows already exists.) to W:\

Step Four:
Command to finalize the MBR (under UEFI mode) is this:
bcdboot W:\Windows /s S: /f BIOS

Conversely, if you are booting non-EFI to USB drive, but your drive is GPT and UEFI you will want to run this:
bcdboot W:\Windows /s S: /f EFI
Where S: in this case is the EFI partition, necessary, for those drives.

Hope that helps!