CS703 Advanced
Operating Systems
By Mr. Farhan Zaidi
Lecture No.
34
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.
Logging
Idea: lets keep track of what operations are in progress
and use this for recovery. It’s keep a “log” of all operations,
upon a crash we can scan through the log and find
problem areas that need fixing.
Implementation
Add log area to disk.
File system
Log
Always write changes to log first – called write-ahead logging or
journaling.
Then write the changes to the file system.
All reads go to the file system.
Crash recovery – read log and correct any inconsistencies in the
file system.
Issue Log management
Observation: Log only needed for crash recovery
Checkpoint operation – make in-memory copy of file system (file
cache) consistent with disk.
After a checkpoint, can truncate log and start again.
Most logging file systems only log metadata (file descriptors and
directories) and not file data to keep log size down.
Issue Performance
Two disk writes (on different parts of the disk) for every change?
Synchronous writes are on every file system change?
Observation: Log writes are sequential on disk so even
synchronous writes can be fast.
Best performance if log on separate disk.
Current trend is towards logging FS
Fast recovery: recovery time O(active operations) and not O(disk
size)
Better performance if changes need to be reliable
If you need to do synchronous writes, sequential
synchronous writes are much faster than non-sequential
ones.
Examples:
Windows NTFS
Veritas on Sun
Many competing logging file system for Linux
Linux Virtual File System
Uniform file system interface to user processes
Represents any conceivable file system’s general
feature and behavior
Assumes files are objects that share basic properties
regardless of the target file system
Primary Objects in VFS
Superblock object
Inode object
Represents a specific file
Dentry object
Represents a specific mounted file system
Represents a specific directory entry
File object
Represents an open file associated with a
process
The Sun Network File System (NFS)
An implementation and a specification of a software system
for accessing remote files across LANs (or WANs).
The implementation is part of the Solaris and SunOS
operating systems running on Sun workstations using an
unreliable datagram protocol (UDP/IP protocol and Ethernet.
Schematic View of NFS Architecture