Back
Next
DOS file system
Primary feature of the DOS File system is its FAT.
FAT - stands for file allocation table but applies whole file system.
Specifically, - tracks used and available storage blocks on the partition.
Designed to protect against loss of data if FAT update fails.
Implemented as a pair of tables that are kept synchronized.
Each storage block (cluster) on partition numbered sequentially.
Actual access of block may be LBA or CHS depending on OS/hardware.
One FAT entry for each cluster.
Clusters
A Sector is basic allocation unit on a hard or other storage drives.
512 bytes standard.
10 GB hard drive has 20,000,000 sectors.
To minimize record keeping by os,
sectors are grouped into clusters.
Clusters of 2 to 64 sectors. (1 or 2 sectors per cluster on floppy).
All clusters on a partition are same size.
Sectors of a cluster must be contiguous and on a single track.
Limits
A file needs a minimum of one cluster for storage.
Different versions of DOS have different min./max sector/cluster ratio.
File chaining
FAT tracks files by maintaining a linked list of entries for each.
The index or id of entry matches the cluster id of file's data.
User readable directory file contains an index that points to the first
cluster of the file and the entry in the FAT table.
ID used to locate the beginning of the linked list in FAT.
OS, BIOS, and hardware translates cluster id to CHS or LBA.
The FAT entry idexed by the directory entry contains the index of the
next cluster on the drive partion and tne next entry in the FAT table.
Special entries in list's node indicate:
Last cluster of file (EOF), usually FFFF.
Cluster is unused and available, usually 0.
Cluster (sector) is bad, ___FF8h - ___FFFh.
Example
The FAT keeps separate table of clusters not currently in use (available).
Table uses 1 bit per cluster.
Duplicate FAT
The Microsoft OS keeps a second copy of the FAT.
On earliest versions, FAT 12 (floppy), no duplication.
On FAT 16, both copies next to each other.
Also possible for tables to hold dis-similar info.
On newer FAT 32, copies may be separated to protect against corruption.
Auto-Synchronization of fat provided but can be disabled.
Repair and Fragmentation
Errors.
Lost clusters.
Cross-linked clusters.
Invalid Directory entries.
Fragmentation (not error, just problem).
Utilities for repairing the FAT. Scandisk, Norton Utilities.
Compare the two FATs.
Check correct directory entries.
Check the file chains.
Check correct listing of available clusters.
Clusters of a file may be distributed randomly across a partition.
Defragmentation rearranges clusters to be optimally positioned.
Directory Entries
File Name and extension in 8.3 format unless VFAT or Fat 32
Extension interpreted by OS.
File attribute byte
Read-Only - protects against accidental deletion.
Hidden - prevents displaying with the Dir command.
System - marks file as needed by system. Essentially Read-Only
Volume - contains the partition's volume label, stored in root dir.
Directory - indicates name specifies a directory file with special
formatting.
Arhcive - used to incremental back up of files.
If file is changed, flag set.
Backup software checks flag and copies changed file if set.
Then clears archive flag bit.
Last change date/time stamp.
File size
Id of 1st cluster of data.
* Root directory, on all versions of FAT except FAT32
Considered a special data structure.
Has limited number entries.
Bios limits
Original chs limits of dos combined with IDE hardware limits
c 1024, h 16, s 63 = 504 MiB/528.4 MB (decimal).
PC Bios limit of 1024 cylinders (int 13).
Forces OS to be in 1st 1024 cylinders.
Even if software patch exists, it is loaded after os.
Fix (Int 13 extension)
New bios with an extended int 13 code to allow > 1024.
Requires software to know about it.
Applies only to ATA (IDE)
SCSI interfaces included ROM compatible with its chs structure.
FAT stats.
FAT 12
Filenames A-z0-9_
Used on floppies and drives < 16MiB
Floppies 1 or 2 sectors/cluster
Hard drives 8 sectors/cluster
1 sector for boot record and Bios parameter block.
Bios parameter block helps OS to understand structure of disk.
1st DOS
12 bit pointers (4096)
11 pointers reserved.
0,1 reserved.
FF7h marks bad cluster.
FF8h-FFFh mark end of file fat chains.
8.3 filename.
Path limit 128 characters (including filename).
DOS 1.0 - 2.0
1 cluster = 1 sector
2 Meg limit.
DOS 3.0 - 3.3
1 cluster - up to 16 sectors (8192 bytes) ?
32 MB limit.
FAT 16 August 1984
16 bit pointers (64K)
11 pointers reserved.
0,1 reserved.
FFF7h marks bad cluster.
FFF8h-FFFh mark end of file fat chains.
Theoretical support up to 2GiB or 4GiB drives.
Support of different sector/cluster ratios.
Best on drives < 256MiB because of sector/cluster ratio.
Boot sector not backed up.
Root directory has max of 512 entriees.
Less if long filenames used (VFAT).
Directory entry 32 bytes long.
Maximum of 65524 files per partition.
DOS 3.0
Because of BIOS CHS protocols, only 32MiB possible.
DOS 3.3
Introduction of partitioning,
allows larger drive to be split into 32GiB drives.
DOS 4.0
1 cluster = 4 sector (2K)
128 MB / partition * 4 partitions = 528MB
DOS 5.0
1 cluster - up to 32K (64 sectors/cluster)
2 GiB limit.
NT/2000/XP
Supports 128 sector/cluster.
2-4 GiB.
However, filesystem not readable by other OSes.
VFAT
Created for Win95
Extension to FAT 16
Filenames up 255 characters using A-z0-9_+,;=[] and spaces
Short filenames - if long filename used, short (8.3) alias also
created to provide compatibility with older software.
Last extension (after last dot) kept.
1st 6 characters kept but capitalized.
Any of the new characters converted to underscore.
VFAT adds ~# where # is 1-9 as last 2 characters.
XP uses different technique.
Alias used as primary entry in directory.
Additional directory entries (up to 8) used to store long filename.
(Because of entry limits in root directory of all dos through VFAT,
It is recomended that long names are not used in root.)
Additional entries flagged so that older OSes, ignore entries.
Older repair utilities will delete long name - invalid directory entry.
The association between a long name and a particular short name may
be lost:
When copying to another directory.
When opening file with application that only recognizes short names.
When using Backup utilities.
Backup software may cause the short alias name to be associated with
a different long name when restoring.
FAT 32 Limits
DOS 6.22
2TB limit (using FAT32, if FAT16 - still at 2GB limit).
28 bit pointers - 4 bits reserved.
Capable of 2TiB limit.
Win 2000/XP will only format a max of 32 GiB.
Win 95 SE or Win95B, Win 98.
1 cluster = 4 K to 32K
4K clusters on drives(partitions) up to *GiB.
8 GB limit per partition because of other BIOS/OS limits.
3rd party vendors provide BIOS override routines to get >8GB on older pcs.
Newer machines have improved BIOS.
FAT 32 reserves 11 pointers as did DOS12/16.
Larger pointer allows smaller clusters with large drives.
Designed to use LBA
FAT32 reserves 1st 32 sectors for boot record.
3 sector boot record at logical sector 0 and backup at 6
Following the boot sectors are 2 copies of the FAT.
FAT 32 creates 2 copies of the partition volume boot record.
OS can toggle between copies to find a good copy.
FAT 32 treats root directory as a standard directory,
up to limit 65534 entries like all other directories.
Although FAT 32 capable of 8.8TB, field size in MBR limits it to 2 TiB.
Large Partition (8GB) with small clusters (4KB)
64 MB FAT - Since FAT used a lot, tends to be cached.
Largest problem with FAT 32 is its limited or non-existent support
by older (Win95) or different OSes (NT, Mac)
Emergency boot record must be created by Win 95B, 98, ME, 2000, or XP.
Still no security, encryption, or compression.