Discussion questions: file systems

Please work out these problems before your next discussion section. The GSIs and IAs will go over these problems during the discussion section.

Use the fs_inode and fs_direntry data structures from Project 4 (from fs_server.h) Note: Blocks are 512 bytes, and inodes are block-sized.

1.

What is the minimum and maximum number of disk blocks that must be brought into memory in order to read the first block of the file /etc/passwd?

2.

A big file /bigfile that is 4 blocks in size is stored in the file system.

a. Draw out how /bigfile is laid out on disk. Include all inodes and data blocks required to store the file. Assume there are no other files.

b. A user program makes a read request from offset 1 from /bigfile. How many disk accesses are required to process the request?

c. i) How many disk accesses are required to process a read request on offset 2 of /bigfile? ii) How many accesses would it be if we had cached the blocks from part b?

d. If we wanted to add a new directory, /foo, how many new disk blocks do we need to allocate? Update your diagram from part a with the new disk blocks.

e. A request for a new file, /foo/bar, has been made. How many new disk blocks do we need to allocate? Update your diagram from part a with the new disk blocks.