Master Boot Record Save and Restore--Application Example
by Greg Moler
allthatcounts.com
Summary: Here is an example of using getmbr.com
and restmbr.com. It involves saving a master boot record (MBR) before
installing Linux LILO,
saving the Linux LILO MBR, and choosing between the original and LILO MBRs.
Suppose you wish to install Linux with the Linux Loader (LILO) program, but
are worried about LILO's reputation for trashing a hard disk's MBR. Here's
the scenario and workaround:
You start off with, for example, two primary partitions, DOS and Windows, with DOS set as the
boot partition (you are using a boot manager to boot to DOS/Windows):
With getmbr.com and restmbr.com you would do this: create a DOS boot floppy
and store getmbr.com and restmbr.com on the floppy. Then boot to the boot
floppy and type "getmbr dos.mbr" (or whatever filename you choose for the
initial partition configuration). Then install Linux with LILO:
Boot to the boot floppy and type "getmbr lilo.mbr". You will now have saved
two MBR files, one for DOS and one for LILO.
You may find that LILO can boot to DOS and Linux, but not to Windows.
So do this: boot to the boot floppy, and type
"restmbr dos.mbr". Your hard drive will look like this to the MBR:
You will be able to boot to DOS (and Windows with your boot manager),
but the Linux partition will no longer be bootable.
You can get back to LILO and Linux
by booting to the boot floppy and typing "restmbr lilo.mbr".
(A better alternative is to not use LILO in the first place. I use loadlin.exe,
a program that runs from a DOS floppy, or a DOS or Windows partition. It does not alter your MBR).
Warning! The MBR files you save are snapshots
of the disk as it existed at the time you saved the MBRs. You cannot delete, resize, or move partitions
and then restore some previous MBR and expect it to work properly.
If case you totally screw up the MBR and cannot do anything with the hard disk,
I have included "generic.mbr", which is a DOS MBR with no partitions defined.
The hard disk would look like this to generic.mbr:
If you install generic.mbr, you will have to use fdisk to redefine partitions.
You will, of course, lose the existing partition information in the process.
You can download the programs here.