Title: Lecture 9: The FAT and VFAT Filesystems
1Lecture 9 The FAT and VFAT Filesystems
- 6/16/2003
- CSCE 590
- Summer 2003
2Disk Drive Review
- Disks or platters of magnetic material
- Can be one or two sided
- Rated to hold a certain amount of magnetic charge
- Motor to spin the disks
- Set of read/write/erase heads
- Read/write heads sandwiched between two erase
heads - Actuator (stepper motor) to position heads
- Interface (circuitry) to transfer data to and
from disk
3Disk Drivehttp//www.ntfs.com/hard-disk-basics.ht
m
4Low Level Formatting
- Setting down a series of concentric circles
(tracks) on each disk - Division of tracks into wedge shaped sectors
- A sector holds 512 bytes
- Smallest physical storage unit on disk
- Sectors are numbered starting with 1
- Numbers of tracks and sectors is standardized
5Tracks
- 1024 tracks on a side of a platter in a hard disk
- 80 tracks per side on a 3.5 HD floppy
- Outside track is numbered 0
- Old days innermost track is numbered 1023 (BIOS
limitation) - Large Block Addressing (LBA) tricks the BIOS into
handling bigger, more complicated modern disks - In a stack of platters, the nth track on each
side of each platter makes up the nth cylinder - When all heads are in the same position on the
disk - Older disk drives would identify a sector by
cylinder/head/sector notation
6Sectors
- Outside of disk spins faster than inside.
- Old days, fixed number of sectors on a track (63)
- Data density increased towards the center of the
disk - Now, use zoned-bit recording where there are more
sectors towards the outside of the disk - The raw data transfer rate is greater on the
outside tracks or zones, and we write to the
outside (0th) track first, so drive appears to
get slower as it ages! - Why modern hard drives are low level formatted at
the factory
7Sectorshttp//www.pctechguide.com/04disks.htm
Any sector can be referenced by its platter
number, side number (0 or 1), track and sector
numbers
8Starting and Ending Head, Sector and Cylinder
- Maximum Formatted Capacity (sector size) x
(sectors per track) x (cylinders) x (heads) - Ranges of values
- Head fields (1 byte) range 0 to 28 1 256
values - Sector fields (6 bits) range 0 to 26 1 64
values - Cylinder fileds (10 bits) range 0 to 210 1
1024 values - Maximum Formatted Capacity
- (sector size) x (sectors per track) x
(cylinders) x (heads) - 512 x 64 x 1024 x 256
- 29 x 26 x 210 x 28
- 233
- 23 x 230
- 8,455,716,864 7.8 GB
9High Level Formatting
- Placing a series of tables, data structures, and
code into the first few sectors of the disk - Master Boot Record (MBR)
- In very first sector (cylinder 0, head 0, sector
1) - Contains master partition table
- And boot code
10Master Boot Record
- Processor always starts executing at the same
place on boot - BIOS loads initial boot program from MBR that
starts the process of loading the operating
system - Boot program checks the Partition Table and
identifies system partition - Loads the systems Partition Boot Sector into
memory and transfer control to the executable
code in the Partition Boot Sector
11Partition Table
- Each entry 16 bytes long
- Maximum four entries
- Boot Indicator field for x-86 based computers
- RISC computers use the NVRAM contains info on
where to boot - System ID Field describes the type of file
system used to format the volume
12Partition Table Format
13Extended Partitions
- Used when there are more than four partitions
- Not used for bootable/system partitions
- Can create any number of logical volumes in an
extended partition - The entry in the Partition Table for an extended
partition points to the first sector of the
extended partition, which is another Partition
Table
14Extended Partition Table
- Entries contain
- Current logical drive
- Info about the next logical drive
- Entries three and four are all zeroes
- Each logical drive has its own Partition Table
that points to the next logical drive
15File Allocation Table (FAT)
- The FAT file System is a simple file system.
- The File Allocation Table resides at the start of
the volume - Duplicate copy maintained for recovery
- In the FAT file system space is allocated in
clusters. - The size of the default cluster is determined by
the size of the volume - The cluster number must fit in 16 bits and be a
power of 2.
16Differences Between FAT Systems
17FAT Partition Boot Sector
- The Partition Boot Sector contains information to
access the volume - Fields in Partition Boot Sector
18BIOS Parameter Block and Extended Parameter Block
Fields
- Contains specific information about the volume,
such as - Bytes per sector.
- Sectors per cluster
- Number of reserved sectors before the first FAT
- Number of FATs.
- Number of root directory entries (max limit)
19File Allocation System
- Uses a File Allocation Table to to organize the
file system and keep track of cluster usage - Two copies of the FAT are kept (in older versions
of FAT, adjacent to each other, in the same
cluster) - Files are given first available cluster in the
partition - Also uses folders to indicate where in the FAT
the info for a file may be
20File Allocation Table Information
- Information on clusters
- Unused 0x0000 (free)
- Cluster in use by a file
- Bad cluster (0xFFF7)
- Last cluster in a file (0xFFF8-0xFFFF)
- If a file consists of multiple clusters then the
end of the first cluster contains a link to the
next cluster in the file. - Example http//www.ntfs.com/fat-allocation.htm
21FAT Root Folder
- Root folder contains each entry for each file and
folder on the root - At a fixed location
- Fixed size 512 entries for a hard disk
- Other folders contain similar entries but can be
anywhere on the disk and have unlimited
(relatively) entries
22FAT Folder Structure
- Folder entries include
- Name (83 characters)
- Attribute byte
- Creation time
- Creation date
- Last access date
- Last modified time
- Last modified date
- Starting cluster number in the file allocation
table (16 bits)
23FAT Filenames
- Old 83 names, eight bits for the name, three
bits for the extension
24VFAT
- Longer names are supported but backward FAT
compatibility is maintained in VFAT - Example of conversion and storage
- The quick brown.fox 15 extension
- THEQUI1.FOX made up name
- Unicode ? 2 bytes for each character in the long
name - Windows sets volume, read-only, system, and
hidden attributes on log filename entries to get
backwards compatible to ignore these fields
25VFAT Long Filename Storage
26