locked
using BCDEDIT to change boot partitions? RRS feed

  • Question

  • I have a drive that contains 2 duplicate bootable partitions. When I use BCDEDIT to change the boot partition from one to the other Windows seems to use the bootmgr from the original partition. What would the BCDEDIT command be to change the bootmgr location from say c to d? I would expect that once Windows booted from d I would be able to rename the bootmgr file on c to bootmgrX and successfully reboot my system, is this possible?

    oregonduckman

    Wednesday, July 11, 2012 12:32 AM

Answers

  • The boot drive is equal to active partition.

    bootmgr and \boot\BCD MUST be on active partition. Also PBR MUST be of type Vista/7.

    For changing active partition diskpart.exe can be used with a script. For changing format of PBR bootsect.exe can be used (one command line).

    The device for {bootmgr} in BCD plays a secondary role - only after you go to advanced boot options and escape (return) then BCD from the specified device is used. 

    ONLY BCD ON ACTIVE IS RELEVANT AS A STARTING POINT !

    • Proposed as answer by Jeremy_Wu Thursday, July 12, 2012 7:33 AM
    • Marked as answer by Nicholas Li Monday, July 30, 2012 2:43 AM
    Wednesday, July 11, 2012 10:37 PM

All replies

  • BEFORE ANY CHANGES TO BCD - DO A BACKUP OF BCD AND HAVE A RECOVERY CD/USB READY !!

    I would suggest using Visual BCD Editor - a complete BCD GUI, so you don't have to go to command line and remember syntax and semantics of different command options.

    The tool displays the contents of BCD in a structured explorer like way and allows selection and edits on every single item be it a loader or its elements.

    For changing a device element - you simply select the new drive letter from a list and confirm.

    For a Vista/Windows 7 loader you should change the "ApplicationDevice" and the "OSDevice" elements, the first specifies device(drive_letter) for winload.exe, the second element specifies the root of the system.

    -------------------------------------------------------------------------------------------

    Windows 7 always boots to active partition - from active partition the file bootmgr is loaded and also the \boot\BCD store is read from active partition.

    Using Disk Management you can see which partition is marked active - it is either a small (about 100 MB) "System Reserved" partition or the Windows 7 partition.


    • Edited by BoYans Wednesday, July 11, 2012 6:08 AM added explanation for ApplicationDevice and OSDevice
    Wednesday, July 11, 2012 5:53 AM
  • Thanks for your suggestion but I need to include this functionality in a Windows Embedded Standard 7 product that has no UI just a command line. Do you happen to know the settings that would change the boot drive say from C to D? I have the commands to change the device and osdevice partitions but not the command to change the boot drive.

    oregonduckman

    Wednesday, July 11, 2012 4:18 PM
  • The boot drive is equal to active partition.

    bootmgr and \boot\BCD MUST be on active partition. Also PBR MUST be of type Vista/7.

    For changing active partition diskpart.exe can be used with a script. For changing format of PBR bootsect.exe can be used (one command line).

    The device for {bootmgr} in BCD plays a secondary role - only after you go to advanced boot options and escape (return) then BCD from the specified device is used. 

    ONLY BCD ON ACTIVE IS RELEVANT AS A STARTING POINT !

    • Proposed as answer by Jeremy_Wu Thursday, July 12, 2012 7:33 AM
    • Marked as answer by Nicholas Li Monday, July 30, 2012 2:43 AM
    Wednesday, July 11, 2012 10:37 PM
  • Would you care to share the specific commands for what you are suggesting, (further explanation of each command's parameters would be helpful)? It seems like you are suggesting the following sequence of commands:

    1. diskpart <some parameters> to change the active partition. 

    2. bootsect <some parameters> to change the format of the PBR

    3. bcdedit {bootmgr} to change the partition of the boot manager that is use.

    Thank You...


    oregonduckman

    Monday, July 30, 2012 5:28 AM
  • Using Visual BCD Editor (a complete GUI for BCD) you can edit a BCD file on any Windows accessible device not just the system BCD (which is always on active partition).

    You can copy a BCD file, edit and then copy to any folder and drive. I assume you do not develop things in a command line only environment.

    Visual BCD Editor can write boot sectors and MBR too (implemented with bootsect.exe - the tool lets you select the needed parameters comfortable in a GUI).

    If you want to use bootsect.exe end bcdedit.exe on command line please consult Microsoft documentation. I doubt I can write better documentation.

    For changing active partition using diskpart.exe see http://www.boyans.net/RepairWindows/RepairWindows7Booting.html - you put the needed commands in a script file say "diskpart.txt" and then execute "diskpart /s diskpart.txt".

    You seem not to understand that BCDEDIT DOES NOT CHANGE BOOT MANAGER.

    BOOT MANAGER IS ALWAYS ON ACTIVE PARTITION.

    IF YOU WANT TO EXECUTE ANOTHER BOOT MANAGER - YOU CHANGE ACTIVE PARTITION using a disk manager.

    Monday, July 30, 2012 1:22 PM
  • The solution you are suggesting does not seem to work (or I am not implementing it correctly), the steps I am using are as follows (keeping in mind the C and M are clones of each other where M was created by using imagex /create and image /apply).

    1. use disk partition to make the D drive the active drive

    2. use bcdedit to make the boot manager M active on the next reboot

    3. once the system boots to the M drive I use imagex /apply to re-image the C drive (imagex fails with the error message=32 which essentially states that the operation cannot complete because of an active process on the target drive, in this case the C drive)


    oregonduckman

    Monday, July 30, 2012 4:53 PM
  • Windows 7 boot sequence for HDD:

    1. BIOS code - init devices and some tests,

    2. then code from MBR on FIRST DISK loaded and executed (fix MBR -> bootsect.exe)

    3. then code from ACTIVE partition boot sector (first disk) loaded and executed (fix PBR -> bootsect.exe)

    4. then bootmgr from ACTIVE partition (first disk) loaded and executed (fix bootmgr -> bcdboot.exe)

    5. then bootmgr reads "\boot\BCD" from ACTIVE partition (first disk) and displays boot-menu (or loads and executes default loader if only one boot-menu entry present)

    Fix BCD -> bcdboot.exe.

    Hope this helps.

    Tuesday, July 31, 2012 7:15 AM
  • Question. Various flavors win7 win8 client and server on various partitions of first drive; the win8 client shipping rtm partition is active, has bootmgr and \boot\bcd. So far so good.

    win8 has a graphical presentation style for the multi-boot menu; win7 and some others have a text presentation style.

    ISSUE: sometimes system changes NOT intended to toggle the menu PRESENTATION STYLE, do so anyway. So far fixing this has been accidental - the newest installed OS in the multi-boot menu seems to set it; certain OTHER changes will toggle it.

    QUESTION: where is the value that sets the presentation style, what are the formats, how is it edited - bcdedit or otherwise?

    Sunday, November 11, 2012 6:29 AM
  • @johnwerneken,

    For boot menu style (metro or text) see http://www.boyans.net/BootMenuPolicy.html

    The default boot loader/boot menu entry/ is relevant for boot menu style.

    Sunday, November 11, 2012 7:35 AM
  • I thought that yesterday morning but setting that value to standard did not bring back the style from the Interface Formerly Known as Metro, even though the same partition was system, active, primary, and default. setting device and osdevice did not either. running bootsect.exe and bcdboot.exe {win8DrivePartition}\windows /s {Win8DrivePartition} however did, which idea I thank you for.

    The think that broke it, toggled back to legacy, was deleting the last installed os partition, a time-limited win8 RTM, the install of which is what I did to reclaim the "Metro" style for the earlier-installed win8 shipping licensed RTM.

    Prahaps you might do what I did: install win 8 shipping RTM then some windows that normally toggles it to legacy then another win8 rtm to toggle it back then delete the partition for that second win8, I bet you get legacy and can't fix it without your tip, use bcdboot.exe. As bcdboot.exe does some other stuff - renamed my partition volume, screwed up skydrive for a minute - I'd like to know of a non-WMI way of fixing this other than the bcdboot.exe. I don't want to have to learn programmatic editing of mbr/pbr...

    • Proposed as answer by johnwerneken Monday, November 12, 2012 11:24 AM
    Monday, November 12, 2012 3:45 AM
  • Thank you.
    Monday, November 12, 2012 3:45 AM
  • @johnwerneken

    Microsoft has supplied the command line utilities bcdedit, bootsect and bcdboot in Windows 8.

    1. You use bootsect.exe for fixing boot records (MBR and PBR)

    2. You use bcdedit to change contents of BCD

    3. You use bcdboot to fix BCD and boot environment.

    I do not use bcdedit, I can do all operations using Visual BCD Editor as VBCD Editor is a complete GUI replacement for bcdedit.

    There is the tool "Dual-boot Repair" that comes with VBCD Editor to automatically fix a dual, tripple, multi-boot system - YOU JUST CLICK "Automatic Repair" and boot to LATEST Windows version is fixed.

    In Visual BCD Editor you use right-click + "Create missing loaders" and all Windows installations present on computer are added automatically to boot-menu.

    If you cannot use this automatic functionalities which are unique - no other utility or tool offers such automatic handling of boot configurations in Vista or later - I have to implement "THE ULTIMATE ONE CLICK SOLUTIONS TO MULTI BOOT PROBLEMS" for lazy people who are not willing to learn and understand Windows boot process.

    Multibooting is not for lazy people - you should invest some time to learn about boot process and what is happening when you switch on computer, this is not rocket science !

    SEE ALSO MY POST FROM 31 July for Windows 7/Vista/8 boot sequence.

    On http://www.boyans.net there are several posts on how to fix Windows booting.

    I am sorry not having implemented till now the "ULTIMATE ONE CLICK SOLUTION FOR FIXING MULTIBOOT".

    Monday, November 12, 2012 10:28 AM
  • not a problem i'm not lazy just don't get that far under the hood that often. as noted I fixed it with bootsector.exe. still wondering exactly wtf the tools actually do, as the os and the tools do things maybe they should with results I have to clean up later.

    I will try your new product, also let you know if I see anything useful for me to report. I assume it works as you say but then so did bootsect.exe.

    I will also treasure your other referenced post.

    Monday, November 12, 2012 11:22 AM
  • The above post is July 30 not July 31 and it did help, is why I tried bootsector.exe with ultimately satisfactory results.

    NEW QUESTION: is your tool available for simple users of Win8 Pro build 9200 shipping rtm? I am reluctant to download a trial labeled "enterprise" as I have no enterprise besides myself and my own several computers. I'm assuming the purchase price of an "enterprise" edition of anything would not reflect consideration for my single-user budget lol.

    Monday, November 12, 2012 11:27 AM
  • " not a problem i'm not lazy just don't get that far under the hood that often. as noted I fixed it with bootsector.exe. still wondering exactly wtf the tools actually do, as the os and the tools do things maybe they should with results I have to clean up later. "

    ------------------------------------------------------------

    Microsoft tools are not bad they do the job they are designed for. Usually the tools are general tools - with many options and functionalities as they have to cover many cases.

    Every tool does not do more than it is documented. The documentation is not very good sometimes so you have to try. Always do a backup before starting any changes so you can restore later if something goes wrong.

    There is a Win8 Enterprise Evaluation version free for 90 days. Download and install to try it out.

    I would suggest you install it in a VHD file - you need say 20-30 GB VHD, no special partition for it.

    Sorry if I offended you with being lazy.

    Monday, November 12, 2012 1:28 PM
  • no offense taken nor intended, I appreciate both your knowledge and willingness to share it. Thank you.

    perhaps I will try your tool and the wmi documentation as to bcd, pbr, mbr stuff; perhaps my interest in understanding what bcdboot and the installers do, that does not seem to show up in the setting the various bcdEditors access and reveal, will be satisfied. There just seems to be slightly more going on than meets the eye, so to speak.

    Tell you what. If I come to think I have found part of the answer, I'll share it. Perhaps you will be able to judge the utility and accuracy of it, or benefit from knowing, if you don't know already; I am guessing you may well know, having built that tool.

    Tuesday, November 13, 2012 12:01 AM