Jump to content

Help with bcdboot


ghines

Recommended Posts

Hi all,

I'm booting WinPE via a USB HDD with 2 partitions and applying my image to the internal HDD. This works well but my images are of only the System partition and don't contain any of the boot files contained in the boot folder, so I need to use the bcdboot command to copy the boot files onto the internal HDD.

My question is therefore what is the correct bootbcd command given the following.

C Drive in the boot partition on the USB

D Drive is the second partition on the USB containing all my images

E Drive is the internal HDD that I just applied the image to.

Is it BCDBOOT e:\windows /s c:

Or something else. Plus do I need to CD to a particular drive before I execute the command?

TIA

Greg

Edited by ghines
Link to comment
Share on other sites


ghines, I suspect your c: and e: are reversed. See this MS TechNet article. Please let us know what you learn. Enjoy, John.

EDIT: BCDboot not bootBCD. In a command prompt enter 'BDCboot /?' (no quotes) and get instructions.

No C: and E: are not reversed. I boot from my USB HDD and the new HDD that is to have the image applied to is unformatted and unpartitioned. I then clean, partition, format, set active and assign the new HDD, which gives the new HDD the next drive letter E:. I then apply my image to E:

Have read the link but I'm still confused as to the correct BCDBOOT command and whether I should CD to a particular drive before I issue the command.

Any help would be appreciated.

Greg

Link to comment
Share on other sites

You only need to use BCDBoot.exe if your HDD has more than one partition. If it is a single OS partition, you don't need it.

And the files that are missing in the "source" will appear, materializing from thin air? :w00t::unsure:

This works well but my images are of only the System partition and don't contain any of the boot files contained in the boot folder, so I need to use the bootbcd command to copy the boot files onto the internal HDD.

BCDboot first copies needed files (from the booted environment, the WinPE in this case) and then sets the BCD "properly".

Just for the record, MS names partitions the "wrong" way:

http://www.multibooters.co.uk/system.html

You say Tomato

Microsoft calls the partition with the boot files the System partition, and the partition with the operating system the Boot partition. Everyone else refers to them exactly the other way round. The boot files on the boot partition. The operating system on the system partition.

When someone talks of "Boot" and "System" volumes he/she should always specify if the used convention is the "right" one or the "reversed" MS way.

jaclaz

Edited by jaclaz
Link to comment
Share on other sites

You only need to use BCDBoot.exe if your HDD has more than one partition. If it is a single OS partition, you don't need it.

And the files that are missing in the "source" will appear, materializing from thin air? :w00t::unsure:

Well lets put it this way. I can do an install with a System Reserved partition (where the boot files are located), then capture just the OS partition, redploy it as single partition and it will boot. Have there been any documented cases of where NOT using BCDBoot.exe on a single partition disk causes Windows not to boot? From my experiences, BCDBoot.exe is only needed when you have multiple partitions with bootable OSes.

@OP, you don't mention what made this image. Is it Imagex, DISM or something else? You also don't mention what OS the image is of, and if you are deploying to MBR or GPT disks.

There are some conflicting documentation as to how to run BCDBoot.exe. Some may say run it from the WinPE ramdisk (x:\windows\system32\bcdboot.exe) but I have seen other documentation saying to run it from the deployed OS path (e:\windows\system32\bcdboot.exe) which I've never gotten to work. You could alternatively copy it from the deployed OS to the ramdisk... or just keep it in your WinPE image.

I've also run into problems with the C: being take up already when booting into PE for imaging (except Windows 8) which I solve by using a diskpart script. It basically takes whatever is assigned to C: and changes it to something else that isn't taken. This way there is no problem with your deployed OS being installed to a partition assigned with C:\.

Link to comment
Share on other sites

Thanks everyone for all your input, but no one has answered my original questions. I will recap and add a bit more information that might be helpful. I'll use the MS convention for naming the partitions.

I place a new HDD, unpartitioned and unformatted, into a laptop. I boot the laptop via a USB HDD that has 2 partitions. They System Partition of the USB HDD gets assigned C while the other partition containing the images is assigned D.

I now use DISKPART to prepare the new HDD, clean | create par pri | format fs=ntfs quick | active | assign. Now the new HDD has the drive letter of E.

I apply my Windows 7 image to the new HDD using imagex. However this image is only of the Boot Partition and therefore does not contain a boot folder in the root directory.

To make this new HDD bootable I need to use the BCDBOOT command, but what is the correct command and do I need to run the command from a particular location?

TIA

Greg

Link to comment
Share on other sites

Thanks everyone for all your input, but no one has answered my original questions.

Oh, yes, johnc did allright.

http://technet.microsoft.com/en-us/library/dd744347(v=WS.10).aspx

Simplified:

BCDboot <source path> [options] <target drive>

What System (the PE, aka "source") do you have running?

Do you have a C:\windows or a D:\Windows when you boot from the USB hdd (before you partition format the PC internal HD)?

Just open a command prompt and in it type:

SET Windir

If you have C:\Windows you run:

BCDboot C:\Windows /s E:

jaclaz

Edited by jaclaz
Link to comment
Share on other sites

ghines, here is an interesting article about doing a similar process as you. The article uses the BCDboot on the target system partition (D: in this case) to do the file copy and only specifies the first parameter for the command. I suspect this means that the files come from the X: partition (WinPE, ie from the firmware) which must be of the same architecture (32/64 bit) as the target system. Please let us know if this helps. Anyone please correct me if I am wrong! Enjoy, John

Link to comment
Share on other sites

Well, while my assertion that I've never used BCDBoot on a single partition deployment is true... and that it may not be 100% accurate for everyone... THIS is: BCDBoot x64 binary can write to both a deployed x86 or x64 OS. I had problems with 32bit BCDBoot from Win7RTM time doing both, and switched to 64bit exclusively. Also, BCDBoot from WinPE4 works with Windows 7 as well as Windows 8.

Link to comment
Share on other sites

ghines, here is an interesting article about doing a similar process as you. The article uses the BCDboot on the target system partition (D: in this case) to do the file copy and only specifies the first parameter for the command. I suspect this means that the files come from the X: partition (WinPE, ie from the firmware) which must be of the same architecture (32/64 bit) as the target system. Please let us know if this helps. Anyone please correct me if I am wrong! Enjoy, John

Yes, interesting article. Thanks

What I don't understand is how BCBboot "knows" to copy the boot files to drive C? Also why was Drive D made active and not Drive C? My understanding is the boot folder and its associated files should be placed in the 100MB partition, Drive C in this case, and that should be the active partition. Reading this article suggests to me the 100MB partition is empty and is doing nothing at all except taking up space. Please correct me if I'm wrong.

Greg

Link to comment
Share on other sites

When using a System Reserved partition, that is the one that is made active. Technically, the System Reserved partition is only needed if you have more than one bootable partition. There are boot files in that partition. This is how computers with Recovery Partitions will boot to repair mode if Windows can't boot, because the boot files are kept elsewhere. During a deployment, the System Reserved partition is empty. When the OS boots for the first time from a sysprepped state, it should copy the bootloader into there.

After the OS boots and you are at the desktop, you can go look in the System Reserved partition. Any folders/files in there will be marked as Hidden System, so you'll have to dir accordingly. Also, if you assign a drive letter to it, you should unassign the letter afterwards unless you are using this just for testing.

Again, you do not need a System Reserved partition unless you have multiple bootable partitions and want to use BCD to handle them.

Link to comment
Share on other sites

BCDBoot x64 binary can write to both a deployed x86 or x64 OS.
Tripredacus, I have been wondering where the files/data comes from for BCDboot to write. Is it all contained in the BCDboot.exe file or on a disk (either from firmware or pointed to)? Somewhere, sometime ago, I found a statement that the WinPE and the target system of the BCDboot needed to be the same architecture. Do not have a reference handy.

ghines, you are welcome. I don't think you have answered the question from Tripredacus if you are dealing with an MBR of GPT disk. It may make a difference. I found this MS UEFI document earlier when searching for a different problem and DLed the document. I have not read the document but kept it for reference (I run a GPT disk).

Enjoy, John.

Link to comment
Share on other sites

I think maybe at stock. But I'm using WinPE 3.1 x64 with BCDBoot from WIn7pro sp1 x64, and WinPE4 with stock BCDBoot.exe. I never looked into how it does what it does. It might be true that Windows 7 BCDBoot does not work with Vista, I always try to keep new OSes separate if I can.

Link to comment
Share on other sites

ghines, you are welcome. I don't think you have answered the question from Tripredacus if you are dealing with an MBR of GPT disk. It may make a difference.

Sorry, it's MBR.

Johnhc, Thanks for the link to the MS UEFI Document. The important couple of lines for me are:-

4. Copy the boot files to the system partition.

W:\Windows\System32\bcdboot W:\Windows /s S: /f all

Note the Source is where the Windows Image was applied and the destination is the System Partition.

Hence in my situation with Windows (WinPE) on C, Images on D and the Image applied to E (the system and boot partition) the command should be :-

E:\windows\system32\bcdboot e:\Windows /s e:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...