1 The FAT File System A Walk Through Experiment Jerry Breecher November, 2008.

Slides:



Advertisements
Similar presentations
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
Advertisements

Chapter 1 Image Slides Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1. HDD Partition Setup Insert Booting Diskette to A: drive and turn on the power. Then it will be boot by floppy diskette. 1 Type FDISK and press Enter.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Addition Facts
Chapter 6 File Systems 6.1 Files 6.2 Directories
1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
Break Time Remaining 10:00.
SE-292 High Performance Computing
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
File and Disk Maintenance
J.Tiberghien Chapitre 9 Organisation des disques et gestion des fichiers.
4.1 © 2004 Pearson Education, Inc. Exam Managing and Maintaining a Microsoft® Windows® Server 2003 Environment Lesson 4: Organizing a Disk for Data.
File Management.
Databasteknik Databaser och bioinformatik Data structures and Indexing (II) Fang Wei-Kleiner.
Network, Local, and Portable Storage Media Computer Literacy for Education Majors.
Project 5: Virtual Memory
Page Replacement Algorithms
Chapter 3.3 : OS Policies for Virtual Memory
Chapter 6 File Systems 6.1 Files 6.2 Directories
The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Squares and Square Root WALK. Solve each problem REVIEW:
COMP091 – Operating Systems 1
© 2012 National Heart Foundation of Australia. Slide 2.
Operating Systems File Management.
Addition 1’s to 20.
25 seconds left…...
Week 1.
We will resume in: 25 Minutes.
SE-292 High Performance Computing Memory Hierarchy R. Govindarajan
Clock will move after 1 minute
Chapter 14: Disk Fundamentals. 2 Disk Storage Systems Tracks, Cylinders, and Sectors Disk Partitions (Volumes)
FAT Concepts and Analysis
Chapter 4 : File Systems What is a file system?
Drives, Directories and Files. A computer file is a block of arbitrary information, or resource for storing information. Computer files can be considered.
In this assignment you are going to read floppy disk. You can run ‘mdir’ Unix function to see what output your program should give. FAT-12 MS-DOS file.
The FAT File System CSC 414. Objectives  Understand the structure and components of the FAT (12/16/32) File Systems  Understand what happens when a.
Lecture 10: The FAT, VFAT, and NTFS Filesystems 6/17/2003 CSCE 590 Summer 2003.
Ceng Operating Systems
Implementing Hard Drives Chapter 10
1 Partitioning a Hard Drive ©Richard Goldman Revised January 8, 2001 Revised December 9, 2002.
Lecture 9: The FAT and VFAT Filesystems 6/16/2003 CSCE 590 Summer 2003.
Bits, Bytes, Files, Hard Drives. Bits, Bytes, Letters and Words ● Bit – single piece of information ● Either a 0 or a 1 ● Byte – 8 bits of information.
File System Management File system management encompasses the provision of a way to store your data in a computer, as well as a way for you to find and.
Windows NTFS Introduction to Operating Systems: Module 15.
The disk surface is divided into tracks. into tracks. 1.
Chapter 3 Partitioning Drives using NTFS and FAT32 Prepared by: Khurram N. Shamsi.
The Functions of Operating Systems Desktop PC Operating Systems.
File Storage Organization The majority of space on a device is reserved for the storage of files. When files are created and modified physical blocks are.
1 Floppy Drive Formatting ©Richard Goldman February, 2001.
Lecture 18 Windows – NT File System (NTFS)
OPERATING SYSTEMS Frans Sanen.  Analyze a FAT file system manually  FAT12 first and simplest version  Still used on smaller disks (e.g. floppies) 
FAT File Allocation Table
Lecture 10 Page 1 CS 111 Summer 2013 File Systems Control Structures A file is a named collection of information Primary roles of file system: – To store.
BOOT SECTOR, RDE AND FAT ANALYSIS AND STUDY. FLOPPY CONSTRUCTION 1.Write - Protect Notch. 2.Hub. 3.Shutter. 4.Outer Jacket. 5.Protective Woolen Film.
Digital Forensics Dr. Bhavani Thuraisingham The University of Texas at Dallas Lecture #8 File Systems September 22, 2008.
Chapter 8 File Systems FAT 12/16/32. Defragmentation Defrag a hard drive – Control Panel  System and Security  Administration tools  Defrag hard drive.
BITS Pilani Pilani Campus Pawan Sharma Lecture ES C263 INSTR/CS/EEE F241 Microprocessor Programming and Interfacing.
UMBC CMSC 421 Spring 2017 The FAT Filesystem.
File System Structure How do I organize a disk into a file system?
A “Walk Through” Experiment
Windows XP File Systems
Partitioning a Hard Drive
Modern PC operating systems
Disk Structure Analysis
FAT File System.
Chapter 5 File Systems -Compiled for MCA, PU
Presentation transcript:

1 The FAT File System A Walk Through Experiment Jerry Breecher November, 2008

2 The FAT File System Why would anyone care about FAT today? Because its something we can easily understand. Its easy to walk our way around a floppy disk and see everything we need to see. Has great educational value. It embodies all the aspects of any other file system: Booting mechanism Sector Allocation mechanism File definition mechanism –holds all the properties of a file you need to know; name, dates, permissions.

3 The FAT File System File Allocation Table (FAT) is a file system developed by Microsoft for MS- DOS and was the primary file system for consumer versions of Microsoft Windows up to and including Windows Me. The FAT file system is relatively uncomplicated, and is supported by virtually all existing operating systems for personal computers. This ubiquity makes it an ideal format for floppy disks and solid-state memory cards, and a convenient way of sharing data between disparate operating systems installed on the same computer (a dual boot environment). The most common implementations have a serious drawback in that when files are deleted and new files written to the media, directory fragments tend to become scattered over the entire media, making reading and writing a slow process. Defragmentation is one solution to this, but is often a lengthy process in itself and has to be performed regularly to keep the FAT file system clean.

4 The FAT File System There are 3 versions of FAT: FAT-12, FAT-16, and FAT-32. These numbers refer to the number of bits available to define clusters. The floppy disk were looking at uses FAT-12, and so is limited to 2 12 or approximately 4096 clusters. (In fact, the number is less than this, since 000h and 001h are not used and FF0h to FFFh are reserved or used for other purposes, leaving 002h to FEFh (2 to 4079) as the range of possible clusters. ) A cluster is made up of 4 sectors (the minimum size that can be allocated.) A sector is 512 bytes a Cluster is 2048 bytes. So Fat-12 has a maximum of 4078 clusters * 2048 bytes/cluster = 8 Megabytes A normal 1.4 Mbyte PC floppy disk has 80 tracks, containing 18 sectors, and may hold 720 Kbytes of data on each side (80 x 18 x 512 bytes). Heres the TRUTH about our disk structure. Since its only necessary to support 1.4 Megabytes, this disk seems to have a cluster = 1 Sector.

5 The FAT File System For this exercise, a number of files have been placed on a Floppy Disk and then the structure of the floppy was examined using BPSofts Hexworkshop ( ) disk editor (they have a nice trial version you might want to use.) I have downloaded the output of Hexworkshop running on the floppy and included it as part of this package. On the next few pages, you can see the files that were created. We will be able to examine the structure of the disk and answer the following questions: 1.The boot sector. How does an OS start up a disk? 2.Directories – we have here a root directory ( A:\ ) and also a sub directory (A_Dir.) 3.Within a Directory, how are filenames laid out? 4.How does FAT manages files containing one cluster and many clusters? 5.How does FAT manage short and long filenames? 6.What does the FAT look like? 7.What do the contents of a file look like?

6 Directory Structure Here are the contents of this disk: A_Dir FileInSubdir File1 File2 ThisIsAFileWithAVeryLongName The following structure was added to the floppy. This must be done very carefully since Windows has a way of keeping many temporary files around and the names of these files, even if deleted would mess up our simple picture.

7 Disk Structure Heres the overall structure of the disk. Note that all addresses are given in both Decimal and Hexadecimal. Generally well use Hex along the way here. Sector Number Sector Number (Hex) What it does Boot Track00contains information about the disk, plus code thats run by the BIOS when the disk is started up. 1 st File Allocation Table (FAT) Information on what clusters are allocated on the disk. 2nd File Allocation Table (FAT) Ax – 12xRedundant information on what clusters are allocated on the disk. Root Disk Directory X – 20XInformation about the characteristics of the directories and files. File / Directory Data Area X - B3FxThe contents of the files and Directories

8 Sector 000x Location# BytesMeaningValue 01EOS Boot Loader 01C2# Hidden Sectors0 01A2# Heads2 0182# Sectors / Track18 (12x) 0162# sectors/ FAT9 0151Media BytesF0: (floppy) 0132# logical sectors2880(0B40x) 0112# Root Dir entries224 (00E0x) 0101# FATS2 00E2# Boot Sectors1 00D1# Sectors/Cluster1 00B2# Bytes/Sector512 (0200x) 0038OEM Name IDMSDOS Jmp to loaderEB 3C 90

9 File Allocation Table Reminder – a FAT is a way of keeping track of what Sectors are in use. A FAT entry (3 nibbles) in general has one of three values: 1.A 0 – its unused and available. 2.A Pointer to the next Sector allocated for this file. 3.A FFF indicating the end of the pointer chain – this is the last sector allocated for this file. Sectors 1 – 9 contain the 1 st FAT. Sectors A – 12 contain the 2 nd FAT. These are redundant and should contain identical information.

10 File Allocation Table Sectors 1 – 9 contain the 1 st FAT. Sectors A – 12 contain the 2 nd FAT. These are redundant and should contain identical information. Here are the rules for FAT entries: 1.On floppies, each 12 bit number in the FAT records a cluster belonging to a particular file. 2.A 12 bit value means an entry can range from zero to 4096 ($FFF). This is where FAT-12 comes from. 3.If a FAT entry is zero, then the associated cluster is unused and available. 4.If an entry is 4081 to 4087 ($FF1 to $FF7), then the cluster is unusable due to a formatting error (usually a bad sector). 5.If the entry contains 4088 to 4095 ($FF8 to $FFF), then the cluster contains the end of a file and does not point to another. 12-bit entries can be hard to read; sorry about that.

11 Sector 001x A B C D E F F0 FF FF FF FF FF FF 6F A0 00 0B F0 FF FF 0F 00 F0 means its a floppy. FF FF Padding Cluster These files have a single sector Cluster 5: Aims at Cluster 6 Cluster 6: Aims at Cluster 7 Cluster 7: Aims at Cluster 8 Cluster 8: Aims at Cluster 9 Cluster 9: Aims at Cluster A Cluster A: Aims at Cluster B Cluster B: Last Sector (FFF) Cluster C: Last Sector (FFF)

12 Sector 00Ax This is the second FAT – identical to the first. Starting Cluster Contains (Points to)What does it hold? 2FFF ( one sector only)(021x) A_Dir -- Directory 3FFF ( one sector only)(022x) File in directory A_Dir 4FFF ( one sector only)(023x) File1 (single sector) A B FFF(024x-02Ax) Multisector file CFFF ( one sector only)(02Bx) File with long name

13 Directory Information AttributeOffsetNumber of bytes in field Filename08 Filename Extension83 File AttributesB1 reservedC10 Creation Time162 Creation Date182 Pointer to cluster in FAT1A2 File Length1C4 Directory Entries hold information about the files or directories that are in that directory. Below is the format for a directory entry. See the next page for additional information about many of these fields.

14 Directory Information AttributeOffsetNumber of bytes in field Filename08 Filename Extension83 File AttributesB1 reservedC10 Creation Time162 Creation Date182 Pointer to cluster in FAT 1A2 File Length1C4 First byte of filename: $00 – unused $E5 – file erased $2E – subdirectory file Attributes: bit 0 – read only bit 1 – hidden file bit 2 – system file bit 3 – volume label bit 4 – subdirectory bit 5 – archive bit bits 6, 7 -- unused Creation Time: bits 0 – 4 – seconds/2 (0 – 29) bits 5 – 10 – minutes ( 0 – 59) bits 11 – 15 – hours ( 0 – 23 ) Creation Date: bits 0 – 4 – date (1 – 31) bits 5 – 8 – month ( ) bits 9 – 15 – year since 1980

15 Sector 013x AttributeOffsetNumber of bytes in field Example Filename08File2 Filename Extension83--- File AttributesB120 reservedC10 Creation Time Creation Date Pointer to cluster in FAT1A25 File Length1C40D23 Root Directory

16 Sector 021x This contains the contents of the subdirectory, A_Dir. Note that the format of a file entry is the same as for the root directory.

17 Sector 022x This contains the contents of the file AFileInTheSubdirectory. Notice that its ALL data – no information about the file itself is kept in the data sectors. There is no reason for the OS to interpret this sector in any fashion.

18 Sector 023x This contains the contents of the file File1. Notice that its ALL data – no information about the file itself is kept in the data sectors. There is no reason for the OS to interpret this sector in any fashion.

19 Sector 024x This contains the contents of the file File2. This is a larger file and the data goes on for several sectors, from 024x to 02Ax.

20 Sector 02Ax

21 Sector 02Bx This contains the contents of the file ThisIsAFileWithALongFilename. As you can see, its a relatively small file containing 2Dx bytes.

22 Sector 02Cx This sector has been formatted with F6 but there is no data in it. Its ready to be allocated since its cluster location in the FAT has a 0 in it.