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

Boot-Order, Bios

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:

  1. Create an NTFS partition for windows (using fdisk, GPartEd or whatever tool you are familiar with)
  2. Backup the MBR e.g. dd if=/dev/sda of=/mbr.bin bs=446 count=1

  3. Install windows
  4. Boot into a LiveCD

  5. Mount your root partition in the LiveCD
  6. Restore the MBR e.g. dd if=/media/sda/mbr.bin of=/dev/sda bs=446 count=1

  7. Restart and Ubuntu will boot
  8. Setup grub to boot windows

Also see

DualBoot/Mbr (last edited 2012-09-26 13:19:35 by yannubuntu)