Scott Hanselman

Switching my Windows 7 Boot Disk from D to C with BCDBoot rather than BCDEdit

May 08, 2009 Comment on this post [22] Posted in Musings
Sponsored By

Disclaimer: It's very likely that I have NO idea what I'm talking about. This is a blog, not a technical article or official anything. Listening to me may well kill your pet kitten and render both your computer and you personally unbootable. Run away in fear as this is all completely useless information.

I paved (reformatted and started over) my main machine, formerly named QUADPOWER, now QUADPOWER7 to use the new Windows 7 RC a few days ago. I went through the process, but wasn't really paying attention. I have a tendency to just Next>Next>Next>Finish my way through most wizards. This will likely be the death of me at some point.

Anyway, my system is a little non-standard and I had at some point a year ago switched hard drives around to make the faster one be my boot drive. I did this by changing the boot order in the BIOs.

Fast forward a bit, and today I wanted to format my DATA drive - my D: drive - and the format applet said "not so fast."

I opened up Disk Management and it showed me this...


Yikes! See how my D: drive is Disk 0 and is marked as System, but my C: drive is Disk 1 and marked as Boot? That means that the Boot Configuration Data (BCD) is on my D: drive. I checked my BIOs, and it turned out, in fact, that I had told it to boot of that drive. However, I'd installed Windows to the other drive and got myself into this situation:

  • Disk 0 - D: Drive with BCD
  • Disk 1 - C: Drive with C:\windows and other booty

I couldn't format D: because it was what I booted off of. Poop.

I searched around and found all sorts of hard and scary descriptions of how to fix this. Basically it boiled down to:

Approach 1: Nuclear Option. Wipe and Start Over.

Approach 2: Copy the Hidden/System Boot Manager and Boot Folder over to the C: drive and run a tool called BCDEdit to move things around in 12 short steps. ;)

This was a scary prospect for me, because from my point of view, while this was a fairly advanced operation, I just wanted to switch where the boot info comes from.

Turns out there is a new (profoundly advanced, you have been warned) command line tool called BCDBoot.

C:\windows\system32>bcdboot /?

Bcdboot - Bcd boot file creation and repair tool.

The bcdboot.exe command-line tool is used to copy critical boot files to the
system partition and to create a new system BCD store.

bcdboot <source> [/l <locale>] [/s <volume-letter>] [/v]
[/m [{OS Loader ID}]]

source Specifies the location of the windows system root.

/l Specifies an optional locale parameter to use when
initializing the BCD store. The default is US English.

/s Specifies an optional volume letter parameter to designate
the target system partition where boot environment files are

copied. The default is the system partition identified by
the firmware.

/v Enables verbose mode.

/m If an OS loader GUID is provided, this option merges the
given loader object with the system template to produce a
bootable entry. Otherwise, only global objects are merged.

Examples: bcdboot c:\windows /l en-us
bcdboot c:\windows /s h:
bcdboot c:\windows /m {d58d10c6-df53-11dc-878f-00064f4f4e08}

This means that I could type this from an Administrator Command Prompt:

bcdboot c:\windows /s c:

And BCDBoot would basically re-gen the BCD stuff I needed on the C: drive given what it knows about the C:\Windows install.

I ran it, and rebooted. I immediately went into the BIOS and changed the Boot Order so that my 300 GIG C: faster drive (the one I thought I was booting off of all the time) was my startup drive.

Now, Disk Management shows that C:\ is both System and Boot and all is right with the world.


More subtle awesomeness from Windows 7.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
May 08, 2009 1:23

However, should I ever run into this problem .. now i know :p
May 08, 2009 1:37
You could also shrink the system partition on the system drive by 100MB in the beginning of the system partition/drive. Then create a 100MB partition, mark it active and copy the boot stuff to the other drives small partition and then remove its drive letter, if you assigned one. This works on Vista, should work on 7 and makes you BitLocker capable.
If it breaks your boot, put in the DVD and run an automatic system repair.

PS: The disclaimer is kind of an awesome way to waste space. :)
May 08, 2009 1:48
Perhaps a better plan Scott would have been to have TWO fast drives to start with. Problem solved. :) AdSense $$$ FTW!
May 08, 2009 5:16
Best disclaimer ever.
May 08, 2009 5:20
That's not what I was expecting from my openID login, what's the deal?
May 08, 2009 5:43
That would have been a scary reboot.
May 08, 2009 6:25
A related tool is bootsect.exe, found in the boot found on Windows Vista and newer install discs. This can be used to update the master boot code on a disk partition.

If you want your computer to still boot after using diskpart.exe to change your active partition, you can use bootsect.exe.

This tool is particularly handy when duel booting XP and Vista, as they use different master boot code.
May 08, 2009 11:01
A cool best practice!
May 08, 2009 12:17
Shivers! I could have done with this information last weekend!
I ended up taking option A and nuking it all and reinstalling :(
May 08, 2009 13:34
Hey Now Scott,

That disclaimer is funny. Nice post.

Hanselminutes fan,
May 08, 2009 13:35
Best disclaimer ever LOL!!!
May 08, 2009 16:14
Bring back boot.ini!
May 08, 2009 16:24
Couldn't EasyBCD have helped you out in this case?
May 08, 2009 19:10
Subtle Awesomeness is a pretty accurate description of Win7 so far in my experience.
May 09, 2009 17:04
Why didn't you just upgrade your beta copy to RC in place? I did this to my machine and it worked flawlessly and I have no issues. Microsoft has an unsupported page that explains how to do this. Basically, just edit the cversions.ini file on your ISO image and you're done.

Of course, I did a regular upgrade from Vista Business to Win7 RC on my work PC and the upgrade went fine, until the reboot. Then I got System boot drive or something not found. My work machine used McAfee SafeBoot to encrypt the drive. I think I should have decrypted it befored doing the upgrade. At any rate, I did a new install of RC and it seemed to run very well. Only problem at this point was that I couldn't get SafeBoot to install under Win7. So back off to reinstall Vista and get my work machine back in operation before Monday.

Needless to say, I wasted about 12 hours of my life (again) on installing Windows over a weekend.

Luckily for me the Vista full PC backup to USB drive worked fine and I was able to quickly build a Vista VM and restore my image backup to it to get my critical files off to copy over to my new machine.

How many years have all of our lives been wasted on installing, reinstalling, installing, reinstalling Windows over the course of 10+ years? Geez.
May 09, 2009 17:50
Been there. I wish I had Win7 then...
May 14, 2009 13:54
I just wanted to thank you, Scott. I was in the same situation and it worked like a charm! ;)
May 20, 2009 5:32
It looks to me like microsoft technicians did not test an installation of Windows 7 on a PC having two drives, one of them with an existing OS. I had the same problem. Had to solve it with bcdedit. NOBODY should have to solve problems like this. They wouldn't if microsoft did a proper job of testing installations.
January 02, 2010 5:30
Cheers worked a treat had exact same problem and it resolved my issue. Wish the boot.ini days still existed :(
January 22, 2010 8:38
I tried this and it didn't work for me, so I kept fiddling around until i got it to work. On a fresh install of windows 7, i tried to switch to c: drive from another drive, and it would copy boot files, but wouldn't ever boot from that drive. Turned out my c drive wasn't flagged as "active", so in disk management i right clicked on the partition, and selected "make active", then ran the bcdboot tool.

After reboot all was well.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.