Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have 2 drives in my PC one is primary master and used to be the system drive with windows XP installed. The second one is secondary and has Windows 7 installed that I'm using as the operating system. I want to decommission the old hard drive with XP and re-plug the Windows 7 one as the primary master so I could boot from it.

What is the safest way for me to write the correct boot sector on the Windows 7 hard drive so I don't ruin my Windows 7 installation?

share|improve this question
    
When you installed Win7 on that drive, it was made to be bootable. What makes you think that it now needs a "correct boot sector"? Why not just try to boot from it? –  sawdust Jun 23 '12 at 9:19
    
@sawdust: I'll try, but I'm pretty sure that there is no point of installing a bootsector by the OS installer to a secondary HD, since it's unlikely it's ever going to be used. –  zespri Jun 23 '12 at 9:21
    
How do you install Win7 on a "secondary HD"? Everytime I install a Microsoft OS, it thinks it is on the primary drive and will be the primary OS. MS does this to avoid user mistakes. You cannot finish the Windows OS install process without booting into the partition that received all of the copied files. But if you are so sure then don't bother! –  sawdust Jun 23 '12 at 9:49
2  
@sawdust: when you install a microsoft os it allows you to select drive / partition to install. The drive you select does not have to be the boot drive. A boot sector is written to the boot drive, which will in turn load the OS from a secondary drive. –  zespri Jun 23 '12 at 21:13
2  
@sawdust: on a conventional BIOS-based PC, if there are two drives, the boot code has to be written to drive 0 (as determined by the BIOS) because this is the only one the BIOS will boot from. If you ask Windows setup to install on a different drive, it will install a "system partition" (containing the boot code) on drive 0. –  Harry Johnston Jun 24 '12 at 22:08

4 Answers 4

The easiest way of doing this is to simply swap your drives as you'd like, and then boot off of the Windows 7 CD, and select "repair my computer". Once the new window pops up, simply click the option for "fix problems that are preventing me from starting windows", and let that process do its thing.

Usually, it will fix it all on its own - if not the first time through, then the second. Another option is to simply use FIXMBR in the recovery console, accessible via the same menu.

Windows tends to be pretty sturdy these days when it comes to fixing itself with boot issues, I've done some pretty crazy stuff with MBR/bootsector stuff, and getting Windows to take over again is usually the absolute easiest part.

share|improve this answer

The utility to write Windows 7 boot sectors - bootsect.exe - part of Windows 7 Recovery.

bootsect /nt60 c: /mbr

writes bootsector in Win 7 format to c: and Windows MBR to disk where DOS_drive (partition) "c:" is placed.

Windows 7 install (also StartUp Repair) usually writes PBR to active partition and to partition where Win 7 system is installed. (active and installation partition can be different partitions !)

bootsect /nt60 ALL /mbr

writes Win 7 boot sectors to all Windows partitions (NTFS, FAT32) excluding "foreign" Linux partitions. MBR is written to first disk.

share|improve this answer
    
In this scenario, writing the boot sectors isn't enough. You also need to install the boat loader and make the partition active. –  Harry Johnston Jun 24 '12 at 22:24

Firstly, make sure you have a working system repair disc before changing the drives around. The Backup and Restore control panel has an option to burn a system repair disc in the left-hand pane.

Then, use bcdboot to install the boot loader:

bcdboot c:\windows /s c:

You will also need to set the partition as the active partition on the drive:

diskpart
select volume c:
active

You might also need to use bootsect (available on the repair disc) to install the master boot record and/or partition boot sector. This usually won't be necessary if the partition was formatted during Windows 7 setup. (Because these live in parts of the disk that are otherwise unused, they're written whether they're needed or not.)

In some situations the boot settings created by bcdboot will no longer be valid after shifting the drives around. If the system doesn't boot, use the repair disc. You can either go to a command line and run the bcdboot command again, or just let the automated repair fix the problem for you.

share|improve this answer
up vote 0 down vote accepted

I have not gone ahead with my plan, since I was unsure if any ways of doing these are reliable. I took an opportunity to install new Windows 8 on a clean "master" drive and then just re-install/copy over stuff from the old disk. This was not the answer I hopped for, but the most reliable thing I could be confident of.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.