0% found this document useful (0 votes)
53 views35 pages

SOCap 12

This document discusses different approaches to file system design, including index structures, block allocation strategies, and metadata organization. It describes the key features and tradeoffs of common file systems like FAT, FFS, and NTFS. FAT uses a simple linked list index structure but can result in fragmentation over time. FFS introduces inodes and uses a tree structure with block groups to improve locality for both small and large files. NTFS further enhances this with flexible metadata extents and optional hints for file size. Directories can be stored as regular files or use B-trees for faster lookup in large directories.

Uploaded by

Lachanos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views35 pages

SOCap 12

This document discusses different approaches to file system design, including index structures, block allocation strategies, and metadata organization. It describes the key features and tradeoffs of common file systems like FAT, FFS, and NTFS. FAT uses a simple linked list index structure but can result in fragmentation over time. FFS introduces inodes and uses a tree structure with block groups to improve locality for both small and large files. NTFS further enhances this with flexible metadata extents and optional hints for file size. Directories can be stored as regular files or use B-trees for faster lookup in large directories.

Uploaded by

Lachanos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

File Systems

Main Points
File layout
Directory layout

File System Design Constraints


For small files:
Small blocks for storage efficiency
Files used together should be stored together

For large files:


Contiguous allocation for sequential access
Efficient lookup for random access

May not know at file creation


Whether file will become small or large

File System Design


Data structures
Directories: file name -> file metadata
Store directories as files

File metadata: how to find file data blocks


Free map: list of free disk blocks

How do we organize these data structures?


Device has non-uniform performance

Design Challenges
Index structure
How do we locate the blocks of a file?

Index granularity
What block size do we use?

Free space
How do we find unused blocks on disk?

Locality
How do we preserve spatial locality?

Reliability
What if machine crashes in middle of a file system op?

File System Design Options


FAT

FFS

NTFS

Index
structure

Linked list

Tree
(fixed, assym)

Tree
(dynamic)

granularity

block

block

extent

free space
allocation

FAT array

Locality

Bitmap
(fixed
location)
defragmentation Block groups
+ reserve
space

Bitmap
(file)
Extents
Best fit
defrag

Named Data in a File System

Microsoft File Allocation Table (FAT)


Linked list index structure
Simple, easy to implement
Still widely used (e.g., thumb drives)

File table:
Linear map of all blocks on disk
Each file a linked list of blocks

FAT

FAT
Pros:
Easy to find free block
Easy to append to a file
Easy to delete a file
Cons:
FAT size
Should be uploaded in main memory
Limitation to file system size

Limited metadata and no protection


Fragmentation
File blocks for a given file may be scattered
Files in the same directory may be scattered
Problem becomes worse as disk fills

Limitazioni dei file systems FAT


Posto:
- L lunghezza (in bit) degli elementi della FAT
- B la lunghezza (in byte) dei blocchi del disco,
il numero di blocchi indirizzabili 2L (= capacit del disco, o partizione)
--> la massima estensione del file system 2L blocchi, ovvero a B* 2L byte.
se ogni elemento occupa N byte (solitamente L multipla del byte), la FAT occupa
complessivamente N*2L byte
Esempio: con N=2 (--> FAT 16): B= 210:
La massima estensione del file system 216 blocchi, ovvero 226 byte (= 64 Mbyte)
la FAT occupa complessivamente 2* 216 byte= 128 Kbyte
con una memoria paginata e pagine di 1Kbyte, la FAT occupa 128 pagine
dato che gli elementi che descrivono un file possono essere distribuiti su molte pagine
diverse, possono verificarsi frequenti errori di pagina quando si percorre un file.

--> Per realizzare file systems pi estesi: gli elementi della FAT indirizzano blocchi logici,
multipli del blocco fisico del disco.

Limitazioni dei file systems FAT

Massima dimensione del File System per diverse ampiezze dei blocchi

Berkeley UNIX FFS (Fast File System)


inode table
Analogous to FAT table

inode
Metadata
File owner, access permissions, access times,

Set of 12 data pointers


With 4KB blocks => max size of 48KB files

Physical disk organization in UNIX

FFS inode
Metadata
File owner, access permissions, access times,

Set of 12 data pointers


With 4KB blocks => max size of 48KB files

Indirect block pointer


pointer to disk block of data pointers

Indirect block: 1K data blocks => 4MB (+48KB)

FFS inode
Metadata
File owner, access permissions, access times,

Set of 12 data pointers


With 4KB blocks => max size of 48KB

Indirect block pointer


pointer to disk block of data pointers
4KB block size => 1K data blocks => 4MB

Doubly indirect block pointer


Doubly indirect block => 1K indirect blocks
4GB (+ 4MB + 48KB)

FFS inode
Metadata
File owner, access permissions, access times,

Set of 12 data pointers


With 4KB blocks => max size of 48KB

Indirect block pointer


pointer to disk block of data pointers
4KB block size => 1K data blocks => 4MB

Doubly indirect block pointer


Doubly indirect block => 1K indirect blocks
4GB (+ 4MB + 48KB)

Triply indirect block pointer


Triply indirect block => 1K doubly indirect blocks
4TB (+ 4GB + 4MB + 48KB)

FFS Asymmetric Tree


Small files: shallow tree
Efficient storage for small files

Large files: deep tree


Efficient lookup for random access in large files

FFS Locality
Block group allocation
Block group is a set of nearby cylinders
Files in same directory located in same group
Subdirectories located in different block groups

inode table spread throughout disk


inodes, bitmap near file blocks

First fit allocation


Small files fragmented, large files contiguous

FFS First Fit Block Allocation

FFS First Fit Block Allocation

FFS First Fit Block Allocation

FFS
Pros
Efficient storage for both small and large files
Locality for both small and large files
Locality for metadata and data

Cons
Inefficient for tiny files (a 1 byte file requires both an
inode and a data block)
Inefficient encoding when file is mostly contiguous on
disk (no equivalent to superpages)
Need to reserve 10-20% of free space to prevent
fragmentation

NTFS
Master File Table
Flexible 1KB storage for metadata and data

Extents
Block pointers cover runs of blocks
Similar approach in linux (ext4)
File create can provide hint as to size of file

Journalling for reliability


Will not be discussed

NTFS Small File

NTFS Medium File

NTFS Indirect Block

NTFS Multiple Indirect Blocks

Named Data in a File System

Directories

Directories
Directories can be files
Map file name to file number (MFT #, inode num)

Table of file name -> file number


Small directories: linear search

Large Directories: B-Trees

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy