Boot sector usually refers to the first sector of hard disk. It’s used for loading and transferring processor control right to operating system.
Master Boot Sector (MBR)
Cylinder 0, head 0 and sector 1 of hard disk are called master boot sector, which is also called master boot record.
This record takes up 512 bytes. When hard disk starts, it is used to transfer system control right to the certain operating system partition which is user-specified and registered in partition table. The content of MBR is written into the certain sector by partitioning software when it partitions.
MBR doesn’t belong to any operating system and doesn’t change with the changes of operating systems. Even MBR changes, it has common guide characteristic rather than entrains the nature of operating system. However, it may be rewritten when you install some software with multi-boot function or LILO of LINUX. MBR is called to be loaded into memory and to play a role first. Then it will transfer control right to operating system in active partition.
What’s Included in MBR
- The master boot program code accounts for 446 bytes
- The disk signature
- Hard disk partition table (DPT) takes up 64 bytes
- Ending mark of master boot sector takes up 55AAH
The 446 bytes taken up by master boot program of hard disk is from 0000H to 01BDH. Master boot code includes small pieces of executing code. When you start PC, system will firstly test hardware devices. After the test is successful, boot loader INT 19H will be activated. Then content of cylinder 0, head 0 and sector 1 (the content of MBR) in system disk will be read to the beginning address of first area in memory specified location 0 : 7C00. Finally MBR block will be executed.
MBR Function
- Scan the partition table to find the active partition
- Look for the starting sector of the active partition
- Read the active partition boot sector into memory
- Run the boot sector code
If the master boot code doesn’t finish these functions, system will display the following error message: Invalid partition table
Error loading operating system Missing operating system
Partition Boot Sector
Partition boot sector is also named DBR. It is the content written into the certain sector by senior format command.
DBR is the block loaded by hard disk MBR. After DBR is loaded into memory – after the boot block is started, its main function is to finish operating system bootstrap and transfer control to OS. Every partition has a boot sector, but it will be loaded into memory by DBR to run only after the partition is set active.
What’s Included in DBR
- Jump instruction that holds 3 bytes will jump to the boot code
- Vendor identification and DOS version number hold a total amount of 8 bytes
- BPB (BIOS Parameter Block)
- Operating system boot program
- Ending mark whose value is AA55, takes up 2 bytes.
DBR content is uncertain in addition to ending mark. Its other four parts of content will change with the changes of OS versions using in formatting and logical parameters of hard disk.
FAT 32 Partition Boot Sector
Boot sector is the first sector in FAT 32 file system and is also called DBR sector.
BPB and extending BPB domain of FAT volumes:
Byte offset domain length name and definition
- 0x03, 8 bytes, OEM Number
- 0x0B, 2 bytes, bytes per sector
- 0x0D, 1 byte, number of sectors per cluster
- 0x0E, 2 bytes, number of reserved sectors
- 0x10, 1 byte, number of FAT table
- 0x11, 2 bytes, number of root directory entries
- 0x13, 2 bytes, total number of sectors
- 0x15, 1 byte, number of medium descriptor
- 0x16, 2 bytes, number of FAT sectors
- 0x18, 2 bytes, sectors per track
- 0x1A, 2 bytes, number of heads
- 0x1C, 4 bytes, number of special hidden sectors
- 0x20, 4 bytes, total number of sectors
- 0x24, 4 bytes, number of sectors per FAT table
- 0x28, 2 bytes, number of tags, determining working ways of FAT table; if bit7 is 1, then only one FAT table is active; at the same time the bit0 ~ bit3 describe it; otherwise the two FAT tables mirror each other.
- 0x2A, 2 bytes, number of versions
- 0x2C, 4 bytes, number of root directory starting cluster number, usually the second cluster
- 0x30, 2 bytes, number of sector where FSINFO locates, usually the 1st sector
- 0x32, 2 bytes, number of backup boot sector position, usually the 6th sector
- …
- 0xFE, 2 bytes, number of signature, value “55AA”
NTFS Partition Boot Sector
For NTFS partition, partition boot sector(DBR)only takes up one sector. And there is backup in the last sector of this partition. NTFS partition boot sector also completes booting and defining partition parameters. It can be normally accessed when system records, such as $MFT, in MFT, are normal. BPB and extending BPB domain of NTFS volumes:
Byte offset domain length name and definition
- 0x03, 2 bytes, OEM name
- 0x0B, 2 bytes, bytes per sector
- 0x0D, 1 byte, number of sectors per cluster
- 0x0E, 2 bytes, number of reserved sectors
- 0x10, 4 bytes, unused space
- 0x15, 1 byte of medium descriptor
- 0x16, 2 bytes, unused space
- 0x18, 2 bytes, sectors per track
- 0x1A, 2 bytes, number of heads
- 0x1C, 4 bytes, number of hidden sectors
- 0x20, 4 bytes, unused by NTFS
- 0x24, 4 bytes, unused by NTFS
- 0x28, 8 bytes, total number of sectors
- 0x30, 8 bytes, number of the file $ MFT starting cluster
- 0x38, 8 bytes, number of the file $ MFT backup cluster
- 0x40, 4 bytes, number of each file record segment accounted for clusters
- 0x44, 4 bytes, number of clusters in each index block
- 0x48, 8 bytes, number of volume serial
- 0x50, 4 bytes, number of checksum
- 0x54, 426 bytes, number of boot code
- 0x1F, 2 bytes, number of signature, value “55AA”