From OSLab

Labs: FileSystems

File Systems

Objective

The goal of this lab is to write a simple UNIX-like file system. The file system you will write make the following simplifying assumptions:

The layout of your 128 KB disk is as follows

char name[8]; //file name
int size;     // file size (in number of blocks)
int blockPointers[8]; // direct block pointers
int used;             // 0 => inode is free; 1 => in use

Note that each inode is 48 bytes in size; Since you have 16 of these, the total size of occupied by the inodes is 768 bytes. The free/used block information (mentioned above) is 128 byes. So the total space used in the super block is 896 bytes. The remaining bytes are unused.

For more related information, please refer to Lab details.

You need to implement the following operations for your file system.

Background

An example to mount BFS file system

To enable bfs filesystem in UML, you should create a second ubd block device and mount it under UML. For example, the following steps tell you how to mount a bfs filesystem.

  1. If you have not compiled bfs before, select bfs using make menuconfig, then recompile UML kernel
  2. Before you start UML, go the directory where you put root_fs
  3. Make a 4M image: dd if=/dev/zero of=bfs_fs count=4 bs=1M
  4. Go to your source directory and start UML: ./linux ubd0=../root_fs ubd1=../bfs_fs
  5. Inside UML, create a new bfs filesystem on the 2nd block device: mkfs.bfs /dev/ubd/1
  6. Create a mount point: mkdir /fs
  7. Mount your bfs filesystem: mount -t bfs /dev/ubd/1 /fs

Other very useful informations

Virtual Filesystem (VFS)

Submitting Your Assignment

Please submit the following items to lab7 dir on elgate:

  1. All source codes/files that you have added/modified and the demonstrative results;
  2. A "README" file that contains the follows :
    1. Design, for instance, how did you build your file system and make it be recognized by the kernel;
    2. How did you demonstrate that the file system works;
    3. Suggestions/lessons and useful materials you found;
    4. List of all your files you submitted.
  3. Compiled kernel image with the new changes. Also please notify us which root filesystem you have been using for all labs.

Thank you and have fun!

Retrieved from http://www.oslab.info/index.php/Labs/FileSystems
Page last modified on August 19, 2006, at 10:16 PM EST