21
How to back up and restore MBR?
Backup and restore MBR (Master Boot Record).
What is MBR anyway ?
MBR is the first 512 byte boot sector of a partitioned data storage device “Hard Disk” and it is not located in a partition, it is located in the Main boot record in front of the first partition.
MBR contains the primary partition entries in its partition table.
What is it for?
- Holding storage primary partition table, with exact max four primary partition tables
- Bootstrapping the operating system after BIOS loads and executes the MBR
- Identifying uniquely disk media with 32-bit disk signature
MBR code expects and scans the list of primary partitions entries in its partition table to find one and only partition marked with “active” flag , and then it loads its VBR “Volume Boot Record”
It is possible to edit the code inside the MBR sector using “Disk Editors” like fdisk. So what fdisk does is manipulating MBR code.
what would happen if we deleted our MBR or messed up with its code?
Simply, we will not be able to locate our partitions anymore and it would be a blind hard disk that can not see its partitions.
That hurts isn`t it? So the solution for this is to back up the MBR so we will not be afraid if something wrong happened in it.
How to back up the MBR?
Back up command:
dd if=/dev/sda of=/home/alaa/Sonyvaio-MBR.bkp bs=512 count=1
How to restore the MBR?
If the MBR is damaged, then you will be not able to boot from your disk, right? , so you have to do the following steps:
1- Boot up from Live CD like “Ubuntu or Gentoo or whatever you like”
2- In the terminal window type:
mkdir tmp
3- You have to mount the partition where the MBR image is saved, for example we saved it in my home directory, so :
mount /dev/sda5 tmp
cd tmp/home/alaa
4- Finally we restore the MBR image with this command:
dd of=/dev/sda if=Sonyvaio-MBR.bkp bs=512 count=1
7 Comments to “How to back up and restore MBR?”
Leave a comment
Categories
Recent Posts
Recent Comments
My Bookmarks
- Character sets in MySQL version 4.1 - DreamHost
- btReAnnounceR - Finding more trackers for your torrrents
- 20 Inspiring Rainbow Colored Websites | Webitect
- 30+ Tips, Tools and Resources for Taking the Pain out of Cross-Browser CSS | Webitect
- 6 Smashingly Practical CSS3 Effects You Can Use Right Now | Webitect
My Tweets
- Live, love, forget, dream and never regret ... 7 hrs ago
- @wtmpx !!!! in reply to wtmpx 15 hrs ago
- @hubaghdadi الله يهدي من يشاء يا مولانا in reply to hubaghdadi 18 hrs ago
- @syrianlady yes, .. and sometimes they looks stupid .. i think you know what i mean .. in reply to syrianlady 18 hrs ago
- More updates...
Powered by Twitter Tools
























It’s very important …useful
Thanks Alaa
very pleased to hear that, and you are most welcome
i`ll be waiting for your blog posts too
0pens0urce.com – da best. Keep it going!
Have a nice day
SonyaSunny
The best information i have found exactly here. Keep going Thank you
Hi, interest post. I’ll write you later about few questions!
Hi. I like the way you write. Will you post some more articles?
Sometimes it’s really that simple, isn’t it? I feel a little stupid for not thinking of this myself/earlier, though.