What Is a Boot Sector?
The boot sector is usually the first sector of the device and is used to load and transfer processor control to the operating system.
- The boot sector is usually the first sector of the device and is used to load and transfer processor control to the operating system.
Boot sector master boot sector
- The 0 cylinder, 0 head, and 1 sector of the hard disk are called the master boot sector, also called the master boot record MBR. This record occupies 512 bytes. It is used to transfer system control to the user-specified, An operating system partition is registered in the partition table. The content of MBR is written into the sector by the partition software when the hard disk is partitioned. MBR does not belong to any operating system and does not vary with different operating systems. Even if it is different, MBR will not carry the nature of the operating system and has a public boot Characteristics. However, it is possible to rewrite some multi-boot software or Linux LILO when it is installed. It is transferred to memory and functions before all operating systems, and then transfers control to the operating system in the active primary partition.
MBR Boot sector MBR member
- 1. The main bootloader code, occupying 446 bytes
- 2. Disk signature 3. Hard disk partition table DPT, occupying 64 bytes 4. Master boot sector end mark 55AAH
The main boot code of the hard disk is 446 bytes from offset 0000H to end of offset 01BDH; the main boot code includes a small piece of execution code. When starting the PC, the system first tests the hardware device and enters the bootloader INT 19H after success; then reads the contents of the system disk 0 cylinder, 0 magnetic head, and the main boot sector MBR of sector 1 to the specified memory unit 0: 7C00 The area starting with the first address and executing the MBR block. [1]
MBR Boot sector MBR function
- 1. Scan the partition table to find the active partition;
2. Find the starting sector of the active partition;
3 Read the boot sector of the active partition into memory;
4 Execute the run code of the boot sector.
If the main boot code does not complete these functions, the system displays the following error message
- Invalid partition table
Error loading operating system
Missing operating system
Boot sector partition boot sector
- The partition boot sector, also called DBR, is the content written to the sector by the FORMAT advanced format command. The DBR is a program segment loaded by the MBR of the hard disk. After the DBR is loaded into memory, the bootloader segment is executed. Its main function is to complete the bootstrapping of the operating system and transfer control to the operating system. Each partition has a boot sector, but only if it is set as the active partition will the MBR installed DBR run into memory.
DBR Boot sector DBR member
- 1. Jump instructions, jump instructions occupying 3 bytes will jump to the boot code.
2. Manufacturer ID and DOS version number. This part occupies a total of 8 bytes.
3 BPB (BIOS Parameter Block, BIOS Parameter Block).
4 Operating system bootloader.
5. End flag word, the end flag occupies 2 bytes, its value is AA55
The contents of the DBR, except for the end of the fifth part, are fixed. The other four parts are uncertain, and their contents will change with the operating system version used for formatting and the logical disk parameters of the hard disk.
FAT32 Boot sector FAT32 partition boot sector
- The boot sector is the first sector of the FAT32 file system, also known as the DBR sector.
- BPB and extended BPB domain of FAT volume:
- Byte offset domain length domain name and definition
- 0x03 8-byte OEM number
- 0x0B 2-byte bytes per sector
- 0x0D 1 byte sectors per cluster
- 0x0E Number of 2-byte reserved sectors
- 0x10 Number of 1-byte FAT tables
- 0x11 2 byte root directory entries
- 0x13 Total 2-byte sector
- 0x15 1-byte media descriptor
- 0x16 2 bytes per FAT sector
- 0x18 2 bytes per track sector
- 0x1A 2 byte heads
- 0x1C 4-byte special hidden sector number
- 0x20 4-byte total sectors
- 0x24 4-byte number of sectors per FAT table size
- 0x28 2-byte flag, determines the working mode of the FAT table. If bit7 is 1, only one FAT table is active, and it is described by bit0 ~ bit3, otherwise, the two FATs are mirror images of each other
- 0x2A 2-byte version number
- 0x2C The starting cluster number of the 4-byte root directory, usually cluster 2.
- 0x30 The sector where the 2-byte FSINFO is located, usually located in sector 1.
- 0x32 2-byte backup boot sector location, usually sector 6
- ...
- 0xFE 2-byte signature value "55AA"
NTFS Boot sector NTFS partition boot sector
- For NTFS partitions, the partition boot sector DBR only occupies one sector and a backup is made in the last sector of the partition; the NTFS boot sector also completes the boot and defines the partition parameters. A sufficient condition for the partition, it requires that the system records in the MFT, such as $ MFT, be normal for the partition to be accessed normally. [2]
- NTFS volume BPB and extended BPB domain:
- Byte offset domain length domain name and definition
- 0x03 2-byte OEM name
- 0x0B 2-byte sector number of bytes
- 0x0D 1 byte sectors per cluster
- 0x0E 2-byte reserved sector
- 0x10 4 bytes unused
- 0x15 1-byte media descriptor
- 0x16 2 bytes unused
- 0x18 2 bytes per track sector
- 0x1A 2 byte heads
- 0x1C 4-byte hidden sectors
- 0x20 4-byte NTFS is not used
- 0x24 4-byte NTFS is not used
- 0x28 8-byte total sectors
- 0x30 starting cluster number of 8-byte file $ MFT
- 0x38 8-byte file $ MFT backup cluster number
- 0x40 4-byte clusters per file record segment
- 0x44 4 byte clusters per index block
- 0x48 8-byte volume serial number
- 0x50 4-byte checksum
- 0x54 426 bytes boot code
- 0x1F 2-byte signature value "55AA"