university of pennsylvania 10/31/00cse 3801 windows file system - fat originally invented as a...
TRANSCRIPT
10/31/00 CSE 380 1
University of Pennsylvania
Windows File System - FAT
• originally invented as a method for storing data on floppy disks.
• later used by MS-DOS with supports for a hierarchical directory structure, and fixed disks as well as floppy disks
• still used by Windows 3.x and Win95 supporting long filenames and allowing drive size to 2047 gigabytes
Boot Sector FAT file
Directory EntriesFAT ... ... file
DirectoryEntries
FAT File Structure:
FAT: File Allocation Table
...
10/31/00 CSE 380 2
University of Pennsylvania
FAT File Structure
• Cluster - a fundamental unit of disk storage (a collection of sectors)
• File Allocation Table (FAT) – used to track of the usage of a volume’s clusters
– each entry for a cluster represents whether it is used, which cluster is next if used, or whether it contains a bad sector
– FAT12/16/32 means the size of FAT entry (12/16/32 bits)
– two identical copies of FAT for recovery
...
Clusters ...
1 2 3 4 5 6 7 8 ...
FAT 0 0 0 06 -1 7 4
pointed by directory entry
10/31/00 CSE 380 3
University of Pennsylvania
FAT File Structure
•
Directory Entry
– keeps track of information about a file or directory
– short name entry
• name and extension, attributes, size, and time
• a starting cluster number
– long name entry - used by Win95 to support long filename
• sequence, type(longname entry)
• name (wchar_t [13]) : 2-byte character for international characters
– A filename can have 256 characters.
• one short name entry can have upto 20 longname entries
10/31/00 CSE 380 4
University of Pennsylvania
FAT File Structure
Example - “C:\fooDir\barLongnameFile”
– The root directory starts at #0 cluster
Clusters
0 1 2 3 4 5 ...
...
......
fooDir 2...
. . .
. . .
. . . B le1 barLongnameFibarLon~1 4 . . .
0 1 2 3 4 5
FAT -1 3 50 -1 -1 ...
10/31/00 CSE 380 5
University of Pennsylvania
FAT File Structure
Disk Size vs Cluster Size and FAT Size
FAT12 FAT16 FAT32 DISK SIZE
(Cluster Size, FAT Size)
1Giga (230) bytes (256K, 6K) (16K, 256K) (4K, 4M)
2Giga (231) bytes (512K, 6K) (32K, 256K) (4K, 8M)
512M (229) bytes (128K, 6K) ( 8K, 256K) (4K, 2M)
10/31/00 CSE 380 6
University of Pennsylvania
FAT File Structure
Disk Size, Cluster Size vs FAT Size
e.g. Disk Size = 1 Giga (230) bytes ( 1 sector = 512(29) bytes )
Cluster Size
– FAT12 : (212) clusters * (218) bytes/cluster (256K bytes/cluster)
– FAT16 : (216) clusters * (214) bytes/cluster (16K bytes/cluster)
– FAT32 : (232) clusters * (28) bytes/cluster - ??
(218) clusters * (212) bytes/cluster (4K bytes/cluster)
FAT Size
– FAT12 : (212) entry * 12 bits/entry = 3*(211) bytes = 6K bytes
– FAT16 : (216) entry * 16 bits/entry = (218) bytes = 256K bytes
– FAT32 : (218) entry * 32 bits/entry = (222) bytes = 4M bytes