• No results found

Main Points. File layout Directory layout

N/A
N/A
Protected

Academic year: 2021

Share "Main Points. File layout Directory layout"

Copied!
35
0
0

Loading.... (view fulltext now)

Full text

(1)
(2)

Main Points

• File layout

(3)

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

(4)

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?

(5)

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

(6)

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 Bitmap

(fixed location)

Bitmap (file) Locality defragmentation Block groups

+ reserve space

Extents Best fit

(7)
(8)

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

(9)
(10)

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

(11)

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.

(12)

• Massima dimensione del File System per diverse ampiezze dei blocchi

Limitazioni dei file systems FAT

(13)

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

(14)
(15)

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

(16)

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)

(17)

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)

(18)
(19)

FFS Asymmetric Tree

• Small files: shallow tree

– Efficient storage for small files

• Large files: deep tree

(20)

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

(21)
(22)
(23)
(24)
(25)

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

(26)

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

(27)
(28)
(29)
(30)
(31)
(32)
(33)
(34)

Directories

• Directories can be files

– Map file name to file number (MFT #, inode num)

• Table of file name -> file number

(35)

References

Related documents

TP B: Prove that when a transversal cuts two parallel lines, alternate interior and exterior angles are congruent.. TP C: Prove that the sum of the interior angles of a triangle

• Also stores the metadata information and edit log on disk (fsimage, but location of all blocks for a file is not stored in fsimage).. NameNode

A key idea of this paper is that, given that it depends on the context and clustering aim what a “good” clustering is, researchers need to characterize what kind of clusters

» Includes the data that associates a name with a metadata entry » fls: list file names in a given directory. » ffind: list which file name corresponds to a given metadata

u inodes for files allocated in same cylinder as file data blocks. Free

Η όλη διαδικασία με τη χρήση λογισμικού θα πρέπει να ακολουθεί ένα κύκλο μάθησης, σύμφωνα με τον Mayes (2000), και να περιλαμβάνει: ¾ Τις αρχικές

 Name Node : Keeps the metadata of all files/blocks in the file system, and tracks where across the cluster the file data is kept.  Data Node : DataNode actually stores data

•  The blocking factor for a file is the (average) number of file records stored in a disk block. •  The physical disk blocks that are allocated to hold the records of a file