(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version


book graphic unix and linux troubleshooting guide

My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!







Articles, Tips, How-To's

Best of CUSM: linux save restore mbr master boot record lilo


What is this stuff?

If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):



From - Sun Aug 13 15:01:37 2000
Path: news.randori.com!cyclone2.usenetserver.com!news-out.usenetserver.com!feed2.onemain.com!feed1.onemain.com!news-out.cwix.com!newsfeed.cwix.com!news-in.mts.net!news1.mts.net.POSTED!not-for-mail Message-ID: <399599F3.EE06B673@mb.sympatico.ca>
From: Randy Cooper <rwcooper@mb.sympatico.ca>
X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.13 i586)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.linux.setup,comp.os.linux.misc
Subject: Saving and Restoring an MBR
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 220
Date: Sat, 12 Aug 2000 13:39:47 -0500
NNTP-Posting-Host: 209.202.53.116
X-Complaints-To: admin@mts.net
X-Trace: news1.mts.net 966105536 209.202.53.116 (Sat, 12 Aug 2000 13:38:56 CDT)
NNTP-Posting-Date: Sat, 12 Aug 2000 13:38:56 CDT
Organization: MTS Internet
Xref: news.randori.com comp.os.linux.setup:217610 comp.os.linux.misc:222961
X-Mozilla-Status: 8000
X-Mozilla-Status2: 00000000


Hate these ads?



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.


M3IP inc.



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.






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:


LOD Communications, Inc.



  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.




--
Reply to: rwcooper@mb.sympatico.ca (mail checked week nights and weekends)











Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner


Views for this page
Today This Week This Month This Year  Overall
889127127 27,229

/Bofcusm/481.html copyright 1997-2004 (various authors) All Rights Reserved

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.

Publishing your articles here

More:
       - Newsgroup




Unix/Linux Consultants


http://www.breakthru.com.au SCO (Openserver and Unixware), Unix, Solaris and Linux Consulting services including: Secure Networking Solutions; Linux based Firewalls; Backup Solutions; Secure Home to Office Network Setup; Phone, Remote and On-Site Support available - Satisfaction Guaranteed!


SCO, OpenServer, UnixWare, software, servers, security, networks, installation, administration, troubleshooting, maintenance, Watchguard, firewalls, VPNs, e-mail. Visit us at Open Systems Computing and www.go2unix.com.


http://www.vss3.com SCO/Caldera OpenServer, Unixware & Linux. Tarantella & Non-stop Clustering



Twitter
o Still too hot to work. Though if we weren't so stubborn, we'd turn on the A/C. 6:20 PM Jun 9th 2008




card_image






My Favorites

Change Congress