A file system is used to control how data is stored and retrieved.
A filesystem is the methods and data structures that an operating system uses to keep track of files on a disk or partition; that is, the way the files are organized on the disk.
A file allocation table (FAT) is a table that an operating system maintains on a hard disk that provides a map of the clusters (the basic units of logical storage on a hard disk) that a file has been stored in.
File Allocation Table (FAT) is a computer file system architecture and a family of industry-standard file systems utilizing it. The FAT file system is a legacy file system which is simple and robust.
Today, FAT file systems are still commonly found on floppy disks, USB sticks, flash and other solid-state memory cards and modules, and many portable and embedded devices.
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
File System and File allocation tables
1. File System &
File allocation table(FAT)
PREPARED BY:
DAVE SUSHILKUMAR A.
PABARI SHASHIKANT C.
PAMBHAR VISHAL G.
2. File System
The collection of algorithms and data structures
which perform the translation from logical file
operations (system calls) to actual physical
storage of information.
2
3. What Does a File System Do?
Responsibilities
Creating, manipulating, renaming, copying, and removing
files to and from a storage device
Organizing files into common storage units
Called directories
Keeping track of file and directory locations
Assisting users
Relate files and folders to the physical structure of the
storage medium
3
4. Files used by operating systems and applications
Word-processing documents
Source code for programs you have written
Music files
Movie files
Spreadsheets
Photos
Operating systems use a file folder icon to represent a
directory
4
5. Layered File System
Logical File System
Maintains file structure via FCB
(file control block)
File organization module
Translates logical block to
physical block
Basic File system
Converts physical block to disk
parameters (drive 1, cylinder 73,
track 2, sector 10 etc)
I/O Control
Transfers data between memory
and disk
5
6. Physical Disk Structure
Parameters to read from disk:
cylinder(=track) #
platter(=surface) #
sector #
transfer size
Tracks
Sectors
within a
Track
Cluster
6
7. File system Units
Sector – the smallest unit that can be accessed on
a disk (typically 512 bytes)
Block(or Cluster) – the smallest unit that can be
allocated to construct a file
What’s the actual size of 1 byte file on disk?
takes at least one cluster,
which may consist of 1~8 sectors,
thus 1byte file may require ~4KB disk space.
7
9. FCB – File Control Block
Contains file attributes + block locations
Permissions
Dates (create, access, write)
Owner, group, ACL (Access Control List)
File size
Location of file contents
UNIX File System I-node
FAT/FAT32 part of FAT (File Alloc. Table)
NTFS part of MFT (Master File Table)
9
10. File System Implementation
Contiguous allocation
Linked list allocation
Linked list allocation using an index (DOS file allocation table - FAT)
10
11. Contiguous Allocation
The file is stored as a contiguous block of data
allocated at file creation
(a) Contiguous allocation of disk space for 7 files
(b) State of the disk after files D and E have been removed
11
12. Contiguous Allocation (Cont.)
FAT (file allocation table) contains file name, start block, length
Advantages
Simple to implement (start block & length is enough to define a file)
Fast access as blocks follow each other
Disadvantages
Fragmentation
Re-allocation (compaction)
12
14. Linked List Allocation (Cont.)
Each block contains a pointer to the next block
FAT (file allocation table) contains file name, first block address
Advantages
Fragmentation is eliminated
Block size is not a power of 2 because of pointer space
Disadvantages
Random access is very slow as links have to be followed
14
15. Indexed Block Allocation
Indexed allocation
Each file has its own index block(s) of pointers to its data blocks
Logical view
index table
15
16. Indexed Allocation (Cont.)
Need index table
Random access
Dynamic access without external fragmentation, but have overhead of
index block
Mapping from logical to physical in a file of maximum size of 256K
bytes and block size of 512 bytes. We need only 1 block for index
table
Q = displacement into index table
R = displacement into block
LA/512
Q
R
16
17. Indexed Allocation – Mapping (Cont.)
Mapping from logical to physical in a file of unbounded length
(block size of 512 words)
Linked scheme – Link blocks of index table (no limit on size)
LA / (512 x 511)
Q1
R1
Q1 = block of index table
R1 is used as follows:
R1 / 512
Q2
R2
Q2 = displacement into block of index table
R2 displacement into block of file:
17
18. Indexed Allocation – Mapping (Cont.)
Two-level index (4K blocks could store 1,024 four-byte pointers in outer
index -> 1,048,567 data blocks and file size of up to 4GB)
LA / (512 x 512)
Q1
R1
Q1 = displacement into outer-index
R1 is used as follows:
R1 / 512
Q2
R2
Q2 = displacement into block of index table
R2 displacement into block of file:
18
19. File Allocation Table
FAT File System
• The File Allocation Table (FAT) file system is a simple file system originally designed for
small disks and simple folder structures.
• The FAT file system is named for its method of organization, the file allocation table,
which resides at the beginning of the volume.
• To protect the volume, two copies of the table are kept, in case one becomes damaged. In
addition, the file allocation tables and the root folder must be stored in a fixed location so
that the files needed to start the system can be correctly located.
• A volume formatted with the FAT file system is allocated into clusters.
• The default cluster size is determined by the size of the volume.
• For the FAT file system, the cluster number must fit in 16 bits and be a power of 2.
FAT File System
19
20. • The way FAT works is that it keeps a record at the start of the drive of all
the files, and to point to the files, it points to the clusters that contain the
files.
• The main rule of clusters is that there cannot be more than 1 file per
cluster; otherwise, pointing to that cluster would cause problems, as it
would be pointing and doing read/write operations on two files at once,
which would cause Windows to crash.
• Depending on the size and FAT version of the partition, the cluster size
can vary.
• Also keep in mind that a section of the partition is reserved for the FAT,
which is the record of each file and where it can be found. This changes
in size depending on the size of the partition and clusters.
How FAT Works
The FAT Family
FAT12, FAT16, FAT32
12, 16, and 32 are the number of bits
used in the FAT for cluster addresses
20
21. FAT32 is a derivative of the File Allocation Table (FAT)
file system that supports drives with over 2GB of storage.
Because FAT32 drives can contain more than 65,526
clusters, smaller clusters are used than on large FAT16
drives. This method results in more efficient space
allocation on the FAT32 drive.
The largest possible file for a FAT32 drive is 4GB minus
2 bytes.
The FAT32 file system includes four bytes per cluster
within the file allocation table. Note that the high 4 bits of
the 32-bit values in the FAT32 file allocation table are
reserved and are not part of the cluster number.
FAT32 File System 21
22. Creating a FAT File System
High-level formatting creates file system data structures
Boot sector
Cluster allocation
File Allocation Table (FAT)
$Bitmap in the Master File Table (MFT) for NTFS
Exact details depend on operating system
Root Directory
22
23. Each FAT type has its limits; this table displays these limits:
FAT type Max Clusters Cluster sizes Max volume size
FAT12 4,086 0.5 to 4KB
16,736,256 bytes
(16MB)
FAT16 65,526 2KB to 32KB
2,147,483,648 bytes
(2GB)
FAT32 268,435,456 4KB to 32KB
8,796,093,022,208 bytes
(8TB)
FAT Limitations 23
24. Deleted File Recovery
All Cluster Pointers in the FAT are gone!
Option 1
Grab the next n-1 consecutive clusters.
Call it the file.
May have allocated or unallocated
clusters from other files.
WinHex uses this option.
Option 2
Grab the next n-1 unallocated clusters
using the FAT.
Call it the file.
May have unallocated clusters from
other deleted files.
EnCase uses this option.
• Get the first cluster from the directory entry
• Get size from directory entry
• Calculate the number of clusters allocated
to the file, n.
24