The FAT Filesystem

The FAT Filesystem

UMBC CMSC 421 Spring 2017 The FAT 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 MSDOS 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 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 nonLFN-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) Microsofts FAT32 Specification http:// c9-843a-923143f3456c/fatgen103.doc Other Microsoft Articles

Recently Viewed Presentations

  • English 121 - Typepad

    English 121 - Typepad

    English 111 Sadlier-Oxford Vocabulary, Unit 2 Hannah Burwell iRespond Question Master A.) Response A B.) Response B C.) Response C D.) Response D E.) Response E Percent Complete 100% 00:30 iRespond Question Master A.) Response A B.) Response B C.)...
  • Hands-On Hands-On Training: Training: Tips Tips and and

    Hands-On Hands-On Training: Training: Tips Tips and and

    Try to avoid tricky questions that trap people. These tend to embarrass others, and they usually don't help people learn the subject. In fact, trick questions usually end up making the instructor—not the trainee—look foolish.
  • here2 - CEFOR

    here2 - CEFOR

    Catcher Area Schematic. The Catcher Development comprises of 3 subsea manifolds, one located on each of the fields that form part of the initial development (Catcher, Burgman and Varadero), all with multi-phase metering which are tied back to the FPSO.
  • Projection -

    Projection -

    IFT3355: Infographie Projections © Pierre Poulin, Derek Nowrouzezahrai Dép. I.R.O. Université de Montréal


    FALL ROUND HIGHLIGHTS. Applications are due Thursday, September 22, 2016 by 4:00 pm CDT. Funding announcements by November 30, 2016. Contract term is January 1, 2017 through December 31, 2019.
  • POWERPOINT JEOPARDY - Gratitude Unit Plan

    POWERPOINT JEOPARDY - Gratitude Unit Plan

    Bible Verses - 10 points James 1:17 "Every good and perfect gift is from above, coming down from the Father of the heavenly lights, who does not change like shifting shadows." Bible Verses - 20 points 1 Thessalonians 5:18 "Be...
  • Digital Flip-Flops 2 - godinweb

    Digital Flip-Flops 2 - godinweb

    Control S R Q Q S R Flip Flops 2.* Transparent SR Latch The Transparent SR Latch is also known as: Gated SR Latch Enabled SR Latch The Control (Enable) input of the Transparent SR Latch Controls when the SR...
  • Research Executive Agency IRSES Marie Curie Actions IRSES

    Research Executive Agency IRSES Marie Curie Actions IRSES

    Research Executive Agency IRSES Marie Curie Actions Objectives Attract/retain numerous, well-trained, motivated researchers in Europe Continuity of FP6, with focus on structuring impact Development of adequate and broad skills for both the private and public sector; increased private sector participation...