28.12.07

MBR(Master Boot Record)


A Master Boot Record (MBR), or partition sector, is the 512-byte boot sector that is the first sector ("Sector 0") of a partitioned data storage device such as a hard disk. (The boot sector of a non-partitioned device is a Volume Boot Record.) The MBR may be used for one or more of the following:Holding a disk's primary partition table. Bootstrapping operating systems, after the computer's BIOS passes execution to machine code instructions contained within the MBR. Uniquely identifying individual disk media, with a 32-bit disk signature; even though it may never be used by the machine the disk is running on.Due to the broad popularity of IBM PC-compatible computers, this type of MBR is widely used, to the extent of being supported by, and incorporated into, other computer types, including newer cross-platform standards for

Bootstrapping and Programming:

Where a data storage device has been partitioned with (what Microsoft terms) the MBR Partition Table scheme (i.e., the conventional IBM PC partitioning scheme), the master boot record contains the primary partition entries in its partition table. The partition table entries for other, secondary, partitions are stored in Extended Boot Records, BSD disklabels, and Logical Disk Manager metadata partitions that are described by those primary entries.
By convention, there are exactly four primary partition table entries in the MBR Partition Table scheme, although some DOS operating systems did extend this to five (PTS-DOS) or even eight (AST or NEC DOS) entries.
Where a data storage device has been partitioned with the GUID Partition Table scheme, the Master Boot Record will still contain a partition table, but its only purpose is to indicate the existence of the GUID Table and to prevent utility programs that only understand the MBR Partition Table scheme from creating any partitions in what they would see as only free space on the disk.
Backing up/restoring the MBR:
Note: If you decide to back up your MBR sector, be sure to save the file on an emergency diskette or other backup device, or just print out a text representation of its hexadecimal bytes as you would see them in a disk editor. Simply storing the file on the same disk drive it was copied from will do no good if the disk's partition table has been erased!
DR-DOSIn DR-DOS 6 (and possibly other versions), the FDISK program has an additional option to "Re-write Master Boot Record". When this is done the old MBR is stored in a file, OLDMBR.BIN. This file can be copied. If it is present on a disk, FDISK will instead prompt to "Restore Original Boot Record", and the file will be re-loaded as the disk's boot record.
MS-DOS and WindowsFor MS-DOS and Windows-based operating systems, a number of third-party utilities exist for backing-up the MBR and/or partition table data.
Unix-like systemsThe dd utility, which is available on most Unix-like systems, can be used to create backup images of the master boot record. Care should be taken when using the dd utility, as incorrect values for its parameters can cause data corruption. You must have the appropriate access to the target device in order to use these commands successfully.
To back up the MBR of a hard disk or other storage device, use the following command to create a file named mbr.bin containing the entire contents of the master boot record:
dd if=device of=mbr.bin bs=512 count=1
where device is the path of the device file corresponding to the entire contents of the storage device whose MBR is to be backed up.
For example,
the primary master IDE device (ATA bus 0, device 0) is typically represented by the device file /dev/hda under Linux.
To restore the MBR from a backup file to a storage device, use the following command, which replaces the first 512 bytes with the contents of the file named mbr.bin:
dd if=mbr.bin of=device bs=512 count=1
To back up or restore only the executable code area, assuming that the executable code uses at most 446 bytes, use the option bs=446 instead of bs=512 when executing the appropriate command. If a full 512-byte backup has already been made, a 446-byte partial restore can still be used, but the opposite is not true (dd cannot copy more bytes from a file than it contains). Using a partial restore can be useful if both the code area and the partition table have been changed and it is necessary to restore only the original code without losing the new partition table.

No comments :