Wednesday, August 11, 2010

How To Take The Backup Of MBR(Master Boot Recorder)

1.How to take the backup and restore MBR? Why do you require to take the backup of your MBR?Ans : MBR (Master Boot Recorder) is a vital part of your hard disk which contains booting information, without it its difficult to boot the system. Suppose you have windows and Linux duel boot on your machine and as you know windows is more prone to virus attacks. So it’s always better to backup your MBR to be in safe place.

2. How to take backup of your MBR?Ans : Using dd command (dataset definition). Here are the steps to take backup of you MBR and keep it in safe place to restore your system if it get corrupted.
#dd if=/dev/hdx of=/safe/location bs=512 count=1


Let me explain the above command how it will work.“If” in the command is nothing but to specify Input File, here we are specifying our input file as hard disk(if the hard disk is /dev/hda it is primary master, so for general purpose I given 'x'). “of” in the command is nothing but to specify Output File, here we are specifying our output file as /safe/location. Then “bs” this is nothing but block size to write in to hard disk. And then “count” nothing but how many times you want to write date this many block sizes. Here in this example count=1 that means first 512 bytes of the hard disk is copied to the specified location.

3.How to restore the MBR?#dd if=/safe/location of=/dev/hdx bs=512 count=1

Note : Please replace “hdx” with your hard disk name.
This is bit complex, 
Is there any other way to restore MBR?Yes, if you have Linux or Windows bootable CD, we can easily restore your MBR if you forgot to take backup(And this method is very much easy to do restoration of MBR when compared to previous method).

Method1 : With Redhat Linux bootable CD.
For this you have to boot your system to rescue mode, then mount your file system to rescue mode and execute below command to restore your MBR
#grub-install /dev/hdx


Note : Please replace hdx with your hard disk name. After that you just reboot your system. Your system will be live and working.

Method2 : With Windows XP bootable CD.
Step1 : Boot the system with XP bootable cd
Step2 : Press f8 to go to repair mode in Windows
Step3 : Once you got the drive prompt just type below command
FixmbrThis command will fix the MBR record.

Some FAQ’s1. What is the MBR size?Ans : MBR size is just 512 bytes.

2.What MBR conations?
Ans :
 Mainly MBR can be divided in two parts
a.Boot loader information block(which is of 448 bytes)
b. Partition table information(which is of just 64 bytes)


3.How many partition we can create on a hard disk?Ans : Totally we can create four partitions as below
a.Four primary parathions.
b.Three primary and one extended partition.
c.Two primary and one extended parathion.
d.One primary and one extended parathion.


Note : In extended parathion we can create logical partitions up to 24 in number.

4.Why we cannot create more then 4 partition as mention above?Ans : In MBR, the partition table info is just stored in 64 bytes, and one parathion information to store in MBR requires 16 bytes of space. So at most you can create only 4 partitions as mention above.