Operating System Long Questions and AnswersHere in this section of Operating System Long Questions and Answers,We have listed out some of the important Long Questions with Answers on File System Consistency which will help students to answer it correctly in their University Written Exam.

Lists of Long Descriptive type Questions that may be asked in Written Exams.

  • (1) Explain File System Consistency.

Question-1Explain File System Consistency.

  • To deal with the problem of inconsistent file systems, most computers have a utility program that checks file system consistency. For example, UNIX has fsck and Windows has scandisk.
  • This utility can be run whenever the system is booted, especially after a crash.
  • The description below tells how fsck works.
  • Two kinds of consistency checks can be made: blocks and files.
  • To check for block consistency, the program builds two tables, each one containing a counter for each block, initially set to 0.
  • The counters in the first table keep track of how many times each block is present in a file; the counters in the second table record how often each block is present in the free list (or the bitmap of free blocks).
  • The program then reads all the i-nodes.
  • As each block number is read, its counter in the first table is incremented.
  • The program then examines the free list or bitmap, to find all the blocks that are not in use. Each occurrence of a block in the free list results in its counter in the second table being incremented.
  • If the file system is consistent, each block will have a 1 either in the first table or in the second table, as illustrated in Figure below (a).
  • If the file system is not consistent, following types of inconsistency may occur.
  • The tables might look like Fig below (b), in which block 2 do not occur in either table.
  • It will be reported as being a missing block.
  • The solution to missing blocks is straightforward: the file system checker just adds them to the free list.
  • Another situation that might occur is that of Fig below (c).
  • Here, number 4 occurs twice in the free list. (Duplicates can occur only if the free list is really a list; with a bitmap it is impossible.) The solution here is also simple: rebuild the free list.
  • The worst thing that can happen is that the same data block is present in two or more files, as shown in Fig below (d) with block 5.
  • The appropriate action for the file system checker to take is to allocate a free block, copy the contents of block 5 into it, and insert the copy into one of the files.
  • In addition to checking to see that each block is properly accounted for, the file system checker also checks the directory system. It uses a table of counters per file.
  • It starts at the root directory and recursively descends the tree, inspecting each directory in the file system. For every file in every directory, it increments a counter for that file’s usage count.
  • When it is all done, it has a list, indexed by i-node number, telling how many directories contain each file. It then compares these numbers with the link counts stored in the i-nodes themselves.
  • In a consistent file system, both counts will agree.
  • However, two kinds of errors can occur:
  • The link count in the i-node can be too high or it can be too low.
  • If the link count is higher than the number of directory entries, it should be fixed by setting the link count in the i-node to the correct value.
  • The other error is potentially catastrophic. If two directory entries are linked to a file, but the i-node says that there is only one, when either directory entry is removed, the i-node count will go to zero.
  • When an i-node count goes to zero, the file system marks it as unused and releases all of its blocks.

This action will result in one of the directories now pointing to an unused i-node, whose blocks may soon be assigned to other files. Again, the solution is just to force the link count in the i-node to the actual number of directory entries.

system states

Share with : Share on Linkedin Share on Twitter Share on WhatsApp Share on Facebook