FOXy2K Contents
Home
FAT System Guide
The DOS Zone
My Software
|
Quick Reference
Use this information only if you agree to the terms in my Disclaimer
In this section you will find the layout of all the data elements
which you are likely to encounter in hard drives/floppy disks which
are formatted using the FAT file system, the MBR of course is file
system independent. This information is really aimed at programmers
but the advanced user may also find it useful.
- Partition Structures:
- The MBR.
- Format of partition information blocks.
- Format of sector and track information.
- ID numbers for FAT volumes.
- Boot Sectors and Associated Structures:
- FAT12/FAT16 Boot Sector/Boot Record Layout.
- FAT12/Fat16 Extended BPB.
- FAT32 Boot Sector/Boot Record Layout.
- File System Information Sector.
- Media Descriptor Byte.
- File allocation tables data:
- Fat numbers.
- Fat signature.
- Media Descriptor Byte.
- Directory Entry Structures:
- Directory Entry Layout.
- Extra Data Layout (previously reserved area).
- File Attribute Byte.
- Date Format.
- Time Format.
- LFN Directory Entry Layout.
Master Boot Record Layout.
Up to offset 1BEh the MBR consists purely of machine code
and data (strings etc.). At offset 1BEh the first primary partition is defined,
this takes 16 bytes, after which the second primary partition is defined,
followed by the third and fourth, the data structures are the same. |
Offset | Length (in bytes) | Field |
000h | 446 | Machine Code and Associated Data. |
1BEh | 16 | Partition 1 Information (see below). |
1CEh | 16 | Partition 2 Information (see below). |
1DEh | 16 | Partition 3 Information (see below). |
1EEh | 16 | Partition 4 Information (see below). |
1FEh | 2 | Boot Signature AA55h. |
Back to links
Format of partition information blocks.
Offset | Length (in bytes) | Field |
00h | 1 | Set to 80h if this partition is active. |
01h | 1 | Partition's starting head. |
02h | 2 | Partition's starting sector and track (see below). |
04h | 1 | Partition's ID number (see below). |
05h | 1 | Partition's ending head. |
06h | 2 | Partition's ending sector and track (see below). |
08h | 4 | Starting LBA. |
0Ch | 4 | Partition's length in sectors. |
Back to links
Back to links
ID numbers for FAT volumes.
Many of these partition types I have just
included because they are listed, I don't have any experience with most of them
, so be warned I don't know that all these partitions follow the same rules as stated before. |
ID number. | Indicates. |
00h | Unused. |
01h | DOS FAT12 (0-15MB) |
04h | DOS FAT16 (16-32MB) |
05h | DOS 3.3+ extended partition. |
06h | DOS 3.31+ FAT16 (32MB-2GB) |
0Bh | Win95 OSR2+ FAT32 (512MB-2TB) |
0Ch | Win95 OSR2+ FAT32 (512MB-2TB LBA). |
0Eh | Win95+ FAT16 (32MB-2GB) (LBA) |
0Fh | Win95+ extended partition (LBA) |
14h | OS/2 Boot Manager hidden sub-32MB FAT16 partition |
16h | OS/2 Boot Manager hidden over-32MB FAT16 partition |
1Bh | Hidden Windows95 FAT32 partition |
1Ch | Hidden Windows95 FAT32 partition (LBA) |
1Eh | Hidden LBA VFAT partition |
C1h | DR DOS 6.0 LOGIN.EXE-secured FAT12 partition |
C4h | DR DOS 6.0 LOGIN.EXE-secured FAT16 partition |
CBh | Reserved for DR-DOS secured FAT32 |
CCh | Reserved for DR-DOS secured FAT32 (LBA) |
CEh | Reserved for DR-DOS secured FAT16 (LBA) |
D0h | Multiuser DOS secured FAT12 |
D1h | Old Multiuser DOS secured FAT12 |
D4h | Old Multiuser DOS secured FAT16 (partitions equal to or smaller than 32MB) |
D5h | Old Multiuser DOS secured extended partition |
D6h | Old Multiuser DOS secured FAT16 (partitions larger than 32MB) |
E1h | SpeedStor FAT12 extended partition |
E4h | SpeedStor FAT16 extended partition |
Back to links
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
FAT numbers.
0 | Means that the cluster is free. |
FF8h-FFFh | Means EOC on FAT12 |
FFF8h-FFFFh | Means EOC on FAT16 |
FFFFFF8h-FFFFFFFh | Means EOC on FAT32 |
FF7h | Means the cluster is bad FAT12 |
FFFF7h | Means the cluster is bad FAT16 |
FFFFFF7h | Means the cluster is bad FAT32 |
Back to links
FAT signature.
Entry | Contains. |
0 | Holds the Media Descriptor Byte. in the low byte, all other bits are set. |
1 | Set to EOC at time of format.
FAT16 Bit 15 clear indicates disk should be checked for errors.
FAT16 Bit 14 clear indicates a surface check should be made.
FAT32 Bit 27 clear indicates disk should be checked for errors.
FAT32 Bit 26 clear indicates a surface check should be made.
|
Back to links
Directory Entry Layout.
The old style directory entry had 10 reserved bytes starting at 0Ch, these are now used. |
Offset | Length | Field |
00h | 8 | Filename padded with spaces if required (see above). |
08h | 3 | Filename extension padded with spaces if required. |
0Bh | 1 | File Attribute Byte. |
0Ch | 10 | Reserved or extra data. |
16h | 2 | Time of last write to file (last modified or when created). |
18h | 2 | Date of last write to file (last modified or when created). |
1Ah | 2 | Starting cluster. |
1Ch | 4 | File size (set to zero if a directory). |
Back to links
Extra data Layout (previously reserved area).
The old style directory entry had 10 reserved bytes starting at 0Ch, these are now used as follows.
Presumably these fields are used if non-zero. |
Offset | Length | Field |
0Ch | 1 | Reserved for use by Windows NT. |
0Dh | 1 | Tenths of a second at time of file creation, 0-199 is valid. |
0Eh | 2 | Time when file was created. |
10h | 2 | Date when file was created. |
12h | 2 | Date when file was last accessed. |
14h | 2 | High word of cluster number (always 0 for FAT12 and FAT16). |
Back to links
File Attribute Byte
Bit | 7-6 | 5 | 4 | 3 | 2 | 1 | 0 |
Set if: | These are reserved, set to 0. | Archive | Directory | Volume Label | System | Hidden | Read Only |
Back to links
Date Format.
Bits | 15-9 | 8-5 | 4-0 |
Give: | Years since 1980. Valid from 0-127 inclusive (1980-2107). |
Month of year. Valid from 1-12 inclusive(1=Jan). |
Day of the month. Valid from 1-31 inclusive. |
Back to links
Time Format.
Bits | 15-11 | 10-5 | 4-0 |
Give: |
Hours. Valid from 0-23 inclusive. |
Minutes. Valid from 0-59 inclusive. |
Seconds/2. Valid from 0-29 inclusive (0-58 seconds). |
Back to links
LFN Directory Entry Layout.
Each LFN directory entry holds 13 characters of the complete
LFN using 16-bit Unicode characters. |
Offset | Length | Field |
00h | 1 | Bits 0-5 give the LFN part number, bit 6 is set if this is the last entry for the file. |
01h | 10 | 1st 5 letters of LFN entry. |
0Bh | 1 | 0Fh (RSHV attributes set) |
0Ch | 1 | Reserved set to 0. |
0Dh | 1 | Checksum generated from SFN. |
0Eh | 12 | Next 6 letters of LFN entry. |
1Ah | 2 | 0 |
1Ch | 4 | Last 2 letters of LFN entry. |
Back to links
|