File System Implementation
· Boot
control block contains info needed by
system to boot OS from that volume
· Volume
control block contains volume details
· Directory
structure organizes the files
· Per-file
File Control Block (FCB) contains many details about the file
A Typical File Control Block

File Blocks Allocation
Methods
An
allocation method refers to how disk blocks are allocated for files:
1. Contiguous allocation
2. Linked allocation
3. Indexed allocation
1. Contiguous
Allocation

2. Linked Allocation

3. Indexed Allocation

UNIX File system

Free Space Management
Bit
vector of (n blocks):
Bit
[ i ] = 0 means block i is occupied
Bit
[ i ] = 1 means block i is free.
First
Free block: the position of the first 1
bit:
Is
Calculated as follows: (number of 0-valued words) * (number of bits per
word) + offset of first 1 bit.

Linked list (free list)
§
Cannot get contiguous space
easily
§
No waste of space
Recovery
· Use system programs to back up data from disk to
another storage device
(magnetic tape, other
magnetic disk, optical)
· Recover lost file or disk by restoring data from
backup
Log Structured File Systems
·
Log structured (or
journaling) file systems: Record each update to the file system as a transaction
·
All transactions are written to a log
A transaction is considered committed once it is
written to the log.
However, the file system may not yet be updated.
·
The transactions in the log
are asynchronously written to the
file system
When the file system is modified, the transaction is
removed from the log.
The Sun Network File System (NFS)
· Interconnected workstations viewed as a set of
independent machines with independent file systems, which allows sharing among these file systems in a
transparent manner
· A remote directory is mounted over a local file system directory.
The mounted directory looks like an integral subtree of the local file system, replacing the subtree descending from the local directory. Files in the
remote directory can then be accessed in a transparent manner.
· Subject to access-rights
accreditation, potentially any file system (or directory within a file system),
can be mounted remotely on top of any local directory
· NFS is designed to operate in a heterogeneous environment of different machines, operating systems,
and network architectures; the NFS specifications independent of these media.
This independence is achieved through the use of RPC primitives built on top of an External Data Representation (XDR) protocol used between two
implementation-independent interfaces
Three Independent
File Systems

Mounting in NFS

NFS Protocol
· Provides a set of remote
procedure calls for remote file operations.
The procedures support the
following operations:
ü searching for a file within
a directory
ü reading a set of directory
entries
ü manipulating links and
directories
ü accessing file attributes
ü reading and writing files
· NFS servers are stateless;
each request has to provide a full set of arguments
· Modified data must be
committed to the server’s disk before results are returned to the client.
· The NFS protocol does not
provide concurrency-control mechanisms
Schematic View of NFS Architecture
