make
to build the module. Assuming that worked, you can now run:
sudo insmod ./hw9fs.ko
to load the module. To see if the module is loaded, take a look in /proc/filesystems
and look for hw9fs
. Also, try running tail /var/log/messages
, to see some debug output. With the module loaded, we can now use our filesystem. Run
sudo mount -t hw9fs -o ro,loop test.img mnt
to mount the disk image test.img
in read-only mode, using our filesystem hw9fs
. The directory mnt
, which used to be a regular directory, now contains our mounted filesystem. See if your output looks like mine:
jakob@ubuntu:~/hw9$ ls mnt ls: cannot access mnt/nonexisting_file: No such file or directory existing_file nonexisting_fileClearly, there is something wrong with
nonexisting_file
, but let's not worry about it. Let's see what's in existing_file
.
jakob@ubuntu:~/hw9$ cat mnt/existing_file File 3 comes second to last, and it is a long file. File 3 comes second to last, and it is a long file. File 3 comes second to last, and it is a long file. ... File 3 comes second to last, and it is a long file. File 3 comes second to last, and it jakob@ubuntu:~/hw9$If you got this far, you're ready to get started. To remove the module, first unmount the filesystem:
sudo umount mnt
then unload the module
sudo rmmod hw9fs
hexdump -C test.img
. It consists of two types of 1024-byte blocks: a single disk header block (superblock) which comes first, followed by a number of data blocks. The header consists of up to 30 adjacent structs like this:
Filename | Size![]() |
---|---|
char[26] | int |
mkcs385fs test_directory/ test.img
creates the supplied disk image.
ls mnt
and ls -l
mnt should show no error messages or question marks. For an example output, try ls -l test_directory
. Filename and size must be correct, and the files must be readable, the rest is not important, but no question marks or error messages are allowed.
cat
. To do this, you will mostly need a way to map a "file block" into a disk block. The output of cat mnt/*
should be identical to cat test_directory/*
.
Copyright 2016 The Board of Trustees of the University of Illinois.webmaster@cs.uic.edu |
WISEST Helping Women Faculty Advance Funded by NSF | ![]() | ![]() |