Skip to main content

Section 5.5 Consistency: FSCK and Journaling

We now start look at ways to ensure consistency in the file system. Start by reading the Crash Consistency: FSCK and Journaling chapter, section 42.1 and the preamble.

Practice 5.5.1.

When trying to write to a disk, which of the following problems do we want to avoid as a result of a power loss?
  • We’ve added the contents of a new file, but not the directory that lists the file.
  • We’ve added the contents of a new file, but didn’t update the parent directory that should list the file.
  • We’ve updated the contents and size of a file, but the inode still shows the old information.
  • We have written new file contents in a block but did not update the block bitmap to mark the block as used.
  • We have not added the file we were trying to add or any information about it.

Practice 5.5.2.

Practice 5.5.3.

Read section 42.4 about the FSCK solution to the crash consistency problem.

Practice 5.5.4.

    True or False: FSCK prevents crash inconsistencies from happening in the first place.
  • True.

  • No, FSCK aims to fix the inconsistency when the system reboots.
  • False.

  • No, FSCK aims to fix the inconsistency when the system reboots.

Practice 5.5.5.

    True or False: FSCK can do its work while the file system is actively in use.
  • True.

  • False.

Practice 5.5.6.

What kinds of checks does FSCK do?
  • The size of the system as declared in the superblock is more than the number of reported blocks.
  • If an inode points to a block, we make sure the block bitmap for that block is marked.
  • If an inode is listed in directory contents, we make sure the inode bitmap for that inode is is marked.
  • The link count of allocated inodes is verified to match the number of directories linking to them.
  • Inodes that are not linked to by any directory are moved to a special directory.
  • If two inodes refer to the same block.
  • If there are any typos in user-stored data, they are corrected.
  • If files are marked as having the wrong format (e.g. text vs image), this is rectified.

Practice 5.5.7.

What are the main drawbacks of FSCK?
  • It is slow as it tries to check everything.
  • It may not find the problems.
  • It can only run while the file system is inactive.
Read section 42.3 about the journaling (write-ahead logging) approach to dealing with crash-inconsistencies.

Practice 5.5.8.

Practice 5.5.9.

Practice 5.5.10.

    True or False: If a crash occurs halfway through the checkpoint process, we can recover by simply restarting the checkpoint process.
  • True.

  • False.

Practice 5.5.11.

    True or False: With disk write-buffering, requested writes may occur in an order different than the one intended, with a possible crash resulting in a case where a sequence of two writes A-B may result in only the second write happening.
  • True.

  • False.

Practice 5.5.12.

What is ordered journaling?
  • When we only record metadata information in the log, while the user data is written directly to disk.
  • When transactions in the log are written in order one after the other and not circling back.
  • When we keep the log nice and tidy.
Read section 42.4 about other approaches, and section 42.5 about a brief summary.
You have attempted of activities on this page.