Each hard-drive (or Cd or other drive or device) has only 1 Master Boot Record. It is in a fixed position on the hard-drive and is mainly just for pointing to where the boot-loader is stored on the system.
During a machine's boot-up process the bios is arrived at quite early on. The bios has a list called the "boot order" which specifies which drive or device to look at to find the "boot-loader" for 'the' operating system. Each drive or device has 1 set location that contains the first part of 'the' operating systems boot-loader, we call this the Master Boot Record (or MBR or Mbr) for short.
Commonly Believed Myths
1. Contrary to popular belief the Mbr does NOT belong to the operating system, it belongs to the drive or device. Often people may say "the Windows Mbr gets broken" but what this really means is that the drive's Mbr will no longer point at Windows. To add to the confusion the Windows command-line uses "fixmbr" to get the Mbr pointing at the Windows boot-loader.
Normally we use the word "fix" to mean "mending something that was broken", however there are many other meanings. In the Mbr's case the real meaning is more like "fixing the result of a race/match to help with betting". Often in movies or other popular fiction we see boxing matches or horse racing, sometimes runners, being deliberate 'fixed' before the event.
2. We often refer to 'the' Mbr because when the bios finds an Mbr that seems to work then the machine uses just that 1 Mbr to continue the boot-process. Internal hard-drives cannot usually be distinguished between by the boot-order list and so only the Mbr on the Primary Master hard-drive is mentioned. It is possible to switch the internal drives around so that the bios thinks a different hard-drive is the Primary Master one but that involves messing around with the hardware inside the machine. Be careful!
Fix the Mbr for Windows
This will set the Mbr to point at the Windows boot-loader. The Windows boot-loader can normally only boot into Windows, unless you edit it. See RestoreUbuntu/XP/Vista/7Bootloader
Which drive or device does the machine look at first, and which 2nd, when it tries to find where to continue booting-up from? The answer is in the Bios and is listed in "Boot Order".
Please see this guide to help change the boot-order of the machine. It is specifically for helping boot-up from Cd but also makes it obvious what to do for other cases. Mostly bioses will not let you choose which internal drive to boot-up from. Some do, but most only allow you to boot from the Primary Master hard-drive internally.
MBR Back-Up and Replacement
Back-up the existing MBR, install Windows, replace your backup overwriting the Windows boot code:
- Create an NTFS partition for windows (using fdisk, GPartEd or whatever tool you are familiar with)
Backup the MBR e.g. dd if=/dev/sda of=/mbr.bin bs=446 count=1
- Install windows
Boot into a LiveCD
- Mount your root partition in the LiveCD
Restore the MBR e.g. dd if=/media/sda/mbr.bin of=/dev/sda bs=446 count=1
- Restart and Ubuntu will boot
- Setup grub to boot windows