Friday, May 17, 2013

Master Boot Record

Master Boot Record
The Master Boot Record is the same for most of pretty much all Operating System. As long as the platform is following x86 PC architecture (IBM PC). It is located on the first sector of Hard Drive at Cylinder 0, Head 0, Sector 1 (That mean, it start at  physical address 0x00). It is the first piece of code that your computer runs after it has checked all of your hardware (POST) and turned control of loading software over the hard driver. This sector contain hard disk boot loader (ROM BIOS bootstrap routine), where the code can understand by PC BIOS. It aslo contains the partition table, which defines the difference sections of your hard drive. Basically if anything happens to this little 512 byte section, your hard driver is brain dead. This section will change partition table when your doing OS level formatting. Except your doing Fdisk (knows as Low level format) will change the Master Boot Record.

Partition Table
Partition table is a small part of master boot record. It contain the partition start and end physical address.


Master Boot Record and Partition Boot Record in physical address

AddressLengthDescription
0x0000 to 0x01BD 446 bytes Boot Loader Code
0x01BE to 0x01CD 16 bytes Partition entry 1
0x01CE to 0x01DD 16 bytes Partition entry 2
0x01DE to 0x01ED 16 bytes Partition entry 3
0x01EE to 0x01FD 16 bytes Partition entry 4
0x01FE to 0x01FF 16 bytes Boot Record signature (55 AA)


Details of Partition Entry Table

LengthDescription
1Boot indicator (0x00 = Inactive, 0x80 = Active)
3Starting head, cylinder and sector (refer Head, Cylinder and sector)
1File system descriptor (refer Partition Type Listing)
3Ending head, cylinder and sector
4Starting sector (offset to disk start)
4Number of sector in partition


Head, Cylinder and sector
Cylinder Bit 7 to 0 (MSB)Cylinder Bits 9+8Sector Bits 5 to 0Head Bit (LSB)


Partition Type Listing
Table at below only show the Microsoft partition type listing

ValueDescription
0x00Unknown or Nothing
0x0112-bit FAT
0x0416-bit FAT (Partition Smaller than 32MB)
0x05Extended MS-DOS Partition
0x0616-bit FAT (Partition Larger than 32MB)
0x0B32-bit FAT (Partition Up to 2048GB)
0x0CSame as 0x0B, but uses LBA 0x13 Extensions
0x0ESame as 0x06, but uses LBA 0x13 Extensions
0z0FSame as 0x05, but uses LBA 0x13 Extensions

[Note] LBA - Logical Block Addressing - Uses the Interrupt 0x13 extension built into newer BIOS to access data above the 8GB barrier, or to access strictly in LBA mode, instead of CHS (Cylinder, Head Sector)

Reference
FAT32 Disk structure
FDISK / MBR rewrites the Master Boot Record
Master Boot Record (x86)

No comments:

Post a Comment