🎓 BookMCQ
← Back to 12. File System Implementation

📝 Consistency checking and Recovery (11 MCQs)

Detecting Metadata and Allocation Inconsistencies

File-system consistency checking examines stored metadata and allocation structures to identify errors that could make files inaccessible or cause storage blocks to be incorrectly assigned. Recovery mechanisms attempt to repair inconsistencies after crashes, power failures, or interrupted updates. Utilities such as fsck in Unix-like systems examine relationships among directories, inode structures, allocation information, and free-space records.

Why Interrupted Updates Can Damage File-System Structures

A file operation may modify several metadata structures, such as a directory entry, inode, and free-space bitmap. If a crash interrupts the sequence, only some changes may reach storage. The resulting filesystem can contain allocated blocks with no owner, references to missing objects, or inconsistent file sizes. Consistency checking identifies such conditions and attempts recovery.

Scanning Metadata and Repairing Allocation Records

A checking utility examines filesystem structures and compares their relationships. It identifies directory references, verifies inode information, and checks whether allocation maps agree with blocks actually assigned to files. Depending on the detected problem, it may repair metadata, recover disconnected objects, mark damaged regions, or report errors that require administrative attention.

Recovering an Orphaned File After a Crash

Suppose an interrupted operation leaves an allocated inode containing valid data blocks but no directory entry referencing it. A consistency checker identifies the disconnected object and may place it in a recovery directory when the filesystem's rules permit. This restores a reachable pathname for the recovered file, although its original name or directory location may not be recoverable.

Integrity Protection and Recovery Limitations

Consistency checking detects and repairs structural inconsistencies but can require lengthy scans on large storage volumes. Some repairs involve discarding damaged metadata or disconnected files. Checking alone cannot reconstruct every lost file content. Modern file systems supplement checking with journaling, checksums, transactional updates, or copy-on-write structures to reduce damage and accelerate recovery.

Common Misunderstandings About Filesystem Recovery

'Consistency checking guarantees recovery of all deleted data' is incorrect because it focuses on structural integrity. 'An allocated block must always belong to one reachable file' is incorrect because crashes can leave orphaned allocations. 'Journaling eliminates every need for checking' is incorrect because structural corruption and hardware errors can still occur.

Exam Focus: Orphan Detection and Metadata Repair

Identify inconsistencies between directory entries, inode references, and free-space maps. Trace how a consistency checker detects orphaned objects and incorrect block allocation. Distinguish structural repair from complete file-content recovery. Questions may also compare traditional filesystem checking with journaling and copy-on-write recovery mechanisms.

Key Terms of Filesystem Consistency

  • Consistency checking - Examines filesystem integrity.
  • fsck - Unix-like filesystem checking utility.
  • Orphan - Allocated object without a directory reference.
  • Inode - Stores file metadata.
  • Allocation map - Records storage ownership.
  • Recovery - Restores structural consistency.
2
Easy
5
Medium
4
Hard

📝 All Consistency checking and Recovery MCQs

Q1. What does FAT stand for?

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

📖 Explanation: The correct answer is File Allocation Table because the acronym FAT is universally used to denote the table that maps each disk block to its next block or to indicate end‑of‑file. Options B, C, and D are fabricated terms that are not used in operating‑system literature. Understanding the definition helps students recognize the structure that drives block location and seek calculations in FAT‑based file systems.

Q2. Why can the FAT allocation scheme cause a large number of disk‑head seeks?

A.Because the FAT must be read from the start of the volume for each block access ✅
B.Because the FAT stores data in compressed form
C.Because the FAT uses variable‑length entries
D.Because the FAT requires multiple passes over the directory
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Option A is correct: each time a block is needed the system must first move to the beginning of the volume to read the FAT entry, then move to the actual data block, creating two seeks per block. The other options describe unrelated characteristics; the FAT is not compressed, does not use variable‑length entries, and does not involve directory passes. This explains why un‑cached FAT leads to many seeks.

Q3. How does indexed allocation improve random‑access time compared with linked allocation?

A.All block pointers are gathered in a single index block, allowing direct calculation of a block's address ✅
B.It stores pointers in a binary tree that reduces search depth
C.It compresses pointers to save space, making reads faster
D.It eliminates the need for a FAT entirely
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Option A is correct because the index block holds an array of addresses, so the system can compute the location of any block directly without traversing a chain. Options B and C describe unrelated data structures, and D is inaccurate—linked allocation still requires a FAT or directory for metadata. The direct‑access benefit is vital for applications needing fast reads of arbitrary blocks.

Q4. What problem does linked allocation solve that contiguous allocation cannot handle efficiently?

A.External fragmentation and the need to declare file size in advance ✅
B.Increased read latency for sequential files
C.Inability to store files larger than a single block
D.Lack of support for file permissions
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The correct answer is external fragmentation and size declaration because linked allocation allows each block to be placed anywhere on the disk, avoiding gaps left by contiguous allocation and eliminating the need to know the total size beforehand. Options B, C, and D describe issues unrelated to allocation strategy. Recognizing this advantage explains why linked allocation is chosen for flexible file growth despite its slower direct access.

Q5. Why might a system choose to cache the FAT in main memory?

A.To eliminate the extra seek required to read the FAT for each block access ✅
B.To reduce the size of the FAT on disk
C.To enable variable‑length block pointers
D.To allow multiple files to share the same FAT entry
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Caching the FAT removes the need to reposition the disk head to the beginning of the volume for every block lookup, thereby cutting the number of seeks in half. Options B, C, and D are incorrect: caching does not change the FAT's on‑disk size, does not affect pointer length, and each file still has distinct entries. This practical benefit is why many operating systems keep the FAT resident in RAM.

Q6. A file occupies blocks 217, 618, and 339. If the FAT is not cached, how many disk‑head seeks are required to read the entire file?

A.6
B.3 ✅
C.9
D.0
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Each block access needs two seeks: one to move to the start of the volume to read the FAT entry, and another to move to the actual data block. With three blocks, the total is 3×2=63 \times 2 = 6 seeks. Option B counts only the data‑block moves, C multiplies by three unnecessarily, and D would imply no movement, which is impossible without caching. The calculation shows the performance penalty of an uncached FAT.

Q7. If the FAT is cached, how many seeks are needed to read the same three‑block file?

A.3 ✅
B.2
C.6
D.1
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When the FAT resides in memory, the system no longer needs to seek to the FAT for each block. Only one seek per data block remains, so three blocks require three seeks. Options B and D underestimate the required movements, while C repeats the uncached scenario. This illustrates the dramatic reduction in I/O operations achieved by caching the allocation table.

Q8. Reading the FAT takes 5 ms and moving to a data block takes 8 ms. What is the total time to read three blocks without caching?

A.39 ms
B.45 ms
C.27 ms
D.30 ms ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: For each block the system spends 5 ms+8 ms=13 ms5\text{ ms}+8\text{ ms}=13\text{ ms}. Three blocks require 3×13=393 \times 13 = 39 ms. Option B adds an extra 6 ms, C omits one seek, and D assumes only one seek per block. The answer demonstrates how seek and FAT‑read latencies accumulate, reinforcing why caching can significantly improve throughput.

Q9. Using indexed allocation, the index block resides on a separate track. How many seeks are required to read a file of four blocks without caching?

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

📖 Explanation: The first seek accesses the index block, then each of the four data blocks requires its own seek, totaling 1+4=51 + 4 = 5 seeks. Option B neglects the initial index‑block access, C adds an unnecessary extra seek, and D omits the data‑block moves. This scenario highlights that even with indexed allocation, each block still incurs a physical movement unless further caching is employed.

Q10. If the system caches the index block but not the data blocks, how many seeks are needed to read a five‑block file?

A.5 ✅
B.6
C.7
D.4
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The index block is read once (1 seek) and then cached. Each of the five data blocks still requires a separate seek, giving 1+5=61 + 5 = 6 seeks. Option A forgets the data‑block seeks, C adds an extra unnecessary seek, and D ignores the index‑block access. This calculation shows that caching the index block reduces, but does not eliminate, the overhead of reading multiple blocks.

Q11. What inconsistency could appear if a FAT entry erroneously points to the same block it describes?

A.The block would be considered both allocated and free, leading to a loop detection error ✅
B.The file size would double unexpectedly
C.The directory entry would become corrupted
D.The disk would report a checksum mismatch
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: When a FAT entry references itself, the allocation chain creates a self‑loop, causing the system to believe the block is both the start and the end of a file segment. This prevents proper traversal and may be flagged as a loop error. Options B, C, and D describe unrelated anomalies. Detecting such loops is a key part of consistency checking in file‑system utilities.

🔗 Related Topics (MCQs)