Overview of FAT Filesystem: Definitions, History, and Structures
The FAT (File Allocation Table) Filesystem dates back to the late 1970s and has evolved through versions like FAT8, FAT12, FAT16. This system organizes data on disk using a simple yet effective structure of allocation tables for file storage, following Little Endian byte ordering. The FAT structure includes logical blocks, clusters, and a directory organization that aids in locating file data on disk. Learn about the evolution of FAT from early floppy disk systems to modern storage technologies.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
UMBC CMSC 421 Spring 2017 The FAT Filesystem
Overview Definitions What is a File Allocation Table? History of FAT/FAT Versions Basic structures File organization
Definitions Endianness Byte ordering of multi-byte integers FAT follows the Little Endian byte ordering, placing the least significant byte first on disk (like x86 processors do for memory) Multi-byte integer Numeric data type that takes up more than one byte. Common types: word (16 bits/2 bytes), double-word (32 bits/4 bytes), and quad- word (64 bits/8 bytes) Logical block A series of one or more consecutive disk sectors. Usually contains a power-of-two number of raw disk sectors. In FAT, usually a logical block contains a single 512 byte disk sector. Cluster A series of consecutive filesystem logical blocks. Usually contains a power-of-two number of blocks.
What is a File Allocation Table? A File Allocation Table is a simple disk structure for finding the disk blocks allocated to a file Contains one entry per data cluster on the filesystem Entries form linked lists to where the data is for each file on the disk For instance, if a file begins in data cluster 10, then conceptually FAT[10] will tell us the next cluster in the file, unless the file fits in one cluster on the disk Special markers for end of chain, unallocated space, bad clusters (a cluster that contains one or more bad disk sectors) The directory structure will tell us where the first cluster is in a file
History of FAT FAT8 1977-1979 Originally written by Marc McDonald Designed for 8 floppy disks used on the NCR 7200 Model VI terminal Used an 8 bit file allocation table, 9 byte file names Directory entries originally 16 bytes long, extended later to 32 bytes (which is still the case to this day) FAT12 1980-1982 Designed for Seattle Computer Products (SCP) QDOS/86-DOS operating system, based on the original 8 bit FAT filesystem by Tim Paterson Again, designed for floppy disks Used a 12 bit file allocation table, 11 byte (8.3) file names Acquired by Microsoft when purchasing the rights to 86-DOS, which was the basis for MS- DOS and IBM PC-DOS Modified slightly several times to adapt to newer disk technologies and to add minor features - still used on floppy disks (not that we use those all that much anymore) Maximum volume size of approximately 16 or 32MiB
History of FAT FAT16 1984 Further extended the file allocation table size to 16 bits Designed for early PC hard drives (which were 20MB in size) Maximum volume size of 32MiB (65536 512-byte disk sectors) Logical sectored versions exist, which extend the maximum volume size FAT16B 1987 What is commonly referred to as FAT16 today Extended the sector count to be a 32-bit value, vastly expanding the maximum volume size to up to 16GiB on some systems (like Windows NT4) Common maximum volume size limit is 2GiB
History of FAT FAT32 -1996 Introduced with Windows 95 OSR2 Extended the FAT entry size to 28 bits Each entry is actually 32 bits in length, but the top 4 bits are reserved Maximum volume size of 2TiB (4,294,967,296 512-byte sectors) Can use a logical-sectored variant for a larger maximum volume size Maximum file size of 2 or 4 GiB, depending on filesystem variant Other variants FATX 2001, used on the Xbox and Xbox 360 video game consoles exFAT 2006, used commonly on flash media such as SDXC cards
Basic FAT Filesystem Structure FAT filesystems follow a specific structure, placing important filesystem metadata at the beginning of the volume: Sector 0: Boot Sector/Volume Boot Record (VBR) Contains the BIOS Parameter Block (BPB) which defines the basic characteristics of the volume After the BPB (and any extended BPBs), contains boot code for the OS if the volume is bootable Sector 1 (FAT32 only): Filesystem Information Sector Contains information intended to speed up certain common disk operations, such as the number of free clusters and the last allocated cluster Reserved Sectors (if any) immediately follow the VBR (FAT12/FAT16) or FS Info Sector (FAT32)
Basic FAT Filesystem Structure Immediately after the reserved sectors, one or more copies of the File Allocation Table itself are present Contains one entry (either 12, 16, or 32 bits in length) per data cluster of the volume First two entries of the FAT are reserved (entries 0 and 1), meaning the first data cluster is 2 FAT12 and FAT16 place the root directory at the beginning of the volume as well, pre-allocating some number of sectors for it FAT32 places the root directory in the data area of the volume, usually (but not necessarily) starting in cluster 2 After the root directory (FAT12/FAT16) or the File Allocation Table (FAT32), the data area of the volume begins with cluster 2
BIOS Parameter Block The BPB/EBPB of a volume contains the basic parameters of the volume itself including: Bytes per logical block Blocks per cluster Number of logical blocks Length of the FATs Volume ID/Name
Directory Entries Directory entries (either in the root directory or any other subdirectory) follow a very simple format Name of the file (11 bytes) -Divided into an 8 byte file name and a 3 byte extension File attributes (1 byte) -such as read only/hidden/system status) Reserved (1 byte) -used by some OSes for various extended attributes Creation timestamp (3 bytes) and date (2 bytes) Access date (2 bytes) High-order 16-bits of the starting cluster of the file (2 bytes) Modification timestamp (2 bytes) and date (2 bytes) Low-order 16-bits of the starting cluster of the file (2 bytes) File size (4 bytes)
Long File Names Long file name support uses directory entries in a specific format so that non-LFN- aware systems will ignore them Sequence Number (1 byte) 5 characters of the filename in UCS-2 (10 bytes) 0x0F attributes in a normal directory entry (1 byte) 0x00 LFN type, reserved byte in a normal entry (1 byte) Short filename checksum (1 byte) 6 characters of the filename in UCS-2 (12 bytes) 0x0000 first cluster of file in a normal entry (2 bytes) 2 characters of the filename in UCS-2 (4 bytes) Entries are chained together by way of the sequence number field Maximum file name length is 256 UCS-2 characters LFN entries directly proceed the basic directory entry for the file and are organized such that the last characters of the filename appear first in the directory structure
FAT structure First two entries of the FAT are reserved: FAT[0] = FAT ID (always 0xF0) in bits 0-7, all other bits set to 1 FAT[1] = End of Chain marker (typically all bits set, but values with none of the low order 4 bits set are also valid) Each allocated entry of the File Allocation Table is a next cluster pointer End of Chain marker used to tell when a file/directory ends Non-allocated (and non-reserved) clusters contain 0
Resources Wikipedia (yes, I will tell you to look at Wikipedia here) https://en.wikipedia.org/wiki/File_Allocation_Table https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system Microsoft s FAT32 Specification http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9- 843a-923143f3456c/fatgen103.doc Other Microsoft Articles https://support.microsoft.com/EN-US/help/100108 https://technet.microsoft.com/en-us/library/cc938438.aspx