Fox Y2K Logo
FAT System Guide
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
000h446Machine Code and Associated Data.
1BEh16Partition 1 Information (see below).
1CEh16Partition 2 Information (see below).
1DEh16Partition 3 Information (see below).
1EEh16Partition 4 Information (see below).
1FEh2Boot Signature AA55h.
Back to links

 

Format of partition information blocks.
Offset
Length
(in bytes)
Field
00h1Set to 80h if this partition is active.
01h1Partition's starting head.
02h2Partition's starting sector and track (see below).
04h1Partition's ID number (see below).
05h1Partition's ending head.
06h2Partition's ending sector and track (see below).
08h4Starting LBA.
0Ch4Partition's length in sectors.
Back to links

 

Format of sector and track information.
Bits 15-6Bits 5-0
TrackSector
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.
00hUnused.
01hDOS FAT12 (0-15MB)
04hDOS FAT16 (16-32MB)
05hDOS 3.3+ extended partition.
06hDOS 3.31+ FAT16 (32MB-2GB)
0BhWin95 OSR2+ FAT32 (512MB-2TB)
0ChWin95 OSR2+ FAT32 (512MB-2TB LBA).
0EhWin95+ FAT16 (32MB-2GB) (LBA)
0FhWin95+ extended partition (LBA)
14hOS/2 Boot Manager hidden sub-32MB FAT16 partition
16hOS/2 Boot Manager hidden over-32MB FAT16 partition
1BhHidden Windows95 FAT32 partition
1ChHidden Windows95 FAT32 partition (LBA)
1EhHidden LBA VFAT partition
C1hDR DOS 6.0 LOGIN.EXE-secured FAT12 partition
C4hDR DOS 6.0 LOGIN.EXE-secured FAT16 partition
CBhReserved for DR-DOS secured FAT32
CChReserved for DR-DOS secured FAT32 (LBA)
CEhReserved for DR-DOS secured FAT16 (LBA)
D0hMultiuser DOS secured FAT12
D1hOld Multiuser DOS secured FAT12
D4hOld Multiuser DOS secured FAT16 (partitions equal to or smaller than 32MB)
D5hOld Multiuser DOS secured extended partition
D6hOld Multiuser DOS secured FAT16 (partitions larger than 32MB)
E1hSpeedStor FAT12 extended partition
E4hSpeedStor 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.
OffsetLengthField
00h3Machine code for jump over the data.
03h8OEM name string (of OS which formatted the disk).
0Bh2Bytes per sector, nearly always 512 but can be 1024,2048 or 4096.
0Dh1Sectors per cluster, valid number are: 1,2,4,8,16,32,64 and 128, but a cluster size larger than 32K should not occur.
0Eh2Reserved sectors (number of sectors before the first FAT including the boot sector), usually 1.
10h1Number of FAT's (nearly always 2).
11h2Maximum number of root directory entries.
13h2Total number of sectors (for small disks only, if the disk is too big this is set to 0 and offset 20h is used instead).
15h1Media descriptor byte, pretty meaningless now (see below).
16h2Sectors per FAT.
18h2Sectors per track.
1Ah2Total number of heads/sides.
1Ch4Number of hidden sectors (those preceding the boot sector).
20h4Total number of sectors for large disks.
24h26Either extended BPB (see below) or machine code.
3Eh448Machine code.
1FEh2Boot 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
24h1Physical drive number (BIOS system ie 80h is first HDD, 00h is first FDD).
25h1Current head (not used for this but WinNT stores two flags here).
26h1Signature (must be 28h or 29h to be recognised by NT).
27h4The serial number, the serial number is stored in reverse order and is the hex representation of the bytes stored here.
2Bh11Volume label.
36h8File 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.
OffsetLengthField
00h3Machine code for jump over the data.
03h8OEM name string (of OS which formatted the disk).
0Bh2Bytes per sector, nearly always 512 but can be 1024,2048 or 4096.
0Dh1Sectors per cluster, valid number are: 1,2,4,8,16,32,64 and 128, but a cluster size larger than 32K should not occur.
0Eh2Reserved sectors (number of sectors before the first FAT including the boot sector), usually 32.
10h1Number of FAT's (nearly always 2).
11h2Maximum number of root directory entries.
13h20.
15h1Media descriptor byte, pretty meaningless now (see below).
16h20.
18h2Sectors per track.
1Ah2Total number of heads/sides.
1Ch4Number of hidden sectors (those preceding the boot sector).
20h4Total number of sectors.
24h4FAT32 sectors per FAT.
28h2If 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.
2Ah2High byte is major revision number, low byte is minor revision number, currently both are 0.
2Ch4Root directory starting cluster.
30h2File system information sector.
32h2If non-zero this gives the sector which holds a copy of the boot record, usually 6.
34h12Reserved, set to 0.
40h1Physical drive number (BIOS system ie 80h is first HDD, 00h is first FDD)
41h1Reserved.
42h1Signature (must be 28h or 29h to be recognised by NT).
43h4The serial number, the serial number is stored in reverse order and is the hex representation of the bytes stored here.
47h11Volume label.
52h8File system ID "FAT32 ".
5Ah8Machine code.
1FEh2Boot Signature AA55h.
Back to links

 

File System Information Sector.
OffsetLengthField
0h4Leading Signature 41615252h.
4h480Reserved, set to 0.
1E4h4FSI structure signature 61417272h.
1E8h4Contains the last known count of free clusters, if this is equal to FFFFFFFFh then the count is unknown.
1ECh4Cluster 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.
1F0h12Reserved, set to 0.
1FCh4Trailing Signature AA550000h.
Back to links

 

Media Descriptor Byte.
The Media descriptor byte is meaningless because of the duplications, F0h for example.
ByteType of diskSectorsHeadsTracksCapacity
FFh5 1/4"8240320KB
FEh5 1/4"8140160KB
FDh5 1/4"9240360KB
FCh5 1/4"9140180KB
FBhboth9280640KB
FAhboth9180320KB
F9h5 1/4"152801200KB
F9h3 1/2"9280720KB
F0h3 1/2"18 2801440KB
F0h3 1/2"36 2802880KB
F8hhard diskNANANANA
Back to links

 

FAT numbers.
0 Means that the cluster is free.
FF8h-FFFh Means EOC on FAT12
FFF8h-FFFFhMeans EOC on FAT16
FFFFFF8h-FFFFFFFhMeans 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.
OffsetLengthField
00h8Filename padded with spaces if required (see above).
08h3Filename extension padded with spaces if required.
0Bh1File Attribute Byte.
0Ch10Reserved or extra data.
16h2Time of last write to file (last modified or when created).
18h2Date of last write to file (last modified or when created).
1Ah2Starting cluster.
1Ch4File 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.
OffsetLengthField
0Ch1Reserved for use by Windows NT.
0Dh1Tenths of a second at time of file creation, 0-199 is valid.
0Eh2Time when file was created.
10h2Date when file was created.
12h2Date when file was last accessed.
14h2High word of cluster number (always 0 for FAT12 and FAT16).
Back to links

 

File Attribute Byte
Bit7-654321 0
Set if:These are reserved, set to 0.ArchiveDirectoryVolume LabelSystemHiddenRead Only
Back to links

 

Date Format.
Bits15-98-54-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.
Bits15-1110-54-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.
OffsetLengthField
00h1Bits 0-5 give the LFN part number, bit 6 is set if this is the last entry for the file.
01h10 1st 5 letters of LFN entry.
0Bh10Fh (RSHV attributes set)
0Ch1Reserved set to 0.
0Dh1Checksum generated from SFN.
0Eh12Next 6 letters of LFN entry.
1Ah20
1Ch4Last 2 letters of LFN entry.
Back to links
Copyright © Jonathan Fox 2000-2002.