How do I move the Windows 7 Boot Files (bootmgr, ...) to a different drive?

I wanted a dual-boot setup. So first I installed Windows 7 on the 1st partition of one hard drive (we'll call it HDD1), and then I went to install Ubuntu 9.10 on the second partition of HDD1. Unfortunately, this didn't work (it bypassed GRUB2 and went straight into Windows). I decided to reinstall Ubuntu, and that's when I noticed that (for some reason) Windows decided to place its boot files on another hard drive (we'll call it HDD3).

I'd like to fix this - I want to move the boot files from HDD3 to HDD1. It may help fix my dual-boot issue, but even if it doesn't, in my experience, it'll save a lot of headaches down the road. How can I do this? I'm going to assume its not as easy as just copying the files, but I'd like to be proven wrong :)


Solution 1:

Through some Googling, I found the following solution (I use HDD1 and HDD3 to represent the two hard drives I care about, as referenced above in my question):

  1. The boot files consist of a folder called Boot and an application called bootmgr. They are system files, and so are normally hidden. You must make them visible.
  2. Copy them both from HDD3 to HDD1. It will complain that two files cannot be copied: BCD and BCD.log, both of which are in the Boot folder. The latter is unimportant (it's just a log file) and can be ignored; the former will be copied in the next step.
  3. Open a Command Prompt with Administrator privileges. Type the following command: bcdedit /export HDD1:\Boot\BCD, where HDD1 is the driver letter of your destination drive. In my case, HDD1 was C, so the command was bcdedit /export C:\Boot\BCD.
  4. Now, you have to edit the BCD file so that the entries are all correct. I used the bcdedit program which comes with Windows 7, but there are others. I've heard EasyBCD is pretty good (and free), but the latest version doesn't fully support Windows 7. I believe a new version that does support Windows 7 will be out shortly. First, I navigate to HDD1\Boot on the command prompt (with Admin privileges) and type bcdedit /store BCD /enum ALL. I use the /store switch to specify the BCD file in the current directory - omitting this switch will use the default one I think, which is on HDD3. This command lists all the entries in the BCD file.
  5. I scanned the entries, and it turns out that the entries for {bootmgr} and {memdiag} both point to HDD3. Of course, I want them to point to HDD1. So I issue commands in the following form: bcdedit /store BCD /set [entry_name] device partition=HDD1:. Since HDD1 is C on my machine, I would type the following to set the {bootmgr} entry: bcdedit /store BCD /set {bootmgr} device partition=C:.

That's about it. One last step is to make HDD1 Active via Disk Management (accessed from Computer Management) - it was already Active on my system, so I didn't have to do anything.

Now, as for the weird dual-boot problem, it turns out I forgot that I had physically switched the order of the hard drives. As such, the BIOS boot order was incorrect (it was trying to boot from HDD3 first, instead of HDD1). And yes, that was an incredibly stupid mistake on my part :)

Solution 2:

The easiest way is to just download and install the free EasyBCD: http://neosmart.net/dl.php?id=1

On the "BCD Backup/Repair" page of EasyBCD, there's an option called "Change Boot Drive" which will bring up a list of all local disks. You just pick the disk you want, and EasyBCD will automate the entire process for you, including making the selected partition active and bootable, importing the old bootloader contents, and writing the MBR.

(Disclosure: I'm the author of EasyBCD)