The hard disk is a hardware device that stores all the data on a computer. The data is stored in the form of files and directories in the hard disk. A hard disk drive has a logical structure
that is compatible with the operating system installed. The Master Boot Record
is the most important part of the hard disk. It is the first sector on the hard disk that the operating system accesses. The Master Boot Record contains the Boot Loader
and Partition Tables
. It is important to know about the logical structure of the hard disk
to gain better understanding and fix issues related to the hard disk drive.
When you use your computer, your data is organized in the form of files and directories according to a tree structure and these are stored on your hard drive.
Your operating system manages all this data on your hard drive. Consequently, a hard disk must have a particular organization, understandable to your system.
The Master Boot Record (or MBR)
At the beginning of the hard drive is the MBR. When your computer starts using your hard drive, this is where it looks first.
The MBR itself has a specific organization. The size of the MBR is 512 bytes.
The boot loader
is the first 446 bytes of the MBR. This section contains executable code, where programs are housed.
The partition tables
are 4 slots of 16 bytes each, containing the description of a partition (primary or extended) on the disk.
Here is how to describe a partition:
- State of the partition (inactive partition bootable) - (1 byte)
- Custom heads at the beginning of the partition - (1 byte)
- Cylinder sector and the beginning of the partition - (2 bytes)
- Type of partition (file system, eg, 32 fat, ext2 etc ...) - (1 bytes)
- Head of the end of the partition (1 byte)
- Cylinder sector and the end of the score - (2 bytes)
- Number of sectors between the MBR and the first sector of the partition - (4 bytes)
- Number of sector of the partition - (4 bytes)
The Magic Number
is two bytes used to determine if the hard disk has a bootloader or not. If it does, the magic number should be equal in value to hexadecimal 55AA.
This document, titled « The logical structure of a hard disk », is available under the Creative Commons
license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM