Keywords: sag

Next: Extended and logical partitions Up: Partitions Previous: Partitions

## The MBR, boot sectors and partition table

The information about how a hard disk has been partitioned is stored in its first sector (that is, the first sector of the first track on the first disk surface). The first sector is the master boot record (MBR) of the disk; this is the sector that the BIOS reads in and starts when the machine is first booted. The master boot record contains a small program that reads the partition table, checks which partition is active (that is, marked bootable), and reads the first sector of that partition, the partition's boot sector (the MBR is also a boot sector, but it has a special status and therefore a special name). This boot sector contains another small program that reads the first part of the operating system stored on that partition (assuming it is bootable), and then starts it.

The partitioning scheme is not built into the hardware, or even into the BIOS. It is only a convention that many operating systems follow. Not all operating systems do follow it, but they are the exceptions. Some operating systems support partitions, but they occupy one partition on the hard disk, and use their internal partitioning method within that partition. The latter type exists peacefully with other operating systems (including Linux), and does not require any special measures, but an operating system that doesn't support partitions cannot co-exist on the same disk with any other operating system.

As a safety precaution, it is a good idea to write down the partition table on a piece of paper, so that if it ever corrupts you don't have to lose all your files. (A bad partition table can be fixed with `fdisk` ). The relevant information is given by the `fdisk -l` command:

> ``$` fdisk -l /dev/hda
> ``
> `Disk /dev/hda: 15 heads, 57 sectors, 790 cylinders`
> `Units = cylinders of 855 * 512 bytes`
> ``
> `Device Boot Begin Start End Blocks Id System`
> `/dev/hda1 1 1 24 10231+ 82 Linux swap`
> `/dev/hda2 25 25 48 10260 83 Linux native`
> `/dev/hda3 49 49 408 153900 83 Linux native`
> `/dev/hda4 409 409 790 163305 5 Extended`
> `/dev/hda5 409 409 744 143611+ 83 Linux native`
> `/dev/hda6 745 745 790 19636+ 83 Linux native`
> `$``

Next: Extended and logical partitions Up: Partitions Previous: Partitions