🎓 BookMCQ
← Back to 12. File System Implementation

📝 Log structured file systems and Recovery (12 MCQs)

Appending File-System Changes to a Sequential Log

A log-structured file system records modifications by writing new or updated information sequentially into a log-like storage structure. Instead of frequently overwriting data in its existing location, it appends updated blocks and metadata. The current filesystem state is represented through metadata references to the latest valid versions. This design can improve write performance and simplify recovery after interrupted operations.

Why Sequential Updates Can Improve Storage Writes

Random updates to metadata and file blocks can cause substantial seek movement on magnetic disks. A log-structured design collects changes and writes them in larger sequential transfers. It also avoids immediately overwriting existing information, allowing recovery mechanisms to identify a consistent earlier state. However, obsolete versions accumulate and require cleaning before their storage segments can be reused.

Appending Segments and Updating Metadata References

The file system collects modified data and metadata into a buffer or segment. It writes the segment to available log space and updates structures identifying the newest versions. Checkpoints record recoverable filesystem states. During recovery, the system uses valid checkpoints and subsequent log records to reconstruct metadata references and determine which updates were committed.

Recovering After an Interrupted Segment Write

Suppose a file-system segment contains updated data blocks and metadata references. A power failure interrupts the following update. On restart, the system examines its latest valid checkpoint and subsequent complete log records. It reconstructs the filesystem using committed information, ignoring incomplete or invalid records according to its recovery protocol.

Sequential Write Performance and Cleaning Costs

Log-structured file systems can provide efficient sequential writes and rapid recovery through checkpoints and recorded updates. Their limitations include cleaning overhead, segment fragmentation, and additional storage traffic when live data must be copied during cleaning. Performance depends on how much obsolete data exists and how efficiently the system identifies and relocates remaining valid information.

Clarifying Logs and Permanent File Versions

'Every historical file version remains permanently available' is incorrect because obsolete log records can be reclaimed. 'A log-structured filesystem writes only metadata' is incorrect because file data may also be appended. 'Recovery always requires scanning the entire disk' is incorrect because checkpoints and recorded summaries can reduce the required recovery work.

Exam Focus: Checkpoints, Segments and Crash Recovery

Explain how file updates are appended to log segments and how checkpoints record consistent filesystem states. Trace recovery following an interrupted write. Identify why obsolete records require segment cleaning. Compare log-structured designs with conventional in-place updates and explain how sequential writing influences performance and recovery behaviour.

Key Terms of Log-Structured File Systems

  • Log-structured filesystem - Appends filesystem updates.
  • Segment - Unit of sequential log storage.
  • Checkpoint - Records a recoverable state.
  • Segment cleaning - Reclaims obsolete log space.
  • Live data - Still-valid stored information.
  • Log record - Recorded filesystem update.
2
Easy
6
Medium
4
Hard

📝 All Log structured file systems and Recovery MCQs

Q1. What does the acronym FAT stand for in file system terminology?

A.File Allocation Table ✅
B.Fast Access Table
C.File Access Tree
D.Fixed Allocation Technique
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The correct answer is File Allocation Table because FAT is the traditional structure that maps each file block to its location on disk. The other options describe unrelated concepts; Fast Access Table and Fixed Allocation Technique are not standard terms, and File Access Tree refers to a different data structure. Understanding this definition helps identify how FAT-based systems locate blocks, which is essential when comparing them to log-structured designs.

Q2. Why does indexed allocation improve direct access compared to linked allocation?

A.It stores all block pointers in a single index block ✅
B.It eliminates the need for a directory
C.It writes data sequentially
D.It caches the entire file in memory
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Indexed allocation keeps an array of pointers in one index block, so the system can jump directly to any block without traversing a chain. The other choices are incorrect: a directory is still required, sequential writing is unrelated to direct access, and caching the whole file is not a property of indexed allocation. This distinction clarifies why indexed allocation offers faster random reads.

Q3. A file consists of blocks 217, 618, and 339. Using a FAT that is not cached, how many disk‑head seeks are required in the worst case to read the entire file?

A.6 seeks ✅
B.3 seeks
C.4 seeks
D.5 seeks
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: In the worst case, the head must first move to the start of the volume to read the FAT entry for each block, then move to the block’s location. That is two seeks per block, and with three blocks the total is 2×3=62 \times 3 = 6 seeks. The other numbers underestimate the required movements, and the calculation demonstrates the impact of uncached FAT on performance.

Q4. When a log‑structured file system performs segment cleaning after many updates, which outcome is most likely?

A.Increased write throughput
B.Decreased read latency
C.Higher cleaning overhead ✅
D.Lower storage utilization
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Segment cleaning reclaims space by copying live data and discarding obsolete data, which consumes CPU and I/O resources, thus raising overhead. It does not directly boost write throughput or lower read latency, and storage utilization typically remains similar because cleaning aims to free space rather than waste it. Recognizing this side effect is crucial for evaluating the trade‑offs of log‑structured designs.

Q5. A system storing data on flash memory adopts a log‑structured file system. What primary benefit does this provide?

A.Reduces wear leveling
B.Improves random write performance ✅
C.Eliminates the need for garbage collection
D.Guarantees instant crash recovery
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Flash memory writes are faster when they are sequential, and a log‑structured approach writes data in a continuous log, turning random writes into sequential ones. This improves overall write performance. Wear leveling is handled separately, garbage collection is still required, and crash recovery depends on additional mechanisms. Understanding this benefit helps justify using log‑structured layouts on SSDs.

Q6. How does external fragmentation differ between contiguous allocation and indexed allocation?

A.Indexed allocation eliminates external fragmentation ✅
B.Contiguous allocation has no fragmentation
C.Both suffer equally
D.Indexed allocation creates more fragmentation
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Contiguous allocation can leave gaps between files, leading to external fragmentation, whereas indexed allocation stores pointers separately, allowing blocks to be placed anywhere without creating gaps, effectively eliminating external fragmentation. The other statements are false: contiguous allocation can fragment, both methods do not suffer equally, and indexed allocation does not increase fragmentation. This contrast highlights why indexed allocation is preferred for flexible storage.

Q7. When designing a file system for SSDs using a log‑structured approach, which choice most directly minimizes write amplification?

A.Use large segment size
B.Frequent checkpointing
C.Small block writes
D.Avoid cleaning by over‑provisioning ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: Over‑provisioning provides spare blocks that absorb writes, reducing the frequency and intensity of segment cleaning, which is the main source of write amplification. Large segments can increase the amount of data moved during cleaning, frequent checkpointing adds extra writes, and small block writes do not address the underlying copy‑on‑write cost. Hence, over‑provisioning is the key technique.

Q8. For a file of 100 blocks, which statement best describes random‑access time when comparing FAT‑based allocation to a log‑structured file system?

A.FAT provides faster random reads ✅
B.Log‑structured provides faster random reads
C.Both have equal random‑access time
D.Log‑structured is slower due to cleaning
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: FAT stores a table that maps each block directly, allowing the system to locate any block with a single lookup, which is quicker than scanning sequential log segments. While log‑structured systems excel at sequential writes, they may need to search through recent segments for a specific block, making random reads slower. The other options misrepresent the typical performance characteristics.

Q9. What is the segment cleaning overhead in a log‑structured file system?

A.Time spent merging live data with free space ✅
B.Cost of allocating new inodes
C.Overhead of updating directory entries
D.CPU usage for checksum verification
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Cleaning overhead refers to the resources required to identify live blocks within a segment, copy them to a new segment, and reclaim the freed space. This process consumes I/O bandwidth and CPU cycles. Allocating inodes, updating directories, or verifying checksums are separate operations and do not define segment cleaning overhead. Recognizing this cost is essential for performance tuning.

Q10. Why does a log‑structured file system favor sequential writes over random reads?

A.Sequential writes reduce seek time ✅
B.Random reads improve caching
C.Sequential writes increase fragmentation
D.Random reads reduce wear
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Sequential writes allow the disk head to continue moving in one direction, minimizing seeks and taking advantage of the underlying hardware’s optimal write pattern. Random reads require the head to jump frequently, incurring higher latency. The other statements either misstate the effect of reads on caching or incorrectly claim that sequential writes cause more fragmentation or that reads affect wear. This reasoning explains the design focus.

Q11. An indexed allocation scheme uses an index block that can hold 128 pointers. How many data blocks can a file contain without needing a second‑level index?

A.128 ✅
B.256
C.64
D.512
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Each pointer in the index block directly references a data block, so the maximum number of blocks equals the number of pointers, which is 128. Doubling that number would require an additional index level, and the smaller values underestimate capacity. Knowing this limit helps compare indexed allocation to other schemes like multi‑level indexing or log‑structured approaches.

Q12. In a log‑structured file system, what role does the checkpoint region play?

A.It records the location of the latest segment headers ✅
B.It stores user data
C.It caches the entire file system metadata
D.It holds the boot loader
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The checkpoint region contains pointers to the most recent segment headers and other critical metadata, enabling the system to recover quickly after a crash by locating the start of the current log. It does not hold user data, full metadata caches, or boot code. Understanding this function clarifies how log‑structured systems achieve fast recovery.

🔗 Related Topics (MCQs)