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!
Thanks mate, this was very helpful!
ReplyDeleteThanks Tristan, you saved me some valuable time today and you also explained what was going on which I actually understood. Pat yourself on the back and feel good for the rest of the day :)
ReplyDeleteThanks Tristan :p
ReplyDeleteThanks alot man! It helped me realize that in the RE cmd prompt, my windows installation was showing up as drive "E" and thus I needed the command, "bcdboot E:\windows /s (etc, etc.). Also thanks for noting the difference between GPT + UEFI, and MBR + BIOS options.
ReplyDeleteThank you Tristan! This helped me to fix the boot issues. Your the man!
ReplyDeleteThank you Tristan! You have saved me a lot of time.
ReplyDeleteYou're a damn hero. Appreciate the post.
ReplyDeletegood post
ReplyDelete