In Linux, MBR refers to the master boot record, which is located in track 0, cylinder 0, and sector 1 of the hard disk. It mainly records the boot program and the partition table of the disk. The most important function of the MBR is to store the boot program, and the most important function of the boot program is to load the kernel of the operating system.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
linux MBR (Master Boot Directory)
MBR is the abbreviation of English Master Boot Record, and Chinese means master boot record.
Located in track 0, cylinder 0, and sector 1 of the hard disk, it mainly records the boot program and the partition table of the disk. Let’s look at the structure of MBR through Figure 1.
Figure 1 Structure of MBR
MBR is composed of the following three parts
1. Bootloader, main boot program (446 bytes)
2. Dpt (Disk Partition table), hard disk partition table (64 bytes)
3. End of sector flag (55aa) (bytes)
MBR A total of one sector is occupied, which is 512 Byte. Among them, 446 Byte installs the boot boot program, the next 64 Byte describes the partition table, and the last 2 Byte is the end mark. We already know that each hard disk can only be divided into 4 primary partitions. The reason is that the space for describing the partition table in the MBR is only 64 Bytes. Each partition must occupy 16 Bytes, so 64 Bytes can only be divided into 4 primary partitions. The 16-byte plan for each partition is shown in Table 2.
Storage bytes | Data content and meaning |
---|---|
1st byte | Boot flag |
2nd byte | Starting track number of this partition |
The 3rd byte | The starting sector number of this partition |
The 4th byte | The starting cylinder of this partition Number |
5th byte | Partition type, can identify primary partition and extended partition |
6th byte | Ending track number of this partition |
7th byte | Ending sector number of this partition |
The 8th byte | The ending cylinder number of this partition |
The 9th~12th byte | The sectors that this partition has previously occupied Number |
Bytes 13~16 | Total number of sectors in this partition |
Everyone noticed Well, the most important function in MBR is to store the startup boot program.
The function of BIOS is to self-check and then read the startup boot program from MBR. Then, the most important function of the bootloader is to load the kernel of the operating system.
The startup bootloader has the following functions:
Loads the kernel of the operating system. This is the most important function of the bootloader.
Have a menu that allows users to choose which system to start. If you have installed dual Windows systems on a server, you should have seen a similar selection menu, but this selection menu is provided by the Windows startup boot program, not GRUB.
You can call other startup boot programs, which is the key to multi-system startup. However, it should be noted that the Windows startup boot program cannot call the Linux startup boot program, so we generally recommend installing Windows first and then Linux. This is to install the Linux startup boot program into the MBR and overwrite the Windows startup boot program. .
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of what is linux MBR. For more information, please follow other related articles on the PHP Chinese website!