$24
**Developers**: Diego Magdaleno, Shawn Chumbar, Sean Dow
## Setup the File System
**Note:** We assume that you already have FUSE v2.9.5 installed. For instructions on how to do that, see the Assignment 4 worksheet.
For the initial setup, we need to create the directory where the file system will be mounted. Do this with:
make install
All this does is create the directory './mntAOFS/' in your current directory. This is where the file system will be mounted. This is based on the `AOFS_MOUNT` value in the makefile.
## Building the system
The simplest way to build the file system is to run the following:
sudo make build
This command does several things: it compiles the project, loads the fuse kernel module, unmounts the current file system (if it's already mounted) and then mounts the newly compiled file system at the mountpoint `mntAOFS`.
AOFS should now be mounted, and ready to be used!
### Mounting and Unmounting
Other commands which might help are
sudo make mount
sudo make umount
which will mount and unmount the filesystem, respectively. Note that the 'make build' command already mounts the file system for you. These are useful for testing the persistence of the data -- you can umount the file system, reboot, and then remount it and it should still be there.
**NOTE:** Please always use the above commands from the same directory every time. The FS_FILE file ('FS_AOFS' on the disk) is assumed to be in the current working directory of where you run the command.
So if you first run the command in the repo, it'll put FS_AOFS there. If you then reboot, and run the command from your home directory, it'll look for FS_AOFS there, not see it, and so create a new, empty file there. And then it will appear as if you've lost your data!
## Benchmark
To build the benchmark run:
make benchmark
You can then run it in a directory you specify. With no parameters it runs it in the current directory. To run it on the AOFS mountpoint, run:
./Benchmark mntAOFS/
and it will execute in the `mntAOFS/` directory.
### Cleaning
The oh-so-common command `make clean` exists and will do its job of erasing the compiled components of the project. However, the file system might still be mounted. To unmount it AND clean the directory run
sudo make reset
And you will be left with an (almost) fresh repository. All that should remain is the `mntAOFS` directory, which should now be unmounted and empty.
**PLEASE NOTE**: Doing either of these things WILL delete any data you previously stored on AOFS. You have been warned.
### Executable
Lastly, for completeness, you can mount it using the executable. Just run
sudo ./aofs <directory
and it will mount in the targetted directory. You can then umount it using standard UNIX utilities such as `umount`. This allows you to specify the mountpoint, but please note that the file FS_AOFS will still be located in the current working directory.
## Misc Files
There are a lot of files in this project, so we might as well give a rundown of each one
##### aof.c
This is the main file being compiled, the one with the actual FUSE calls. It serves as the top level of our code, where calls like `aofs_write` just parse the file name and then call lower-level functions.
##### Bitmap.h and Bitmap.c
An implementation of a bitmap in C using structs and char arrays. These files include ways of locating the first free block in the bitmap, as well as a nice abstraction away from lseek'ing all over the file.
##### Block.h and Block.c
Similar to the Bitmap files, these functions deal with reading and writing data to a specified block, whether it's the matadata or user's data.
This is also where the multi-block read and write functions are, denoted by the names "read_file_data" and "write_file_data". A file is made of multiple blocks, and as such the file functions use the block functions.
##### Makefile
It's the makefile to build the project. You've know it, I know it, and we all wish we had a better solution, but oh well.
##### Benchmark.c
Source code for the benchmark.
##### write_data.c
This is a very basic file that doesn't even have a build command in the makefile. All it does is write the numbers 0 through 255 to a file sequentially, and then roll-over and start anew. This goes on for 6144 iterations.
This was useful for debugging specific write errors when looking at the FS_AOFS file's hex dumps directly.
##### FS_AOFS
This isn't in the repo by default but is initialized when you first mount the file system. This is the file that AOFS actually writes to, and is where all your data is stored when it's written to `mntAOFS`.