Linux-Tip News

We are proud to present Linux-Tip Europe. This page is designed to provide the Linux users community (not only in Europe) with news and articles that are of interest to them. It works by allowing members of the community to submit news and articles relating to Linux hardware and software. This same community can then decide what tips should be promoted based on what they consider to be the most important or interesting to the community by voting stories up and down. Stories that receive enough votes are promoted to the Linux-Tip Europe homepage. Bookmark and Share
 
Home
Trick: Backup and Restore MBR Print E-mail
Friday, 27 June 2008

Backing up Master Boot Record (MBR)

The MBR  is a 512 byte segment on the very first sector of your hard drive composed of three parts: 1) the boot code which is 446 bytes long, 2) the partiton table which is 64 btyes long, and 3) the boot code signature which is 2 bytes long.

The core of the backup command is dd—which will be familiar to every system administrator, especially to those who intend to clone an entire hard disk. To see all the options type man dd. As we want to back up only the first 512 bytes we need to append some arguments to it. Here is the full command you need (and remember to run it as the root user, su (and sudo for Ubuntu users):


dd if=/dev/hda of=/home/richmondg/mbr_backup bs=512 count=1

 

Restoring the MBR

You can use a live CD to access your hard drive and read the backup off any removable media such as a USB stick. Here is the command:


dd if=/dev/sda/mbr_backup of=/dev/hda bs=512 count=1


Again, amend sda to read where you saved the MBR and run the command as root. If you wish to kill the MBR altogether, including the partition table, then you can overwrite it with a series of zeros:


dd if=/dev/zero of=/dev/hda bs=512 count=1


If you want to kill the MBR but leave the partition table intact then simply change 512 to 446.

Another way to repair the mbr of your HDD device is install LILO then type (replacing x with the letter of your HDDdevice) :


lilo -M /dev/sdx

 
< Prev   Next >

Who's Online

We have 33 guests online

Virus Info Feed

Alexa Traffic Stats

Sedo - Domains kaufen und verkaufen das Projekt linux-tip.eu steht zum Verkauf Besucherstatistiken von linux-tip.eu etracker® Web-Controlling statt Logfile-Analyse