8 Implement File System
8 Implement File System
File-System Structure
File-System Implementation
Directory Implementation
Allocation Methods
Free-Space Management
Efficiency and Performance
Recovery
Log-Structured File Systems
NFS
Example: WAFL File System
File structure
Logical storage unit
Collection of related information
File system resides on secondary storage (disks)
File system organized into layers
File control block – storage structure consisting of information
about a file
VFS allows the same system call interface (the API) to be used for
different types of file systems.
The API is to the VFS interface, rather than any specific type of file
system.
Contiguous allocation
Linked allocation
Indexed allocation
Random access
Many newer file systems (I.e. Veritas File System) use a modified
contiguous allocation scheme
index table
outer-index
can use sharding (actually not faster, because parallel but must still
read very big data) and mem-cache (to reduce I/O on disk)
0 block[i] free
bit[i] =
1 block[i] occupied
Need to protect:
Pointer to free list
Bit map
Must be kept on disk
Allocate block[i]
Set bit[i] = 1 in memory
0000
0001
Name Property Start
0002 3 File 1 … 2
0003 4 File 2 … 5
0004 EOF File 3 … 7 2 3 4
0005 6
0006 8 File1 File1 File1
0007 EOF
0008 EOF 5 6 7
0009 0000
… Cluster File2 File2 File3
◼ FAT12: 32MB 8 9 10
◼ FAT16: 4GB File2 empty empty
◼ FAT32: 8TB
26
Operating System Principles 11.26 Silberschatz, Galvin and Gagne ©2005
Boot sector
…
Entry 32 bytes
…
Entry ext 2
Entry ext 1
Entry
Entry
…
29
Operating System Principles 11.29 Silberschatz, Galvin and Gagne ©2005
Entry ext
30
Operating System Principles 11.30 Silberschatz, Galvin and Gagne ©2005
NTFS (New Technology File System)
16 exabytes
(16 billion GB)
Standard Security
information Filename descriptor Data 31
Operating System Principles 11.31 Silberschatz, Galvin and Gagne ©2005
Unix /Linux file system
I-node
◼ Single indirect:
256KB
◼ Double indirect:
256*256 = 65 MB
◼ Triple indirect:
256*256*256 =
16GB
32
Operating System Principles 11.32 Silberschatz, Galvin and Gagne ©2005
UNIX V7 file system
33
Operating System Principles 11.33 Silberschatz, Galvin and Gagne ©2005
End of Chapter 11