CS372H Spring 2011 Homework 9 Solutions

Problem 1

Suppose you have a file system with multi-level indexing (with 14 direct pointers, 1 indirect inode, 1 doubly indirect pointer, and 1 triple indirect pointer in the inode), directories, inodes statically allocated in an array 0..MAX_INUM to a known location on disk. Also assume there is an on-disk bitmap of free inodes and free sectors. Assume that the file containing the root directory is stored in a well-known inode with inumber ROOT_INUM.

Assume each file fits in one sector. Assume each inode consumes exactly one sector.

Consider creating a new file "/foo/bar" in the existing directory "foo" and writing one sector of data to that file.

Assume no in-memory cache.

  1. List the reads and writes that must be executed to accomplish this task (and explain how each disk address is determined.)

  2. Suppose we want to ensure that these actions occur reliably (e.g., if a crash occurs, the file ends up either created and full with the bitmaps and directories updated accordingly or not created with none of these updates having occurred). Using ordered synchronous metadata writes and FSCK (File System ChecK program --e.g., file system recovery on reboot), explain how to meet this guarantee. In particular,
    1. Write down the writes in order they should occur.
    2. List the actions that the fsck program must take to ensure the disk is brought to a correct state on recovery and show that these actions guarantee file systems consistency.

  3. Suppose we want to ensure reliable updates using logging (e.g., as per a journaling file system). List the series of writes (to the disk and log) in the order they should occur. Also describe what actions (if any) must be taken on recovery after a crash.

Solution:
Need solution.

Problem 2

You are implementing a file server that contains 25 16GB disks and uses the UNIX file system to implement the network file server (NFS). A engineer in the lab gives you a 1GB disk that she no longer needs. What would you do with this disk?

Solution:
If the UNIX file system uses a log-based (journalled) file system, then the 1GB disk would be ideal for storing the log, since there will be no competition for the head from ordinary access.