MBR (Master Boot Record)

botond published 2020. 03. 02., h - 10:26 time

Content

 

Overview

A Master Boot Record (MBR) is a special boot sector at the very beginning of partitioned computer storage. Examples of such devices are built-in or removable hard drives, SSDs, and flash drives. The MBR concept was officially introduced in PC DOS 1983 in 2.0 and has been operating since then BIOS system personal computers.

Organizing hard disks in MBR based partition table storage at 2 TiB (232 x 512 bytes). There are approaches that can somewhat raise this threshold, such as using 33-bit addressing (instead of 32) or using the 4096 byte sector size, but these are not officially supported and are not compatible with system loaders (Boot Loaders), as well as MBR-compliant operating systems, so these solutions can cause serious structural damage and data loss when applied in an uncontrolled system environment. Therefore, the MBR-based partitioning scheme will be replaced by the more modern one GUID Partition Table (GPT) the scheme is newer (mostly already UEFI-s) on computers (beginning of 2010).

A hard disk can have both GPT and MBR at the same time, in order to ensure backward compatibility with older systems in a limited way.

MBRs are not present on non-partitioned media, such as previously used floppy disks, or other media that is configured to function as a floppy disk.

 

 

history

Support for partitioned media, and thus MBR, was introduced with IBM PC DOS 2.0 in March 1983 to support the then new IBM Personal Computer XT 10 MB hard drive, even using the FAT12 file system. The original version of the MBR was written by David Litton at IBM in June 1982. The partition table supported up to four primary partitions, of which DOS could only use one. This has not changed either when FAT16 was introduced as a new file system with DOS 3.0. Extended partition support, a special primary partition type that can be used to store other partitions, was added in DOS version 3.2, and embedded logical drives within the extended partition came with DOS 3.30. Because MS-DOS, PC DOS, OS / 2, and Windows could never be booted from these logical drives, the MBR format and boot code functionality remained virtually unchanged, except for some third-party implementations of DOS and OS. / 2 era to 1996.

In 1996, Windows 95B and DOS 7.10 introduced the use of logical block addressing (LBA), which also supported the use of disks larger than 8 GB, as well as the use of disk timestamps. This also reflects the idea that the MBR was intended to be an operating system and file system independent solution. However, this design idea was partially compromised by newer Microsoft implementations of MBR that force CHS (Cylinder, Head, Sector) access to partition types FAT16B and FAT32 at addresses 06h / 0Bh, while LBA used access addresses 0Eh / 0Ch.

Although some internal details of the MBR format are sometimes poorly documented (which has sometimes caused compatibility issues), due to the high popularity of PC-compatible computers, it has been widely accepted as an industry standard for decades. This was supported to such an extent that it was even used by operating systems for other platforms. At times, this has been supplemented by existing or cross-platform standards for boot and partitioning.

MBR partition entries and the MBR boot code used in commercial operating systems are limited to 32 bits. Therefore, on disks that use 512-byte sectors (either physical or emulated) by the MBR partitioning scheme, the maximum supported disk size is 2 TiB. Consequently, a different partitioning scheme had to be applied to the larger disks as they became widely available since 2010. As a result, the MBR partitioning scheme has been replaced by the GUID partition table (GPT). The formal approach is little more than ensuring data integrity a protective MBR application. Specifically, it does not provide backward compatibility with operating systems that do not support the GPT scheme. Meanwhile, multiple forms of hybrid MBRs have been designed and implemented by third parties to maintain partitions in the first physical 2 TiB of the disk, both partitioning schemes "running parallel" and / or to allow older operating systems to boot from GPT partitions too. The current non-standard nature of these solutions may cause various compatibility issues in some cases.

 

structure

MBR is thus the very first sector of mass storage, which, by numbering 0, is the physical sector 0. It stores the partition table and a small bootloader, more specifically the first part of what is called a Boot Loader.

Partition table

The partition table contains information about the partitions on the device, such as the active status flag (whether it is a boot partition or not), the number, size, and type of the start and end sectors of the partition, which can be primary or extended. Each entry in the MBR partition table describes a partition, up to a maximum of four. These entries contain only the data for the primary and extended partitions, while information about the logical partitions within the extended partitions is stored by the extended partition itself.

This is one of the limitations of the MBR partitioning scheme, as it can only handle up to 4 primary partitions, which today severely limits the number of operating systems that can be installed on a single machine (dual boot / multi boot), especially since almost all operating systems require a primary type of system, maintenance, or swap partition for normal operation, which further reduces the number of primary partitions that can be used.

System loader

The system boot code, also known as the Boot Loader, is started by the BIOS after checking the status of the hardware (CPU, memory, etc.). Because the MBR-based partitioning scheme works with sectors of 512 bytes by default, the MBR itself takes up that much space. Therefore, to maintain compatibility, the boot program must also be small enough to fit in the MBR along with the partition table. However, program codes for more modern, menu-driven, multi-file booters take up more space, so they are usually divided into two parts so that the first, shorter boot part can fit in the MBR, which then passes control to the second part of the hard disk. part of. Today’s modern Boot Loader programs are able to boot an operating system from any primary type of partition on any hard drive after the user selects it from the menu. Such a universal boot program for loading Linux and other systems, such as GNU GROUP. The Microsoft Windows operating system also has its own system loader, but this is limited to booting its own Windows systems.