With so many easily availible bootable rescue cd's today, I can't imagine this is of much value, but I leave it here just in case and perhaps as a reminder of the things we had to do way back when..
Message-ID: <399599F3.EE06B673@mb.sympatico.ca> From: Randy Cooper <rwcooper@mb.sympatico.ca> Newsgroups: comp.os.linux.setup,comp.os.linux.misc Subject: Saving and Restoring an MBR Date: Sat, 12 Aug 2000 13:39:47 -0500 I have noticed a lot of questions regarding recovering lost / damaged Master Boot Records (MBR) lately. So I thought it was about time to repost this. You should make a backup copy of your MBR on a bootable floppy disk before installing Linux and then again after installing Linux. ------------------------------------------------------------ I can suggest two ways that you can back up the Master Boot Record (MBR) on an IDE drive under Windows and DOS. 1. Use the Norton Utilities. 2. Use Debug, as found in DOS, it is also available from the DOS prompt in Windows/95 so I assume it is also available in Windows/98. Enter the following commands to save the MBR on the C drive, ignore the text after the '<=' on each line as it is only a comment:
DEBUG MBR.DAT <= Ignore the FILE NOT FOUND message
A <= Assemble a program
MOV DX,9000 <= Use segment 9000
MOV ES,DX <= Setup the segment register
XOR BX,BX <= Clear BX to zero
MOV CX,0001 <= Start at track 00 sector 01, the MBR
MOV DX,0080 <= 80=C:, 81=D:, 00=A:, 01=B:
MOV AX,0201 <= Read 1 sector, 02=read
INT 13 <= BIOS disk i/o call
INT 20 <= Return to o/s
<= Press the return key to end program entry
G <= Execute the program
R CX <= Display the value of CX
:200 <= Change the value of CX to decimal 512, size of
MBR
W 9000:00 <= Write the sector stored at address 9000 to
MBR.DAT
Q <= exit DEBUG
If you examine the contents of MBR.DAT using a disk file editor the last
2 bytes must be AA55.
At this point you should copy the MBR to a bootable floppy along with
DEBUG.EXE
This technique may be used to recover the MBR as well, assuming you can
boot from another device (say a floppy with DEBUG.EXE on it).
Enter the following commands to restore the MBR on the C drive, ignore
the text after the '<=' on each line as it is only a comment:
DEBUG MBR.DAT <= The file containing the desired MBR, if you
get a
FILE NOT FOUND message type Q immediately! If
you
continue you will write garbage over the MBR.
L 9000:00 <= Load the MBR into memory at this address
A <= Assemble a program
MOV DX,9000 <= The segment address containing the MBR
MOV ES,DX <= Setup the segment address
XOR BX,BX
MOV CX,0001 <= Track 00, sector 01
MOV DX,0080 <= 80=C:
MOV AX,0301 <= Write one sector, 03=write
INT 13
INT 20
<= Press the enter key to stop program entry
G <= Execute the program
Q <= Exit DEBUG
The MBR should now be restored to the C drive, making it bootable.
For more information on this technique for saving and restoring an MBR I
refer you the book 'The Complete PC Upgrade and Maintenance Guide' by
Mark
Minasi, published by Sybex.
Once you have Linux running you can save the boot record with the
command:
dd if=/dev/hda of=/boot/boot.MBR bs=512 count=1
It can then be restored with:
dd if=/boot/boot.MBR of=/dev/hda bs=512 count=1
or if you do not want/need to overwrite the partition table with:
dd if=/boot/boot.MBR of=/dev/hda bs=446 count=1
as the partition table is kept in the last 66 bytes of the MBR.
DISCLAIMER:
Although I have double checked the above, I cannot be held responsible
for any errors. I suggest you try it on a bootable floppy disk before
using it on a hard drive. If it does not work on a floppy disk let me
know.
BTW: I find it easier to boot Linux from a floppy disk or
CD-ROM than to recover an MBR from DOS. The Slackware 3.5
(or greater) CD-ROM makes a good rescue disk if you have
a bios that supports bootable CDs.
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
Click here to add your comments
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar