Lecture # 31: Inside A Boot Block
Lecture # 31: Inside A Boot Block
Lecture # 31
Reserved Blocks
The LSN of the boot block is 0. The information contained within the BPB in boot block
can be used to calculate the LSN of the block from where the user data starts. It can be
simply calculated by adding the number of reserved sector, sectors occupied by FAT
copies * number of FAT copies and the the number of blocks reserved for root dir.
codepart:
The above slide shows the location of BPB within the boot block. A jump instruction
(near jump of 3 bytes size) is used to jump to the code part and skip the data part so that it
is not interpreted as instructions by the processor.
0000 EB 3C 90 2A 2D 76 34 56 . < . * - v 4 V
0008 49 48 43 00 02 01 01 00 I H C . . . . .
0010 02 E0 00 40 0B F0 09 00 . . . @ . . . .
0018 12 00 02 00 00 00 00 00 . . . . . . . .
0020 00 00 00 00 00 00 29 E1 . . . . . . ) .
0028 6C 87 2A 20 20 20 20 20 l . *
0030 20 20 20 20 20 20 46 41 F A
0038 54 31 32 20 20 20 33 C9 T 1 2 3 .
00 40 8E D1 BC FC 7B 16 07 BD . . . . { . ..
00 48 78 00 C5 76 00 1E 56 16 x . . v . . V.
00 50 55 BF 22 05 89 7E 00 89 U . " . . ~ ..
00 58 4E 02 B1 0B FC F3 A4 06 N . . . . . ..
00 60 1F BD 00 7C C6 45 FE 0F . . . | . E ..
00 68 38 4E 24 7D 20 8B C1 99 8 N $ } . ..
00 70 E8 7E 01 83 EB 3A 66 A1 . ~ . . . : f.
00 78 1C 7C 66 3B 07 8A 57 FC . | f ; . . W.
00 80 75 06 80 CA 02 88 56 02 u . . . . . V.
00 88 80 C3 10 73 ED 33 C9 FE . . . s . 3 ..
00 90 06 D8 7D 8A 46 10 98 F7 . . } . F . ..
00 98 66 16 03 46 1C 13 56 1E f . . F . . V.
00 A0 03 46 0E 13 D1 8B 76 11 . F . . . . v.
00 A8 60 89 46 FC 89 56 FE B8 ` . F . . V ..
00 B0 20 00 F7 E6 8B 5E 0B 03 . . . . ^ ..
00 B8 C3 48 F7 F3 01 46 FC 11 . H . . . F ..
00 C0 4E FE 61 BF 00 07 E8 28 N . a . . . .(
00 C8 01 72 3E 38 2D 74 17 60 . r > 8 -t . `
00 D0 B1 0B BE D8 7D F3 A6 61 . . . . } . .a
00 D8 74 3D 4E 74 09 83 C7 20 t = N t . . .
00 E0 3B FB 72 E7 EB DD FE 0E ; . r . . . ..
00 E8 D8 7D 7B A7 BE 7F 7D AC . } { . . . }.
00 F0 98 03 F0 AC 98 40 74 0C . . . . . @ t.
00 F8 48 74 13 B4 0E BB 07 00 H t . . . . ..
01 00 CD 10 EB EF BE 82 7D EB . . . . . . }.
01 08 E6 BE 80 7D EB E1 CD 16 . . . } . . ..
01 10 5E 1F 66 8F 04 CD 19 BE ^ . f . . . ..
01 18 81 7D 8B 7D 1A 8D 45 FE . } . } . . E.
01 20 8A 4E 0D F7 E1 03 46 FC . N . . . . F.
01 28 13 56 FE B1 04 E8 C2 00 . V . . . . ..
01 30 72 D7 EA 00 02 70 00 52 r . . . . p .R
01 38 50 06 53 6A 01 6A 10 91 P . S j . j ..
01 40 8B 46 18 A2 26 05 96 92 . F . . & . ..
01 48 33 D2 F7 F6 91 F7 F6 42 3 . . . . . .B
01 50 87 CA F7 76 1A 8A F2 8A . . . v . . ..
01 58 E8 C0 CC 02 0A CC B8 01 . . . . . . ..
01 60 02 80 7E 02 0E 75 04 B4 . . ~ . . u ..
01 68 42 8B F4 8A 56 24 CD 13 B . . . V $ ..
01 70 61 61 72 0A 40 75 01 42 a a r . @ u .B
01 78 03 5E 0B 49 75 77 C3 03 . ^ . I u w ..
01 80 18 01 27 0D 0A 49 6E 76 . . ' . . I nv
01 88 61 6C 69 64 20 73 79 73 a l i d s ys
01 90 74 65 6D 20 64 69 73 6B t e m d i sk
01 98 FF 0D 0A 44 69 73 6B 20 . . . D i s k
01 A0 49 2F 4F 20 65 72 72 6F I / O e r ro
01 A8 72 FF 0D 0A 52 65 70 6C r . . . R e pl
01 B0 61 63 65 20 74 68 65 20 a c e t h e
01 B8 64 69 73 6B 2C 20 61 6E d i s k , an
01 C0 64 20 74 68 65 6E 20 70 d t h e n p
01 C8 72 65 73 73 20 61 6E 79 r e s s a ny
01 D0 20 6B 65 79 0D 0A 00 00 k e y . . ..
01 D8 49 4F 20 20 20 20 20 20 I O
01 E0 53 59 53 4D 53 44 4F 53 S Y S
M S D OS
01 E8 20 20 20 53 59 53 7F 01 S Y S ..
01 F0 00 41 BB 00 07 60 66 6A . A . . . ` fj
01 F8 00 E9 3B FF 00 00 55 AA . . ; . . . U.
Above is the dump of the boot block for a FAT 12 system. The contents of the BPB can
be read from it the following slide shows the detail of the information obtained from the
above BPB.
Logical drive: A
Size: 1 Mb (popularly 1 Mb)
Logical sectors: b40h = 2880
Bytes per sector: 512
Sectors per Cluster: 1
Cluster size: 512
File system: FAT12
Number of copies of FAT: 2
Sectors per FAT: 9
Start sector for FAT1: reserved sectors = 1
Start sector for FAT2: reserved sectors +
size of FAT = 1 + 9 =10
Root DIR Sector: reserved sectors +
2 * (size of FAT) = 1 + 2 * 9 = 19
Hidden sectors: 0
SerialVolumeID: 2A876CE1
Volume Label:
Following is another dump showing the boot block for a FAT 16 system.
0000 EB 3C 90 4D 53 44 4F 53 . < . M S D O S
0008 35 2E 30 00 02 08 08 00 5 . 0 . . . . .
0010 02 00 02 00 00 F8 CC 00 . . . . . . . .
0018 3F 00 FF 00 3F 00 00 00 ? . . . ? . . .
0020 5B 5F 06 00 80 00 29 35 [ _ . . . . ) 5
0028 BC A5 2C 4E 4F 20 4E 41 . . , N O N A
0030 4D 45 20 20 20 20 46 41 M E F A
0038
00 40 8E D1 BC F0 7B 8E D9
54
B8 . . . .
31
{ . ..
36 20 20 20 33 C9 T 1 6 3 .
00 48 00 20 8E C0 FC BD 00 7C . . . . . .|
00 50 38 4E 24 7D 24 8B C1 99 8 N $ } $ . ..
00 58 E8 3C 01 72 1C 83 EB 3A . < . r . . .:
00 60 66 A1 1C 7C 26 66 3B 07 f . . | & f ;.
00 68 26 8A 57 FC 75 06 80 CA & . W . u . ..
00 70 02 88 56 02 80 C3 10 73 . . V . . . .s
00 78 EB 33 C9 8A 46 10 98 F7 . 3 . . F . ..
00 80 66 16 03 46 1C 13 56 1E f . . F . . V.
00 88 03 46 0E 13 D1 8B 76 11 . F . . . . v.
00 90 60 89 46 FC 89 56 FE B8 ` . F . . V ..
00 98 20 00 F7 E6 8B 5E 0B 03 . . . . ^ ..
00 A0 C3 48 F7 F3 01 46 FC 11 . H . . . F ..
00 A8 4E FE 61 BF 00 00 E8 E6 N . a . . . ..
00 B0 00 72 39 26 38 2D 74 17 . r 9 & 8- t .
00 B8 60 B1 0B BE A1 7D F3 A6 ` . . . . } ..
00 C0 61 74 32 4E 74 09 83 C7 a t 2 N t . ..
00 C8 20 3B FB 72 E6 EB DC A0 ; . r . . ..
00 D0 FB 7D B4 7D 8B F0 AC 98 . } . } . . ..
00 D8 40 74 0C 48 74 13 B4 0E @ t . H t . ..
00 E0 BB 07 00 CD 10 EB EF A0 . . . . . . ..
00 E8 FD 7D EB E6 A0 FC 7D EB . } . . . . }.
00 F0 E1 CD 16 CD 19 26 8B 55 . . . . . & .U
00 F8 1A 52 B0 01 BB 00 00 E8 . R . . . . ..
01 00 3B 00 72 E8 5B 8A 56 24 ; . r . [ . V$
01 08 BE 0B 7C 8B FC C7 46 F0 . . | . . . F.
01 10 3D 7D C7 46 F4 29 7D 8C = } . F . ) }.
01 18 D9 89 4E F2 89 4E F6 C6 . . N . . N ..
01 20 06 96 7D CB EA 03 00 00 . . } . . . ..
01 28 20 0F B6 C8 66 8B 46 F8 . . . f . F.
01 30 66 03 46 1C 66 8B D0 66 f . F . f . .f
01 38 C1 EA 10 EB 5E 0F B6 C8 . . . . ^ . ..
01 40 4A 4A 8A 46 0D 32 E4 F7 J J . F . 2 ..
01 48 E2 03 46 FC 13 56 FE EB . . F . . V ..
01 50 4A 52 50 06 53 6A 01 6A J R P . S j .j
01 58 10 91 8B 46 18 96 92 33 . . . F . . .3
01 60 D2 F7 F6 91 F7 F6 42 87 . . . . . . B.
01 68 CA F7 76 1A 8A F2 8A E8 . . v . . . ..
01 70 C0 CC 02 0A CC B8 01 02 . . . . . . ..
01 78 80 7E 02 0E 75 04 B4 42 . ~ . . u . .B
01 80 8B F4 8A 56 24 CD 13 61 . . . V $ . .a
01 88 61 72 0B 40 75 01 42 03 a r . @ u . B.
01 90 5E 0B 49 75 06 F8 C3 41 ^ . I u . . .A
01 98 BB 00 00 60 66 6A 00 EB . . . ` f j ..
01 A0 B0 4E 54 4C 44 52 20 20 . N T L D R
01 A8 20 20 20 20 0D 0A 52 65 . . Re
01 B0 6D 6F 76 65 20 64 69 73 m o v e d is
01 B8 6B 73 20 6F 72 20 6F 74 k s o r ot
01 C0 68 65 72 20 6D 65 64 69 h e r m e di
01 C8 61 2E FF 0D 0A 44 69 73 a . . . . D is
01 D0 6B 20 65 72 72 6F 72 FF k e r r o r.
01 D8 0D 0A 50 72 65 73 73 20 . . P r e s s
01 E0 61 6E 79 20 6B 65 79 20 a n y k e y
01 E8 74 6F 20 72 65 73 74 61 t o r e s ta
01 F0 72 74 0D 0A 00 00 00 00 r t . . . . ..
01 F8 00 00 00 AC CB D8 55 AA . . . . . . U.
Following is the detail of information read from the above dump which describes the
volume in question.
Heads: 255
Hidden sectors: 63
SerialVolumeID: 2CA5BC35
Volume Label: NO NAME
Besides the LBA address a LSN address can also be used to address a block. If the LSN
address is known the absread() function can be used to read a block and abswrite() can be
used to write on it as described in the slide below where nsect is the number of sector to
be read/written.
• abswrite( )
is used to write a block given its LSN