12
Jan

What an MBR Contains and How to Backup/Restore It

What I’ve Learned Today:

I have always known that the Master Book Record (MBR) was a critical part of any computer, but today I actually took a minute to look it up in wikipedia. I now understand it in a little more detail now. I’m not going to repeat the entire article, but the MBR is a 512 byte portion of the disk which contains three things: 1) the disks partition table, 2) the machine code that is executed after the computer BIOS passes called the bootstrap, and 3) a 32-bit checksum for identifying individual disk media.

Sometimes, bad things happen and this area of the disk can be overwritten and render the disk unusable. This generally doesn’t happen if you’re a normal desktop user who could care less about the partitioning table of the harddrive (HDD), but for those of us who are a bit more… geeky, it happens more often than not. So, in order to backup the MBR from within Linux, you must know which drive you’re backing up by using the ‘fdisk -l’ command. For myself, my HDD is located at /dev/sda and I have several partitions at /dev/sda1, /dev/sda2, /dev/sda3, etc… So, in order for me to backup my MBR, I would issue the following command:
dd if=/dev/sda of=mbr.dd bs=512 count=1

Similarly, to restore the MBR, I would issue the following command:
dd if=mbr.dd of=/dev/sda bs=512 count=1

And, that’s it! Not too hard, not too complicated, and saves on a massive headache in case something were to happen while geeking out. 😉

Feel free to donate if this post prevented any headaches! Another way to show your appreciation is to take a gander at these relative ads that you may be interested in:


There's 1 Comment So Far

  • Joy
    September 6th, 2011 at 5:34 am

    was very helpful thanks

Share your thoughts, leave a comment!