Lecture 24 - Filesystem Consistency

Every "reasonable" filesystem has some method of monitoring its own self-consistency (even chkdisk).

No matter what allocation policy is used for allocating disk blocks, it is necessary to keep track of which ones have been allocated. You can use:

We can do the same thing for inodes if your filesystem has them.

To check them for consistency:

  1. Create an array of counters for allocated and free blocks:
    Pasted image 20241208140531.png
  2. Sweep through the filesystem and free list and increment the aprpopriate counter each time a block is found.

If all goes well each block will be found in one of the lists:
Pasted image 20241208140609.png
If not there's a problem:
Pasted image 20241208140628.png

You may have the following problems:

  1. Do the same thing for references counts from directories to inodes.

Possible problems: