Partitionstabelle

Der Bootloader sowie die primäre Partitionstabelle bei PCs befinden sich im MBR, wobei die ersten 446 Bytes für den Bootloader reserviert sind, und die restlichen 66 Bytes für die Partitionstabelle.
Hexdump eines MBRs:
linux:~ # dd if=/dev/hda of=./mbr bs=512 count=1
linux:~ # hexdump -C ./mbr
00000000  eb 48 90 d0 bc 00 7c fb  50 07 50 1f fc be 1b 7c  |.H....|.P.P....||
00000010  bf 1b 06 50 57 b9 e5 01  f3 a4 cb bd be 07 b1 04  |...PW...........|
00000020  38 6e 00 7c 09 75 13 83  c5 10 e2 f4 cd 18 8b f5  |8n.|.u..........|
00000030  83 c6 10 49 74 19 38 2c  74 f6 a0 b5 07 b4 03 02  |...It.8,t.......|
00000040  ff 00 00 80 a7 47 bc 00  00 08 fa 80 ca 80 ea 53  |.....G.........S|
00000050  7c 00 00 31 c0 8e d8 8e  d0 bc 00 20 fb a0 40 7c  ||..1....... ..@||
00000060  3c ff 74 02 88 c2 52 be  7b 7d e8 36 01 f6 c2 80  |<.t...R.{}.6....|
00000070  74 56 b4 41 bb aa 55 cd  13 5a 52 72 4b 81 fb 55  |tV.A..U..ZRrK..U|
00000080  aa 75 45 a0 41 7c 84 c0  78 3e 75 05 83 e1 01 74  |.uE.A|..x>u....t|
00000090  37 66 8b 4c 10 be 05 7c  c6 44 ff 01 66 8b 1e 44  |7f.L...|.D..f..D|
000000a0  7c c7 04 10 00 c7 44 02  01 00 66 89 5c 08 c7 44  ||.....D...f.\..D|
000000b0  06 00 70 66 31 c0 89 44  04 66 89 44 0c b4 42 cd  |..pf1..D.f.D..B.|
000000c0  13 72 05 bb 00 70 eb 7d  b4 08 cd 13 73 0a f6 c2  |.r...p.}....s...|
000000d0  80 0f 84 ee 00 e9 8d 00  be 05 7c c6 44 ff 00 66  |..........|.D..f|
000000e0  31 c0 88 f0 40 66 89 44  04 31 d2 88 ca c1 e2 02  |1...@f.D.1......|
000000f0  88 e8 88 f4 40 89 44 08  31 c0 88 d0 c0 e8 02 66  |....@.D.1......f|
00000100  89 04 66 a1 44 7c 66 31  d2 66 f7 34 88 54 0a 66  |..f.D|f1.f.4.T.f|
00000110  31 d2 66 f7 74 04 88 54  0b 89 44 0c 3b 44 08 7d  |1.f.t..T..D.;D.}|
00000120  3c 8a 54 0d c0 e2 06 8a  4c 0a fe c1 08 d1 8a 6c  |<.T.....L......l|
00000130  0c 5a 8a 74 0b bb 00 70  8e c3 31 db b8 01 02 cd  |.Z.t...p..1.....|
00000140  13 72 2a 8c c3 8e 06 48  7c 60 1e b9 00 01 8e db  |.r*....H|`......|
00000150  31 f6 31 ff fc f3 a5 1f  61 ff 26 42 7c be 81 7d  |1.1.....a.&B|..}|
00000160  e8 40 00 eb 0e be 86 7d  e8 38 00 eb 06 be 90 7d  |.@.....}.8.....}|
00000170  e8 30 00 be 95 7d e8 2a  00 eb fe 47 52 55 42 20  |.0...}.*...GRUB |
00000180  00 47 65 6f 6d 00 48 61  72 64 20 44 69 73 6b 00  |.Geom.Hard Disk.|
00000190  52 65 61 64 00 20 45 72  72 6f 72 00 bb 01 00 b4  |Read. Error.....|
000001a0  0e cd 10 ac 3c 00 75 f4  c3 00 00 00 00 00 00 00  |....<.u.........|
000001b0  00 00 00 00 00 00 00 00  76 91 76 91 00 00 00 01  |........v.v.....|
000001c0  01 00 83 fe ff 7b 3f 00  00 00 3d a8 da 00 80 00  |.....{?...=.....|
000001d0  c1 7c 07 fe ff ff 7c a8  da 00 49 5a 5b 01 00 00  |.|....|...IZ[...|
000001e0  c1 ff 0f fe ff ff c5 02  36 02 3b 50 72 02 00 00  |........6.;Pr...|
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
Die Partitionstabelle besteht aus 4 Einträgen mit jeweils 16 Byte Länge für 4 mögliche Partitionen, gefolgt von zwei Signaturbytes für die Paritionstabelle die als unsigned short (16 bit little endian) 0xaa55 entsprechen.
Die folgende Tabelle beschreibt den Inhalt für einen Partitionseintrag. Wenn eine Partition nicht existiert, dann werden die Einträge mit 0x00 initialisiert wie man im obigen Beispiel am vierten Eintrag sehen kann.
Offset     Länge     Beschreibung
------------------------------------------------------------------
0x00         1       Boot Flag (0x80 = Boot, 0x00 = No Boot)
0x01         3       CHS Adresse des ersten Sectors der Partition
0x04         1       Typ der Partition
0x05         3       CHS Adresse des letzten Sectors der Partition
0x08         4       Startsektor der Partition
0x0c         4       Anzahl der Sectoren der Partition
CHS steht für Cylinder, Head, Sector und ist wie folgt kodiert:
Bytes:  Byte 0  Byte 1  Byte 2 
Bits : 012345670123456701234567
CHS  : Head    Sector  Cylinder
TypBeschreibungWertebereich
Byte 0Head0-255
Byte 1, Bits 0-5Sector0-63
Byte 1, Bits 6-7 + Byte 2Cylinder0-1023

Bei modernen Platten kann die Adressierung nicht mehr ausreichen. In diesem Fall wird der Eintrag einfach mit dem Maximum belegt (0xffffff). Alte Bootloader die diesen Eintrag zur Adressierung verwendet haben und nicht den Startsektor Eintrag an Offset 0x08, konnten deswegen auch keine Partitionen booten die über der 1024 Cylinder Grenze lagen.

Wichtige Partitionstypen (an Offset 0x4):
TypBeschreibung
0x07NTFS
0x0bFAT32
0x0fErweiterte Partition
0x82Linux Swap
0x83Linux Native
0x8eLVM
0xfdRAID
0xa5FreeBSD
0xa6OpenBSD
0xa9NetBSD

Erweiterte Partition

TODO

Valid XHTML 1.0 Strict