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) schema is newer (mostly already UEFI-s) on computers (beginning of 2010).

A hard disk can coexist with GPT and MBR in order to provide limited backwards compatibility with older systems.

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

Partitioned media support, 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 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 did not change even when FAT16 was introduced as a new file system with DOS 3.0. Extended partition support, a special type of primary partition 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 almost unchanged, with the exception of some third-party implementations for DOS and OS / 2 period to 1996.

In 1996, Windows 95B and DOS 7.10 introduced Logical Block Addressing (LBA), which supported disks larger than 8 GB, and introduced the use of time stamping for disks. It also reflects the notion that MBR is intended to be an operating system and file system independent solution. However, this design concept was partially compromised by recent Microsoft implementations of MBR, which force CHS (Cylinder, Head, Sector) access to the FAT16B and FAT32 partition types at 06h / 0Bh, while the LBA used 0Eh / 0Ch access addresses.

Although some internal details of the MBR format are sometimes poorly documented (sometimes causing 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 the extent that it was used by operating systems for other platforms. At times, this has been supplemented with existing or cross-platform standards in boot and partitioning.

MBR partition entries and MBR boot code used in commercial operating systems are limited to 32 bits. Therefore, for disks using the 512-byte sectors (either physical or emulated) by the MBR partitioning scheme, the maximum supported disk size is 2 TiB. Consequently, larger disks had to use a different partitioning scheme, since they have become widely available since 2010. As a result, the MBR partitioning scheme has been replaced by the GUID partition table (GPT). The official 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 state flag (boot partition or not), the number, size, and type of the start and end sectors of the partition, which may be primary or extended. Each entry in the MBR partition table describes one partition, up to four of them. These entries contain only the data of the primary and extended partitions, while information about 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 every operating system needs another 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 boot loader code, also known as the Boot Loader code, is executed by the BIOS after checking the state of the hardware (CPU, memory, etc.). Because the MBR-based partitioning scheme works with 512 bytes by default, the MBR itself takes up that much space, by the way. Therefore, in order to maintain compatibility, the bootloader should also be small enough to fit into the MBR with the partition table. However, more advanced menu-driven, multi-file boot loader code takes up more space, so it is usually split into two parts so that the first, shorter boot part can fit into the MBR, which then passes control to another part of the hard drive. part. Today's modern Boot Loader programs are able to boot an operating system from any primary partition on any hard disk unit after the user has selected it from the menu. Such a universal bootloader to boot Linux and other systems, for example, is GNU GRUB. Microsoft Windows also has its own boot loader, but this is limited to starting your own Windows system.