FOXy2K Contents
Home
FAT System Guide
The DOS Zone
My Software
|
The Boot Sector
Use this information only if you agree to the terms in my Disclaimer
The boot sector (also called the boot record) is the
very first sector on a disk it has two important functions, the first one is to
load in your operating system (I'm going to ignore that since it's not relevant
for this) and secondly it tells us all kinds of useful(?) information about the
disk that its on. A FAT32 boot sector is actually more than one sector long,
three to be precise, so I don't see how it can accurately be called a boot
sector, the boot record is probably a more accurate term.
Two important things that are stored in the boot sector are the size of each
sector (analogous to size of each piece of paper in a notepad), usually 512
bytes (characters in layman's terms) and the total number of sectors (how many
bits of paper). With this information we can tell how much data the disk will
hold. For instance a 1.44MB 3 1/2" disk has 2,880 sectors, with 512 bytes in
each sector. There are 1024 bytes in a kilobyte and 1024 kilobytes in a megabyte
byte, so 2880 sectors multiplied by 512 bytes means 1440KB or 1.406MB. Now as
you may know these disks do not store 1.406MB of data, the maximum you can get
is 1.38MB the remaining space is used for the file system.
The boot sector also supplies information on where to find the FAT's and
root directory, you'll find out what these are later if you don't already know.
Other information that the boot sector holds include:
- The name of the operating system that formatted it.
- Sectors per cluster, you'll find out about this when you get to the data
area section.
- The maximum number of root directory entries you can have for the disk
(this is explained later).
- The volume name, this is what is displayed when you type "VOL" at a DOS
prompt or what is shown in "My Computer" for Windows users. (the volume name
can also be stored in the root directory.)
- The serial number.
The boot sector is vital to be able to read the disk if this goes the
operating system will not know what type/size disk it is dealing with, because of
this fact the FAT32 file system stores a copy of the boot sector.
That's it for the none technical area so go on
to the next section if you don't want in depth technical details if you do then
keep reading.
Technical Information on the Boot Sector.
If you look below you'll see a layout of the boot sector, along with other
information that you'll need, this data and more is also provided in the Quick Reference section.
The first thing you'll need to decide is how you are going to read the
sectors, I'm not discussing that here because I've devoted a whole section to it
later on. But if you are going to use the standard BIOS functions then you'll
want to know the number of sectors per track and the total number of
heads/sides, my advice is to use the fields that give this information rather
than use the media descriptor byte.
The next thing that you'll need to find out is where the first FAT is
located, the reserved sectors field can be used for that.
Moving on to the root directory, with FAT12/FAT16 disks you can locate it's
starting location by using the "Reserved sectors", "Number of FAT's" and
"Sectors per FAT" fields. The root directory starts immediately after the last
FAT. With FAT32 the root directory is treated in the same way as a sub-directory
would be treated, it's starting cluster is given in the in the boot sector at
offset 2Ch.
You will also need to determine whether the disk is FAT32,FAT16 or FAT12, you
will probably be thinking of using the "File system ID" field, do not the
correct method will be described in the File Allocation Tables section.
Below you will find information on the boot record and related data,
depending on how much you already know it may be advisable to go through the
following sections first then come back here (or to the Quick Reference area)
later. All the data is all in Intel byte order, little endian.
You can use these links to quickly locate items that are of interest.
- FAT12/FAT16 Boot Sector/Boot Record Layout.
- FAT12/Fat16 Extended BPB.
- FAT32 Boot Sector/Boot Record Layout.
- File System Information Sector.
- Media Descriptor Byte.
FAT12/FAT16 Boot Sector/Boot Record Layout.
The data contained in the boot sector after the OEM name string is referred to as the BIOS parameter block or BPB. |
Offset | Length | Field |
00h | 3 | Machine code for jump over the data. |
03h | 8 | OEM name string (of OS which formatted the disk). |
0Bh | 2 | Bytes per sector, nearly always 512 but can be 1024,2048 or 4096. |
0Dh | 1 | Sectors per cluster, valid number are: 1,2,4,8,16,32,64 and 128, but a cluster size larger than 32K should not occur. |
0Eh | 2 | Reserved sectors (number of sectors before the first FAT including the boot sector), usually 1. |
10h | 1 | Number of FAT's (nearly always 2). |
11h | 2 | Maximum number of root directory entries. |
13h | 2 | Total number of sectors (for small disks only, if the disk is too big this is set to 0 and offset 20h is used instead). |
15h | 1 | Media descriptor byte, pretty meaningless now (see below). |
16h | 2 | Sectors per FAT. |
18h | 2 | Sectors per track. |
1Ah | 2 | Total number of heads/sides. |
1Ch | 4 | Number of hidden sectors (those preceding the boot sector). |
20h | 4 | Total number of sectors for large disks. |
24h | 26 | Either extended BPB (see below) or machine code. |
3Eh | 448 | Machine code. |
1FEh | 2 | Boot Signature AA55h. |
Back to links
FAT12/Fat16 Extended BPB.
The Extended BIOS parameter block is not present prior to DOS 4.0 formatted disks. |
Offset | Length (in bytes) | Field |
24h | 1 | Physical drive number (BIOS system ie 80h is first HDD, 00h is first FDD). |
25h | 1 | Current head (not used for this but WinNT stores two flags here). |
26h | 1 | Signature (must be 28h or 29h to be recognised by NT). |
27h | 4 | The serial number, the serial number is stored in reverse order and is the hex representation of the bytes stored here. |
2Bh | 11 | Volume label. |
36h | 8 | File system ID. "FAT12", "FAT16" or "FAT ". |
Back to links
FAT32 Boot Sector/Boot Record Layout.
The data contained in the boot sector after the OEM name string is referred to as the BIOS parameter block or BPB. |
Offset | Length | Field |
00h | 3 | Machine code for jump over the data. |
03h | 8 | OEM name string (of OS which formatted the disk). |
0Bh | 2 | Bytes per sector, nearly always 512 but can be 1024,2048 or 4096. |
0Dh | 1 | Sectors per cluster, valid number are: 1,2,4,8,16,32,64 and 128, but a cluster size larger than 32K should not occur. |
0Eh | 2 | Reserved sectors (number of sectors before the first FAT including the boot sector), usually 32. |
10h | 1 | Number of FAT's (nearly always 2). |
11h | 2 | Maximum number of root directory entries. |
13h | 2 | 0. |
15h | 1 | Media descriptor byte, pretty meaningless now (see below). |
16h | 2 | 0. |
18h | 2 | Sectors per track. |
1Ah | 2 | Total number of heads/sides. |
1Ch | 4 | Number of hidden sectors (those preceding the boot sector). |
20h | 4 | Total number of sectors. |
24h | 4 | FAT32 sectors per FAT. |
28h | 2 | If bit 7 is clear then all FAT's are updated other wise bits 0-3 give the current active FAT, all other bits are reserved. |
2Ah | 2 | High byte is major revision number, low byte is minor revision number, currently both are 0. |
2Ch | 4 | Root directory starting cluster. |
30h | 2 | File system information sector. |
32h | 2 | If non-zero this gives the sector which holds a copy of the boot record, usually 6. |
34h | 12 | Reserved, set to 0. |
40h | 1 | Physical drive number (BIOS system ie 80h is first HDD, 00h is first FDD) |
41h | 1 | Reserved. |
42h | 1 | Signature (must be 28h or 29h to be recognised by NT). |
43h | 4 | The serial number, the serial number is stored in reverse order and is the hex representation of the bytes stored here. |
47h | 11 | Volume label. |
52h | 8 | File system ID "FAT32 ". |
5Ah | 8 | Machine code. |
1FEh | 2 | Boot Signature AA55h. |
Back to links
File System Information Sector.
Offset | Length | Field |
0h | 4 | Leading Signature 41615252h. |
4h | 480 | Reserved, set to 0. |
1E4h | 4 | FSI structure signature 61417272h. |
1E8h | 4 | Contains the last known count of free clusters, if this is equal to FFFFFFFFh then the count is unknown. |
1ECh | 4 | Cluster number at which you should begin a search for a free cluster, if this is equal to FFFFFFFFh then the field has not been set. |
1F0h | 12 | Reserved, set to 0. |
1FCh | 4 | Trailing Signature AA550000h. |
Back to links
Media Descriptor Byte.
The Media descriptor byte is meaningless because of the duplications, F0h for example. |
Byte | Type of disk | Sectors | Heads | Tracks | Capacity |
FFh | 5 1/4" | 8 | 2 | 40 | 320KB |
FEh | 5 1/4" | 8 | 1 | 40 | 160KB |
FDh | 5 1/4" | 9 | 2 | 40 | 360KB |
FCh | 5 1/4" | 9 | 1 | 40 | 180KB |
FBh | both | 9 | 2 | 80 | 640KB |
FAh | both | 9 | 1 | 80 | 320KB |
F9h | 5 1/4" | 15 | 2 | 80 | 1200KB |
F9h | 3 1/2" | 9 | 2 | 80 | 720KB |
F0h | 3 1/2" | 18 | 2 | 80 | 1440KB |
F0h | 3 1/2" | 36 | 2 | 80 | 2880KB |
F8h | hard disk | NA | NA | NA | NA |
Back to links
|