Switching my Windows 7 Boot Disk from D to C with BCDBoot rather than BCDEdit
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.
About Newsletter
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. :)
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.
I ended up taking option A and nuking it all and reinstalling :(
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.
zFurd
After reboot all was well.
Comments are closed.
However, should I ever run into this problem .. now i know :p