The logical structure of a hard disk
Introduction
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 found on your Hard drive.
A hard disk must have a particular organization, understandable to your system and this is what we will try to understand.
Logical Structure
The Master Boot Record (or MBR)
At the beginning of the hard drive is the Mbr. When your computer starts using your hard drive, where he will begin to look at.
The Mbr itself contains a specific organization. Mbr size is 512 bytes.
It is the first 446 bytes of Mbr. This section contains executable code, where programs are housed, as bootlader lilo, grub or windows for example.
4 slots of 16 bytes each :containing the description of a partition (primary or extended) on the disk.
Here is how the description of a partition:
- State of the partition (inactive partition bootable) - (1 byte)
- Custom Heads of 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)
- Magic Number
There are two bytes. They are used to determine if the hard disk has a bootloader or not.
If so, the magic number should be equal in value to hexadecimal 55AA.
Here is what happen when a computer start with the mbr:
The computer starts and the bios start to execute code as the routine check of memory for example. Then the bios inspects your hard disk, you will read and verify its Mbr and the magic number. If the magic number is equal to 55AA, then the bios will load the first 446 bytes of mbr then leave it to the main executable code.
Sources
[http://] wikipedia.org/wiki/Master_boot_record
http://www.brothersofnet.freesurf.en/sans_popup/mbr_table_partition.html
http://www.datarescue.com/laboratory/partition.htm