mbrbm (Master Boot Record Boot Manager)

Logo of mbrbm

Table of contents:

  1. News
  2. Summary
  3. License
  4. Documentation
  5. Screenshots
  6. Features
  7. Download
  8. ToDo
  9. Contacts
  10. Links


May 20, 2007

mbrbm version 1.1 has been released (Microsoft Vista compatible)

October 23, 2006

mbrbm version 1.0 has been released



mbrbm is yet another boot loader which fits into first sector of an HDD (MBR). It allows to choose which partition to boot and is intended to replace an MBR coming with DOS/Windows. It may boot any primary partition boot record below cylinder 1024.

mbrbm is not an operating system loader. It can not boot Linux or Windows directly (thus it is not a replacement of LILO/GRUB/ntldr for example), but it can boot an appropriate loader from a boot record of a particular partition (again LILO/GRUB/ntldr for instance).

mbrbm's functionality is completely implemented _WITHIN_ the Master Boot Record. It is written in nasm (x86 assembler). On boot it displays a primary partition list with type/size and let the user choose the booting partition by selecting it by number-keystroke. At timeout the active partition is bootet. With no interaction it does exactly what a standard DOS/Windows9x/ME (fdisk /mbr) MBR does.

Restrictions are that it cannot boot via LBA (partitions above cylinder 1024) and extended partitions. It's compatible with DOS, Windows(9x,ME,NT,2K,XP,2003,Vista), Lilo, Grub, xBSD, ... partition boot records.

My usage of mbrbm is primary for servers on which i always put a FreeDOS partition for basic diagnostic and recovery tasks, regardless whether the server is running Linux, xBSD or Windows. There are no driver troubles with DOS accessing the disks, raid, ... the BIOS takes care of it. There are lots of good tools for hardware diagnostic, partition recovery and the like running on FreeDOS.

With mbrbm i have always a spare boot option without complicated boot manager setups - the standard boot method setup of the target OS living in the second or third partition works out of the box with the standard installation procedure of the server OS - no hassle with lilo, grub or BOOT.INI configuration after the installation. And the best part is that i need no documentation of a complicated setup for the other system administrators. This scenario did save my life a few times. Therefore i share it here.

Project goals





  1. Run requirement:
    IBM PC-compatible computer with INT13 BIOS (99.99999% of all computers - even very old ones are Ok)
  2. Compile requirement:
    The mbrbm MBR could be compiled on Linux and xBSD with nasm
  3. Installation requirement:
    Standard Linux, xBSD (dd) or FreeDOS (FDISK) tools (can boot these from CD at installtime)

Installation and uninstallation

The mbrbm project is intended to be used by administrators on servers and advanced users on desktop computers. If you have several operating systems and want to be able to boot either of them, you may use mbrbm. It is a replacement of the default boot loader in MBR which for instance could be written there by a Microsoft Windows installation. The whole installation is just the writing the very first 438 bytes of the first harddisk with the assembled code of mbrbm.S - the MBR. THERE IS NO CONFIGURATION - INSTALLATION -> DONE.


Compilation of the mbr (or take the compiled version for the distribution archive):
[root@mbrbm /etc]# cd /etc
[root@mbrbm /etc]# nasm mbrbm.S -o mbrbm.bin

Installation with Linux on first IDE Harddisk (use /dev/sda for SCSI):
[root@mbrbm /etc]# cd /etc
[root@mbrbm /etc]# dd if=/dev/hda of=hda.mbr bs=1b count=1
[root@mbrbm /etc]# dd if=mbrbm.bin of=hdambrbm.mbr bs=1 count=438
[root@mbrbm /etc]# dd if=hda.mbr bs=1 skip=438 count=74 >>hdambrbm.mbr
[root@mbrbm /etc]# dd if=hdambrbm.mbr of=/dev/hda bs=1b count=1
[root@mbrbm /etc]# # KEEP THE FILE /etc/hda.mbr AS BACKUP OF ORIGINAL MBR

Deinstallation with Linux on first IDE Harddisk:
[root@mbrbm /etc]# dd if=/etc/hda.mbr of=/dev/hda bs=1b count=1

Installation with FreeDOS on first Harddisk:
C:\> C:
C:\> CD \
C:\> COPY BOOT.MBR hda.mbr
C:\> COPY mbrbm.bin BOOT.MBR

Deinstallation with FreeDOS on first Harddisk:
C:\> COPY hda.mbr BOOT.MBR

Frequently asked questions (FAQ)

Q1: Yet another boot manager? What are the advantages of mbrbm over others?
A1: mbrbm is first choice if you want an operating system independent boot manager without configuraton. Unlike grub, lilo or ntldr(BOOT.INI) mbrbm does not need a working (booting) operating system partition. It's whole functionality is within the MBR. It will not fail to boot your secondary operating system if you completely destroy the primary. In fact there is no more a primary or secondary OS boot loader. In effect boot complexity is dramatically reduced from the bootstrapping system. The OS's on the system are just installed with their default booting schema. No configuration afterwards is needed. No hassle with lilo.conf, grub.conf or confusing BOOT.INI magic.

Consider a situation when you have 2 primary partitions: one with Windows XP and another one with Linux. What are your options to boot either of them? Using LILO which is able to boot both OSes you will loose an ability to normally boot a system to Windows XP if you completely fill Linux partition by zeroes. The same with standard DOS + loadlin or Windows ntldr + BOOT.INI executables. In this case you should not break Windows partition otherwise you will loose an ability to load Linux.

Of course there are many other third-party managers which are not parts of the operating systems above. Several alternatives to mbrbm are listed in Links section. However almost all of them require either a separate partition (like OS/2 boot manager) or a directory in a FAT partition (like PQBoot) or occupy almost the whole track #0 on cylinder #0 (it is unused on most systems). mbldr (Master Boot LoaDeR) needs to be configured, what has to be redone when booting partitions are added or moved. bm uses also parts of track #0 - nuni can only boot IDE drives and needs source code configuration. All these solutions add complexity to the bootstrap setup - complexity is the biggest enemy of availabilty and security! mbrbm requires only the space which is reserved for the master boot loader by definition, only 438 bytes of 1st sector are used.

Nevertheless there are some drawbacks: the extreme simplicity leads to low quality of user interface (only text with minimum usability), less features could be included: no lba and extended partitions can be bootet.

Q2: Compilation breaks with "error: argument to ORG should be numeric" message in mbrbm.err. What am I doing wrong?
A2: The version of nasm required to build mbrbm is greater or equal to 0.98.36. Release .35 which is often shipped in many popular (but rather old) distributions could not be used.

Q3: When trying to update the MBR contents on /dev/ad0 under BSD I get "Operation not permitted" error. How to overcome this?
A3: This protection of BSD is active because hard disk is available for writing at the moment. Try to issue a command "sysctl kern.geom.debugflags=16" to temporarily disable it. Update your MBR and then return this value back to 0.

Useful hints and advices

Important notices and limitations

There are following limitations and configurations that have never been tested yet. All information related to the topics below is welcome (test cases, links to appropriate documentation, patches, etc.)


If mbrbm does not work for some reason you may ask for support. What do you need to provide in order to get help:
  1. Is mbrbm installed properly? "dd if=/dev/hda bs=1 count=438 | md5sum" should match the mbrbm.md5 in the distribution tar
  2. Deinstall mbrbm - does the problem stay? Remember installation of mbrbm does only alter 438 bytes on the HD!
  3. Describe hardware configuration (disks subsystem: number of drives, their types (ATA, SATA, etc.), primary or secondary, sizes, etc.)
  4. Report the version of mbrbm you are using
  5. Explain the problem (crash, hanging, incorrect behavior, etc.)
  6. Describe partitioning scheme of your hard drives (sizes and filesystems on primary partitions and logical disks). Appropriate screenshots of fdisk may help as well.
  7. Provide a description of OSes you want to boot: where are they, how many oses you want to boot, what are they (brands+versions)
  8. What other boot-related software do you use (other boot managers for example on other hard disk, OS loaders like LILO, etc.)
Not all items above are mandatory, but however if you provide quality feedback with much info describing your problem, I may help you with greater probability.
But please don't forget - mbrbm is my hobby, there is no guarantee this software will work properly. I'm not responsible for any damage it may cause. Immediate support is also not guaranteed.


Boot menu (mbrbm version 1.0):
Boot menu



Distribution file Version number Date Status Release short description
mbrbm-1.1.tar.gz 1.0 May, 2007 Stable, production for compilation/install with Unix Current
mbrbm-1.1.zip 1.0 May, 2007 Stable, production for install with FreeDOS Current


There are some plans for future. Feel free to suggest new features, send patches and improvements:
  1. Strong optimization of assembly code in MBR
  2. LBA support. There are still 6 bytes free for code!


The recommended way to contact current maintainer is to use an appropriate mechanism on sourceforge project site (forum, tracker, bugs, feature requests, etc.). In the e-mail addresses below there is no hypertext references due to spam bots protection:

Current maintainer of mbrbm is Axel Reinhold

Note: you need to replace " __dot__ " with "." and " __at__ " with "@" before using the addresses above.


Project related resources:

Similar projects (other boot managers):

Assembly language descriptions and CPU instructions set Partition tables and boot loaders Development and packaging stuff BIOS and ATA specifications
Last updated: Nov 25, 2007