Backup and Restore Master Boot Record (MBR)

This document (7014702) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 11

Situation

At some point you may want to backup the Master Boot Record (MBR) in case someone accidentally changes it or it becomes corrupt. The resolution will show how to backup and restore the MBR. 

A master boot record (MBR) is a special type of boot sector at the very beginning of partitioned computer mass storage devices like fixed disks or removable drives.  It  is the first sector of the computer hard drive that tells the computer how to load the operating system, and how the hard drive is partitioned. 

Resolution

In this example /dev/sda2 is the boot and root partition and /dev/sdb1 is another local ext3 partition mounted as /backup 

Backing up the MBR:
dd if=/dev/sda2 >/backup/mbr bs=512 count=1 

Restore backup MBR:
If the system will not boot up saying that there is "No operating system found" 
then
1) Reboot with the SLES11 SP2 rescue (installation) disk. 
2) Choose "rescue system"
3) login as root 
4) Mount the /backup disk:
     mount /dev/sdb1 /mnt 
5) Make a new mount point:
     mkdir /old_boot 

6) Mount the old root/boot partition:
     mount /dev/sda2 /old_boot 
7) Copy the backed up MBR into the same spot as the old MBR:
     dd if=/mnt/mbr of=/dev/sda2 bs=512 count=1 
the screen will show:
  1+0 records in 
  1+0 records out 
  512 bytes (512 B) copied, 0.000393389 s, 1.1 MB/s 

(the speed will be different) 
Then reboot the machine
    init 6
System boots up correctly

Additional Information

This has been tested on SLES SP 1, 2 and 3.  Just use the installation/rescue disk for the installed system.

A test can be made on a test system to see how it works.  Do not run it on a production system
After making the backup but before restoring run:
dd if=/dev/zero of=/dev/sda2 bs=512 count=1 
to effectively overwrite the MBR.  Then reboot the system. 
The system comes up and says "Error No operating system found" 
Then follow the steps to restore the MBR. 

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7014702
  • Creation Date: 05-Mar-2014
  • Modified Date:03-Mar-2020
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center